changing logical file name

  • hi everyone,

    is it possible to change the filename of the databases? i backed up a database and want to restore it to another server, but the same filename exists on that server. please help, i need to get this done asap. thanks in advance for your help.

  • You can restore the database to the second server without changing the logical filename.  However, you should change the physical file name.  Use the "WITH MOVE" clause in the restore statement to name the physical file how you want it.

    Then, if you want to, you can change the logical names using an "ALTER DATABASE" using the "MODIFY FILE" clause...

    MODIFY FILE (NAME = logical_file_name, NEWNAME = new_logical_name...).

    Steve

  • you can have same logical filename on one server though. However, need different physical file name. Use "WITH MOVE" for that.

    For Example,

    RESTORE DATABASE test3

    FROM  DISK='c:\test.bak'

     WITH  MOVE 'test_Data' TO 'e:\test1.mdf',

      MOVE 'test_Log' TO 'e:\test_log1.ldf',

      REPLACE

     

  • Thank you, thank you, thank you!

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

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