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.
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 backupAnd I keep getting this error:Server: Msg 3101, Level 16, State 2, Line 1Exclusive access could not be obtained because the database is in use.Server: Msg 3013, Level 16, State 1, Line 1RESTORE DATABASE is terminating abnormally.I have used sp_who2 and no one else is using the database.I tried this command:ALTER DATABASE ABCSET SINGLE_USERbut 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 ABCSET SINGLE_USER WITH ROLLBACK_IMMEDIATE Harsh AthalyeIndia."The IMPOSSIBLE is often UNTRIED" |
 |
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2007-06-06 : 14:22:06
|
Don't run restore under target db. |
 |
|
ashley.sql
Constraint Violating Yak Guru
299 Posts |
Posted - 2007-06-07 : 09:00:09
|
Duh! I am notALTER DATABASE ABCSET SINGLE_USER WITH ROLLBACK_IMMEDIATEhelpedAshley Rhodes |
 |
|
|
|
|