2012-07-06

TSQL - Moving the master database

Moving the master Database (SQL Server 2012)



To move the master database, follow these steps.
  1. From the Start menu, point to All Programs, point to Microsoft SQL Server, point to Configuration Tools, and then click SQL Server Configuration Manager.
  2. In the SQL Server Services node, right-click the instance of SQL Server (for example, SQL Server (MSSQLSERVER)) and choose Properties.
  3. In the SQL Server (instance_name) Properties dialog box, click the Startup Parameters tab.
  4. In the Existing parameters box, select the –d parameter to move the master data file. Click Update to save the change.
    In the Specify a startup parameter box, change the parameter to the new path of the master database.
  5. In the Existing parameters box, select the –l parameter to move the master log file. Click Update to save the change.
    In the Specify a startup parameter box, change the parameter to the new path of the master database.
    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 example shows the parameter values for the default location of the master data file.
    -dC:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\master.mdf
    -lC:\Program Files\Microsoft SQL Server\MSSQL11.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
    If the planned relocation for the master data file is E:\SQLData, the parameter values would be changed as follows:
    -dE:\SQLData\master.mdf
    -lE:\SQLData\mastlog.ldf
  6. Stop the instance of SQL Server by right-clicking the instance name and choosing Stop.
  7. Move the master.mdf and mastlog.ldf files to the new location.
  8. Restart the instance of SQL Server.
  9. Verify the file change for the master database by running the following query.
    SELECT name, physical_name AS CurrentLocation, state_desc
    FROM sys.master_files
    WHERE database_id = DB_ID('master');
    GO


Source:
http://msdn.microsoft.com/en-us/library/ms345408.aspx

No comments:

Post a Comment