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
Pantelis Apostolidis is a Sr. Specialist, Azure at Microsoft and a former Microsoft Azure MVP. For the last 20 years, Pantelis has been involved to major cloud projects in Greece and abroad, helping companies to adopt and deploy cloud technologies, driving business value. He is entitled to a lot of Microsoft Expert Certifications, demonstrating his proven experience in delivering high quality solutions. He is an author, blogger and he is acting as a spokesperson for conferences, workshops and webinars. He is also an active member of several communities as a moderator in azureheads.gr and autoexec.gr. Follow him on Twitter @papostolidis.