Activity: How to move your SQL Server master Database to another drive?
---------------------------------------------------------------------------------------------------------------------------
Workaround : when you want to move your master database from the default location to some other drive. Now this activity cannot be done with the normal ALTER DATABASE statement with MODIFY FILE option. And you need a special handling for this case of master DB.
Now leave SSMS, and open SSCM i.e. SQL Server Configuration Manager. Here select “SQL Server Service”, and Right Click on the instance of SQL Server, and choose Properties. Now select the Startup Parameters tab.

Here you will see 3 line items:
1. -d is the path of the master data file.
2. -e is the path of the SQL error log file.
3. -l is the path of the master log file.
So, you need to update the 1st and 3rd ones. As I want to move my files to E:\SystemDatabases\Master\ location, so you just need to replace the existing path with following:
1. master data File:
-dC:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\master.mdf
-dE:\SystemDatabases\Master\master.mdf
2. master Log File:
-lC:\Program Files\Microsoft SQL Server\MSSQL13.MSSQLSERVER\MSSQL\DATA\mastlog.ldf
-lE:\SystemDatabases\Master\mastlog.ldf
–> Now Stop the SQL Server services, by going to: RUN –> services.msc
–> Manually Copy the master.mdf & mastlog.ldf files to the new location
–> Start the SQL Server services.
–> To confirm the new location, just execute following query and check the path:
1
2
3
4
| USE masterGOSELECT * FROM sys.database_files |

No comments:
Post a Comment