• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 679
  • Last Modified:

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.
0
cawthron
Asked:
cawthron
3 Solutions
 
jdlambert1Commented:
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.
0
 
cawthronAuthor Commented:
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?
0
 
jdlambert1Commented:
Yes, EM can be an issue. Not that the name appears in the list of databases, but if it's the currently selected database. It doesn't need to be selected to do a restore. Click on any other database name to deselect your target database, then right-click on "Databases" to start the restore wizard.
0
Get your Conversational Ransomware Defense e‑book

This e-book gives you an insight into the ransomware threat and reviews the fundamentals of top-notch ransomware preparedness and recovery. To help you protect yourself and your organization. The initial infection may be inevitable, so the best protection is to be fully prepared.

 
cawthronAuthor Commented:
Have done as you suggested and still the same error message :(
0
 
illCommented:
conection could be made before and session is still active, so
1.kill all processes connected to you database from EM
2. or when restoring database switch to option panel and check "force restore over existing database" option.
0
 
solution46Commented:
open up QA and connect to the database.

run sp_who2

this will list all current connections to the server and should give you an indication of what is keeping it open.

use kill <process_number> to kill off any processes that shouldn't be running. When you have got rid of any unwanted connections, close QA down and try the restore.

s46.
0
 
aryuminCommented:
alter database test set single_user with rollback immediate
restore database test ....
0
 
cawthronAuthor Commented:
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.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now