Link to home
Start Free TrialLog in
Avatar of cawthron
cawthron

asked on

Unable to restore test database from production database using Enterprise Manager

We are running SQL Server 2000 with both a production and a test database. It is time to restore the test database using the production database backup file that is stored in the default C: folder. However when I try to do this through Enterprise Manager using the select database, right click and select restore, the error message displays "Exclusive access could not be obtained becasue the database is in use. RESTORE DATABASE is terminating abnormally." Have checked that no users are logged into the test database and don't know why or how to fix this problem.
Thanks.
Avatar of jdlambert1
jdlambert1
Flag of United States of America image

If you have the database selected in EM, that's a connection. Another one that catches me sometimes is a connection open from Query Analyzer. Also, if you're trying to restore over an existing database, you have to specify to overwrite/replace.
Avatar of cawthron
cawthron

ASKER

Thanks for the prompt response however nothing is running in Query Analyzer and have specified overwrite database. The EM connection shouldn't be an issue should it? otherwise the restore wouldn't be possible anyway?
SOLUTION
Avatar of jdlambert1
jdlambert1
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Have done as you suggested and still the same error message :(
SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
alter database test set single_user with rollback immediate
restore database test ....
Thank you for your help. Have split the points as each of these answers pointed in the right direction however using solution46's answer I was able to see what was causing the problem. It was a process that was not running but somehow holding a connection. Once that was stopped the restore worked beautifully. Thanks again.