database restore

  • I have two databases, one live, one test.  Id like to restore a backup of the live database over the top of my test database so theyre both in sync.  How can I achieve this ?  (Obviously I dont want the live database backup to restore, I just need a copy of it in the test database)

     

    any help would be greatly appreciated.

     

    TIA

     

    Mark

  • RESTORE DATABASE TestDatabase FROM DISK = 'D:\MSSQL7\BACKUP\LiveDatabase.DMP'

        WITH REPLACE,

             MOVE 'LiveDatabase_Data' TO 'D:\MSSQL7\Data\TestDatabase_Data.MDF',

             MOVE 'LiveDatabase_Log'  TO 'D:\MSSQL7\Data\TestDatabase_Log.LDF'

    Replace the folder locations to suit your environment

    Far away is close at hand in the images of elsewhere.
    Anon.

  • David is correct with his answer.

    You can take this one step further and create a job to refresh the database whenever you need. This creates a repeatable and efficient process, and allows you to schedule your refreshes, which is import is the database is large.

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

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