TEMPDB space issue

  • what is the alter tempdb command to move the tempd.mdf file from D:\MSSQL2005\MSSQL$Instance\MSSQL.1\MSSQL\Data to the H:\SQL directory

  • Assuming tempdb logical names are the defaults (which they likely are):

    USE master;

    GO

    ALTER DATABASE tempdb

    MODIFY FILE (NAME = tempdev, FILENAME = 'H:\SQL\tempdb.mdf'); -- as in 'c:\tempdb.mdf'

    GO

    ALTER DATABASE tempdb

    MODIFY FILE (NAME = templog, FILENAME = 'H:\SQL\templog.ldf'); -- as in 'c:\templog.ldf'

    After this you'll have to stop and restart your SQL instance.

    Rob Schripsema
    Propack, Inc.

  • Then the tempdb.mdf file in original D:\ drive can be deleted?

  • Yes, after you're restarted the server instance. You'll know it is no longer in use when the OS allows you to delete it; as long as it's attached by SQL Server, you won't be able to.

    Rob Schripsema
    Propack, Inc.

  • Thanks for you reply.. but after executing this alter statement...

    can we do to move .mdf,.ldf to other location? or not ?

  • You can move the files, after the service has been stopped but there is no need as new ones are created

Viewing 6 posts - 1 through 5 (of 5 total)

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