Moving the Master and Resource Databases - SQL Server 2005 ONLY, the procedure has changed with SQL2008, specifically the resource database CAN NOT BE MOVED, look in books online.
- From the Start menu, point to All Programs, point to Micrsoft SQL Server 2005, point to Configuration tools, and then click SQL Server Configuration Manager.
- In the SQL Server 2005 Services node, right-click the instance of SQL Server (for example, SQL Server (MSSQLSERVER)) and choose Properties.
- In the SQL Server (Instance name) Properties dialog box, click the Advanced tab
- Edit the Startup Parameters values to point to the planned location for the master database data and log files, and clikc OK, Moving the error log file is optional.
The parameter value for the data file must follow the -d parameter and the value for the log file must follow the -l parameter. The following examples shows the parameter values for the default location of the master data and log files.
-dC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG;-lC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\DATA\mastlog.ldf
If the planned relocation for the master data and log files is E:\SQLData, the parameter values would be changed as follows:
-dE:\SQLData\master.mdf;-eC:\Program Files\Microsoft SQL Server\MSSQL.1\MSSQL\LOG\ERRORLOG;-lE:\SQLData\mastlog.ldf
- Stop the instance of SQL Server by right-clicking the instance name and choosing Stop.
- Move the master.mdf and mastlog.ldf files to the new location.
- Start the instance of SQL Server in master only recovery mode by entering one of the following commands at the command prompt. The parameters specified in these commands are case sensitive. The command fail when the parameters are not specified as shown.
• For the default (MSSQLSERVER) instance, run the following command.
NET START MSSQLSERVER /f /T3608
• For a named instance, run the following command.
NET START MSSQL$instancename /f /T3608
- Using sqlcmd command or SQL Server Management Studio, run the following statements. Change the FILENAME path to match the new location of the master data file. do not change the name of the database or the file names.
ALTER DATABASE mssqlsystemresource MODIFY FILE (NAME=data, FILENAME= 'new_path_of_master\mssqlsystemresource.mdf');
GO
ALTER DATABASE mssqlsystemresource MODIFY FILE (NAME=log, FILENAME= 'new_path_of_master\mssqlsystemresource.ldf');
GO
- Move the mssqlsystemresource.mdf and mssqlsystemresource.ldf files to the new location.
- Set the Resource database to read-only by running the following statement:
ALTER DATABASE mssqlsystemresource SET READ_ONLY
- Exit the sqlcmd utility or SQL Server Management Studio.
- Stop the instance of SQL Server
- Restart the instance of SQL Server
- Verify the file change for the master database by running the following query. The Resource database metadata cannot be viewed by using the system catalog views or system tables.
SELECT name, physical_name AS CurrentLocation, state_desc
FROM sys.master_files
WHERE database_id = DB_ID('master');
GO
- Done