0

I have setup a transactional replication on a sql 2008 database. Then I backup the database.I got following error when I try to restore the database. 'Exclusive access could not be obtained because the database is in use'

Do I have to remove the replication before restore database?

  • I'm only going to comment, because I haven't done it in a long time, but yes in general, you have to stop the replication when you do these things. Try and fill out your question a little more, are you trying to restore the backup into the primary database or the replicated copy? – Mike Mar 4 '14 at 20:45
  • Try to restore primary database and really don't want to delete replication. but looks like there is no way to stop but delete it. – user3380609 Mar 4 '14 at 20:49
1

If it's a full backup, and there's no real-time application being in use in the database. I would suggest stopping and deleting the database for a complete clean up. After that the restore can be done and the replication could be setup automatically from the restore.

| improve this answer | |
0

It means a connection is open to the database while you're attempting to restore. You need to set the database to single-user mode first.

PS. If I remember correctly, you'll lose all the system procedures created by the replication process. You'll have to re-initialize the subscription.

| improve this answer | |
  • not able to set primary database to single-user mode when there is replication using the database as publication. I want to restore the primary database without deleting the replication. not sure if it is possible. – user3380609 Mar 4 '14 at 20:56

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy