Practice Restores Failure--Newbie Question

  • Hi

    I am practicing restoring from a file share. The destination database that I want to restore to is named Test and I want the restore from a full backup on the file share to create and populate this Test database. I am getting the error message of "Restore of database 'Test' failed. Exclusive access could not be obtained because the database is in use." Would someone explain to me why if restoring from a device to a new database, I would be getting this error?

    Thanks

    Kathy

  • Hi

    There are several things you can try.

    I am practicing restoring from a file share. The destination database that I want to restore to is named Test

    Am I right in thinking that you've created this database already? You don't actually need to do that before you restore a database in SQL Server, so if it's just an empty one (that you definitely don't need :-D!) drop it and then try your restore again. The act of doing the restore will create the database for you.

    Alternatively, you can see what is connecting to the database by using sp_who2, and (if you want) killing those other connections first. You may find that you are actually the person using the database, so if you are, disconnect any other sessions/tabs you don't need, switch to the master database and then try your restore again.

  • Thanks for responding. I haven't created the 'Test' database, I was hoping that I could restore from the backup file to create and populate the 'Test' database but I get the message about exclusiveness. So I'm wondering if I need to create the database first but I thought that I could restore from a backup of a different database and restore to a different destination new database name.

    Thanks

    Kathy

  • I think I found a problem with security to the folder on the file share. From my understanding the sql db engine account has to have full control of the folder to do a restore and I don't see that permission given. I'll have to ask to get this permission setup and then continue my practice.

    Thanks again for the input!

  • The error means you were trying to restore over an existing database and there was at least one connection. Double-check the name of the database you're restoring as, make sure that it doesn't exist and that you haven't accidentally selected/entered a database name that does exist.

    Gail Shaw
    Microsoft Certified Master: SQL Server, MVP, M.Sc (Comp Sci)
    SQL In The Wild: Discussions on DB performance with occasional diversions into recoverability

    We walk in the dark places no others will enter
    We stand on the bridge and no one may pass

Viewing 5 posts - 1 through 4 (of 4 total)

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