|
Home > Archive > MS SQL Server Tools > December 2006 > restoring a database
You are viewing an archived Text-only version of the thread.
To view this thread in it's original format and/or if you want to reply to
this thread please [click here]
| Author |
restoring a database
|
|
|
| I'm trying to restore a database that was backed up on another computer. The
command I used was:
RESTORE DATABASE iDB
FROM DISK = 'f:\xxxxx\sqlbackup'
The error I get is:
Server: Msg 3101, Level 16, State 1, 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.
No one is using this database. The database is local on my computer and
applications are open.
| |
| Erland Sommarskog 2006-12-03, 7:21 pm |
| Ron (Ron@discussions.microsoft.com) writes:
> I'm trying to restore a database that was backed up on another computer.
> The command I used was:
> RESTORE DATABASE iDB
> FROM DISK = 'f:\xxxxx\sqlbackup'
> The error I get is:
> Server: Msg 3101, Level 16, State 1, 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.
> No one is using this database. The database is local on my computer and
> applications are open.
Very apparently someone is using this database. Maybe it is yourself?
Make sure that your current database when you run this command is
not the database you are trying to restore. Also, if you are using
Managment Studio, make sure the the current node is in some other
database.
You can use sp_who2 find processes that has this database as their current
database. Just check the DBName column. When you have found the culprit, you
can use the KILL command.
If you are very impatient, you can throw out all users with
ALTER DATABASE iDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
Don't forget to set the database back to multi-user after the restore.
--
Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
Books Online for SQL Server 2005 at
http://www.microsoft.com/technet/pr...oads/books.mspx
Books Online for SQL Server 2000 at
http://www.microsoft.com/sql/prodin...ions/books.mspx
| |
|
| Thanks. That was it. I opened the query analyzer while in that database.
"Erland Sommarskog" wrote:
> Ron (Ron@discussions.microsoft.com) writes:
>
> Very apparently someone is using this database. Maybe it is yourself?
> Make sure that your current database when you run this command is
> not the database you are trying to restore. Also, if you are using
> Managment Studio, make sure the the current node is in some other
> database.
>
> You can use sp_who2 find processes that has this database as their current
> database. Just check the DBName column. When you have found the culprit, you
> can use the KILL command.
>
> If you are very impatient, you can throw out all users with
>
> ALTER DATABASE iDB SET SINGLE_USER WITH ROLLBACK IMMEDIATE
>
> Don't forget to set the database back to multi-user after the restore.
>
> --
> Erland Sommarskog, SQL Server MVP, esquel@sommarskog.se
>
> Books Online for SQL Server 2005 at
> http://www.microsoft.com/technet/pr...oads/books.mspx
> Books Online for SQL Server 2000 at
> http://www.microsoft.com/sql/prodin...ions/books.mspx
>
|
|
|
|
|