Change System Databases Path

To change the path of the system databases first stop the SQL Database Engine service. Then open an elevated command prompt and run:

NET START MSSQLSERVER /f /T3608
SQLCMD -S .

Then run:

1>SELECT name, physical_name, state_desc FROM sys.master_files ORDER BY database_id;
2>GO;
/*This will list all the system databases and their paths*/
/*Then you can alter the paths with the following commands:*/
1>ALTER DATABASE model MODIFY FILE ( NAME = modeldev, FILENAME = 'c:model.mdf');
2>ALTER DATABASE model MODIFY FILE ( NAME = modellog, FILENAME = 'c:modellog.ldf');
3>ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBData, FILENAME = 'c:MSDBData.mdf');
4>ALTER DATABASE msdb MODIFY FILE ( NAME = MSDBLog, FILENAME = 'c:MSDBLog.ldf');
5>ALTER DATABASE tempdb MODIFY FILE ( NAME = tempdev, FILENAME = 'c:temp.mdf');
6>ALTER DATABASE tempdb MODIFY FILE ( NAME = templog, FILENAME = 'c:temp.ldf');
7>GO;
/*Type exit to end the SQLCMD*/
8>exit

 

Finally stop the SQL service and start it from the services mmc.

NET STOP MSSQLSERVER

Share

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.