How to move Tempdb to another Drive.

USE TempDB GO EXEC sp_helpfile--By this we can find where the .mdf and .ldf files are placed defaultly. GO USE master GO ALTER DATABASE TempDB MODIFY FILE (NAME = tempdev, FILENAME = 'D:\30-04-2009BAK\Tempdb\datatempdb.mdf') GO ALTER DATABASE TempDB MODIFY FILE (NAME = templog, FILENAME = 'E:\TempdbLog\datatemplog.ldf') GO After running the above query Stop and Restart the services.
USE master
GO
ALTER DATABASE TempDB MODIFY FILE
(NAME = tempdev, FILENAME = 'D:\DATA\tempdb.mdf')
ALTER DATABASE TempDB MODIFY FILE
(NAME = temp2, FILENAME = 'D:\DATA\tempdb_mssql_2.ndf')
ALTER DATABASE TempDB MODIFY FILE
(NAME = temp3, FILENAME = 'D:\DATA\tempdb_mssql_3.ndf')
ALTER DATABASE TempDB MODIFY FILE
(NAME = temp4, FILENAME = 'D:\DATA\tempdb_mssql_4.ndf')
GO
ALTER DATABASE TempDB MODIFY FILE
(NAME = templog, FILENAME = 'D:\DATA\templog.ldf')
GO
After this change stop and start the services and you can see the data files of temp databases in respective path.

Comments

Popular posts from this blog

Always On FailOver Events

System.Data.SqlClient.SqlException (0x80131904): Execution Timeout Expired. The timeout period elapsed prior to completion of the operation or the server is not responding. ---> System.ComponentModel.Win32Exception (0x80004005): The wait operation timed out

The transaction log for database is full due to 'OLDEST_PAGE'