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 |
|
amirs
Constraint Violating Yak Guru
260 Posts |
Posted - 2008-05-07 : 02:13:08
|
| hiWhile restoring the SQL Server2005 database , I got the message: Exclusive access could not be obtained because the database is in use. |
|
|
GilaMonster
Master Smack Fu Yak Hacker
4507 Posts |
Posted - 2008-05-07 : 02:20:18
|
| Someone's using the database. There must be no connections to the DB in order to restore it (hence exclusive access)--Gail Shaw |
 |
|
|
Lumbago
Norsk Yak Master
3271 Posts |
Posted - 2008-05-07 : 03:00:22
|
| Try to alter it's state to SINGLE USER and see if you can do a restore after that. If that also fails you can open activity monitor and identify the SPID of the user that's connected to the database. Then issue a KILL command on the spid. The last however one is quite nasty so it should only be a last resort... The best thing to do is to close all connections in a controlled manner. That means close all query analyzer/mgmt studio windows, shut down any webconnections, etc.--Lumbago |
 |
|
|
rmiao
Master Smack Fu Yak Hacker
7266 Posts |
Posted - 2008-05-07 : 16:31:12
|
| Don't run restore statement under the db which you need to restore to. |
 |
|
|
|
|
|