Restore databases with TSQL

  • Dear All,

    I want todo the following:

    On one server A backup (maintenanceplan) a database 'x'

    Restore to server B same database 'x' with the same users.

    Without stopping the service.

    I made a tsql script on server B where anything goes oke.

    But it's complaining that the old 'x' database on server B is in use.

    How can I solve that in a TSQL script.

    Or has somebody other solutions.

    Thanx sofar.

    Casper Diepenheim

  • You might find something in our script library, we have a pretty good selection these days. The replace option of the restore command will drop the existing database before restoring. If it actually has users then you'll have to write more code to kill any connections to that db.

    Andy

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

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