Restore Database Failed: 'Exclusive access could not be obtained because the database is in use.'

  • This was removed by the editor as SPAM

  • samanta0rodriges (7/30/2014)


    What is the default database for the job step running the restore?

    basically and mainly, the usage of the default DB points to "MASTER", as I did the same to.

    Are you also facing the same problem?

    (if no then great, if yes... then post any errors appeared and steps here so we can also learn from that, thank you)

    ww; Raghu
    --
    The first and the hardest SQL statement I have wrote- "select * from customers" - and I was happy and felt smart.

  • This was removed by the editor as SPAM

  • jacksonandrew321 (4/4/2016)


    you must set the database to single user mode before attempting to restore see here: http://www.sqlserverlogexplorer.com/exclusive-access-not-obtained-database-use/[/url]

    This is a two year old thread.

    You don't have to set the database to single user in order to restore a database. You do have to have exclusive access to the database you're restoring. One way of doing that can be to set the database to single user, although, if another connection is already there, that can cause problems. I generally go for restricted user, but, in this case, the third party apps all need privileged access, so that won't work either. Best approach here is likely just to kill every connection first.

    ----------------------------------------------------The credit belongs to the man who is actually in the arena, whose face is marred by dust and sweat and blood... Theodore RooseveltThe Scary DBAAuthor of: SQL Server 2017 Query Performance Tuning, 5th Edition and SQL Server Execution Plans, 3rd EditionProduct Evangelist for Red Gate Software

  • similar issue faced by me, i stopped and restarted the mssql server and agent in services.msc and then restored it worked

Viewing 5 posts - 16 through 19 (of 19 total)

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