Saturday 26 February 2011

Moving Database Files

    -- Step1: put the database offline
    ALTER DATABASE [Database_Name] SET OFFLINE;
    GO
    
    -- Step2: move the file to the new location
    ALTER DATABASE [Dataabase_Name] MODIFY FILE (NAME = [Logical_File_Name], FILENAME = 'New File Path')
    GO
  
    -- Physically move the file to new location

    -- Step3: bring the database online
    ALTER DATABASE [Database_Name] SET ONLINE
    GO

No comments:

Post a Comment

Note: only a member of this blog may post a comment.