Move tempdb log file without restart

  • Hi

    We have two log files for tempdb. One is on D: and the other one is on E:.

    Now I want merge these two log files into one and place it on F drive. If I can move both the log files to F drive, that is also okay.

    Can I do this without restarting the SQL Server service? I am assuing that there should be some way to do this by using ALTER database, TRUNCATE file etc ... but I can't figure out where to start.

    Please guide me...

    Thanks

    Prasad

  • It looks like EMPTYFILE argument of DBCC SHRINKFILE will help me. But I still need to figure out how?

    Bottomline ... I have move the log file(s) of tempdb to a dedicated drive without restarting the SQL Server.

    Any suggestions are highly appriciated.

  • This script will move the files:

    use master

    Alter database tempdb modify file (name = tempdev, filename = 'f:\data\logs\tempdb.mdf')

    Alter database tempdb modify file (name = templog, filename = 'f:\data\logs\templog.ldf')

    As far as I know, there's no way to move TempDB without stopping and restarting SQL Server.  You can execute the script, but the change itself won't take affect until SQL Server is restarted.  You don't have to restart the file server, just the SQL Server service which will minimize your downtime. 

    My hovercraft is full of eels.

Viewing 3 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic. Login to reply