Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2000 Forums
 SQL Server Administration (2000)
 Unable to obtain exclusive access when restoring

Author  Topic 

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-06-06 : 10:42:26
I am trying to restore a database from backup
And I keep getting this error:

Server: Msg 3101, Level 16, State 2, Line 1
Exclusive access could not be obtained because the database is in use.
Server: Msg 3013, Level 16, State 1, Line 1
RESTORE DATABASE is terminating abnormally.

I have used sp_who2 and no one else is using the database.

I tried this command:

ALTER DATABASE ABC
SET SINGLE_USER

but it just keeps on executing for ever.

What is the best way to get rid of these errors and restore from the bakup file.

Ashley Rhodes

harsh_athalye
Master Smack Fu Yak Hacker

5581 Posts

Posted - 2007-06-06 : 10:46:07
Try this:

ALTER DATABASE ABC
SET SINGLE_USER WITH ROLLBACK_IMMEDIATE



Harsh Athalye
India.
"The IMPOSSIBLE is often UNTRIED"
Go to Top of Page

rmiao
Master Smack Fu Yak Hacker

7266 Posts

Posted - 2007-06-06 : 14:22:06
Don't run restore under target db.
Go to Top of Page

ashley.sql
Constraint Violating Yak Guru

299 Posts

Posted - 2007-06-07 : 09:00:09
Duh! I am not

ALTER DATABASE ABC
SET SINGLE_USER WITH ROLLBACK_IMMEDIATE

helped

Ashley Rhodes
Go to Top of Page
   

- Advertisement -