Back Up and Restore Scripts

  • How do you write a script to back up and restore a database , however you back up database A but restore in another machine using the name B instead of A?

    how do you write a script in Query Analyzer to do that?

  • DUMP DATABASE OLDDBNAME TO DISK='D:\DBA\DBDUMPS\OLDDBNAME_DBDUMP_20030402.DMP'

    GO

    RESTORE DATABASE NEWDBNAME FROM DISK='D:\DBA\DBDUMPS\OLDDBNAME_DBDUMP_20030402.DMP' WITH MOVE 'OLDDBNAME' TO 'c:\test\NEWDBNAME.mdf',

    MOVE 'OLDDBNAME_log' TO 'c:\test\NEWDBNAME.ldf'

    GO

    Hope this Helps!!!

    Regards,

    Murali.

    .

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

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