Tuesday 29 March 2011

Moving System Databases

~~ Backup both System Databases and user Databases before starting ~~

Move TempDB

1: Find location of TempDB, Naming of files (This is more for peace of mind than a nessacry step)

use TempDB
go
sp_helpfile
go

2: Run the below code: Changes the location  SQL Server will look for the .mdf and ldf file locations

use master
go
Alter database tempdb modify file (name = tempdev, filename = 'E:\tempdb.mdf')
go
Alter database tempdb modify file (name = templog, filename = 'E:\templog.ldf')
Go

Restart SQL Service (Below is the command to stop the Default Instance of SQL Server service. You can also do it via the SQL Server Configuration Manager or Services)

NET STOP MSSQLSERVER

Start the SQL Service up again and check the location of the files using sp_helpfile again to confirm the move worked.

No comments:

Post a Comment