Friday, October 10, 2008

Move TempDB, Recreate missing TempDB

You can move tempdb by running the following script. If tempdb is missing (due a drive failure, for example), you will need to start the SQL Service with -T3608 for the startup option and then run the script.

/*If tempdb is unavailable, stop and start the SQL service with the
startup option -T3608
This allows you to start SQL without tempdb.
*/

USE master
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = tempdev, FILENAME = 'C:\tempdb.mdf')
GO
ALTER DATABASE tempdb
MODIFY FILE (NAME = templog, FILENAME = 'C:\tempdb.ldf')
GO

No comments: