RESTORE WITH MOVE

  • I am scheduling a restore process of my databse, i am confused about the "MOVE" option. I don't know what to indicate in the "TO" destination. Is the "TO" destination different from the destination of the log and mdf files of my database?

    Any help would be appreciated.

    Thank you,

    Isabel

  • Yes, 'TO' is to move your data files or log files to different locations, when you restore database backup.

  • what will happen if my "TO" is similar to the original path of my mdf and ldf files? will it cause error that will interrupt my restore? or will it overwrite my original mdf and ldf files? thanks

  • isabel (7/12/2009)


    I am scheduling a restore process of my databse, i am confused about the "MOVE" option. I don't know what to indicate in the "TO" destination. Is the "TO" destination different from the destination of the log and mdf files of my database?

    Any help would be appreciated.

    Thank you,

    Isabel

    WITH MOVE 'logical file name' TO 'physical file name'

    your database files have 2 names. 1) logical name - which you use within sql server, 2) physical operating system filename.

    While restoring, you must provide a physical path where your database files will be restored.

    eg..

    RESTORE DATABASE MyDB FROM DISK='C:\BACKUP\MyDB.BAK'

    WITH MOVE 'MyDB' TO 'C:\DATABASES\DATA\MyDB_DATA_FILE.MDF',

    MOVE 'MyDB_Log' TO 'C:\DATABASES\LOG\MyDB_LOG_FILE.LDF'



    Pradeep Singh

  • isabel (7/12/2009)


    what will happen if my "TO" is similar to the original path of my mdf and ldf files? will it cause error that will interrupt my restore? or will it overwrite my original mdf and ldf files? thanks

    If you use REPLACE clause, the existing database files will be overwritten with the ones restored from backup file.



    Pradeep Singh

  • Thanks to all, problem solved!

    Till next time.. 😀

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

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