Error occuring during Restoring database

  • Hi All,

    I got an error while restoring a database  . The error is "Exclusive access is could not be obtained because the database in use".

    I took the backup using the same user using  ' BACKUP DATABASE test TO DISK = 'C:\test.bak' ' . When I tried to restore the databse from the backup file using  ' RESTORE DATABASE Test FROM DISK = 'C:\test.bak'  ' I got the error . The database is not connectd to any other . Only one connection to run the sql. But I was able to retotre using Enterprise manager

     

    Biju

     

     

  • sp_who / sp_who2 might help to determine who blocks.

    If you haven en open EM connection to the db and an open connection to the db using QA, there are 2 connections, that is one to much

    Johan

    Learn to play, play to learn !

    Dont drive faster than your guardian angel can fly ...
    but keeping both feet on the ground wont get you anywhere :w00t:

    - How to post Performance Problems
    - How to post data/code to get the best help[/url]

    - How to prevent a sore throat after hours of presenting ppt

    press F1 for solution, press shift+F1 for urgent solution 😀

    Need a bit of Powershell? How about this

    Who am I ? Sometimes this is me but most of the time this is me

  • One quick way to clear these connections is to attemp to detach the databse in EM. The first screen will have a clear button. Clear the connections and then cancel the detachment.

  • As Alzdba stated use sp_who2 to find out who is connected. Then if you want to kick them off use KILL along with thier SPID that was in sp_who2. Just make sure you only do NON  SYSTEM spids!




    Gary Johnson
    Microsoft Natural Language Group
    DBA, Sr. DB Engineer

    This posting is provided "AS IS" with no warranties, and confers no rights. The opinions expressed in this post are my own and may not reflect that of my employer.

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

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