December 21, 2007 at 8:55 am
Still new to SQL Server - I've been asked to backup a test db w/ the production db data. I've copied the backup file from the prod db to test and I'm now trying to restore from that file but I'm getting the following error: "Exclusive access could not be obtained because the database is in use. RESTORE DATABASE is terminating abnormally." What do I need to do at this point? Is this the most efficient way to migrate the database from prod to test?
December 21, 2007 at 9:22 am
This is probably because there are still active connections to the DB that you are replacing with the new Back up. Check if there are Jobs running. You could stop the SQL Server Agent and also check the Activity Monitor. If there are still connections other than yours, Kill those connection and do then try the restore again.
-Roy
December 21, 2007 at 10:32 am
Be sure you're not one of the connections. Don't open a query window to that database, have one to master instead.
December 28, 2007 at 2:06 am
you can offcourse always put the db in singleuser mode within the restore-batch.
use master
alter database yourdb set single_user with rollback immediate;
restore database your db
from ......
raiserror ('DBA- Restore Notification: keep in mind to sync the sqluserid''s ! (sp_change_users_login @Action = ''Report'')' , 10,10)
go
Johan
Learn to play, play to learn !
Dont drive faster than your guardian angel can fly ...
but keeping both feet on the ground wont get you anywhere :w00t:
- How to post Performance Problems
- How to post data/code to get the best help[/url]
- How to prevent a sore throat after hours of presenting ppt
press F1 for solution, press shift+F1 for urgent solution 😀
Need a bit of Powershell? How about this
Who am I ? Sometimes this is me but most of the time this is me
December 28, 2007 at 9:39 am
or restore it under a different name and different file names or paths
January 1, 2008 at 12:47 am
Hi,
If you are restoring using the EM, then you can enable the option "Force restore over existing database".
Also make sure that no spids are connected to the database
Regards
Kumar
Viewing 6 posts - 1 through 5 (of 5 total)
You must be logged in to reply to this topic. Login to reply