Groups | Blog | Home
all groups > sql server new users > march 2006 >

sql server new users : restore db issue


Sue Hoegemeier
3/18/2006 10:50:23 AM
The database is in use - that's what causes the error. You
need to make sure you aren't in the database itself when
trying to restore.
Try using something like:
USE master
go
ALTER DATABASE MyDB
SET SINGLE_USER WITH ROLLBACK IMMEDIATE
go
RESTORE DATABASE MyDB
FROM DISK = 'c:\MyDB.bak'

-Sue

On Sat, 18 Mar 2006 18:57:25 +0200, "Sam"
[quoted text, click to view]
Sam
3/18/2006 6:57:25 PM
can not restore through Transact-SQL
when i use:
RESTORE DATABASE MyDB
FROM DISK = 'c:\MyDB.bak'

I get: "Exclusive access could not be obtained because the database is in
use."

even database is not in any use

thanks

AddThis Social Bookmark Button