Solved

Unable to restore test database from production database using Enterprise Manager

Posted on 2004-09-23
8
615 Views
Last Modified: 2013-12-03
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
Comment
Question by:cawthron
8 Comments
 
LVL 15

Expert Comment

by:jdlambert1
Comment Utility
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
 

Author Comment

by:cawthron
Comment Utility
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
 
LVL 15

Assisted Solution

by:jdlambert1
jdlambert1 earned 80 total points
Comment Utility
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
 

Author Comment

by:cawthron
Comment Utility
Have done as you suggested and still the same error message :(
0
Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

 
LVL 12

Assisted Solution

by:ill
ill earned 80 total points
Comment Utility
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
 
LVL 9

Accepted Solution

by:
solution46 earned 90 total points
Comment Utility
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
 
LVL 5

Expert Comment

by:aryumin
Comment Utility
alter database test set single_user with rollback immediate
restore database test ....
0
 

Author Comment

by:cawthron
Comment Utility
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

How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

Join & Write a Comment

Performance is the key factor for any successful data integration project, knowing the type of transformation that you’re using is the first step on optimizing the SSIS flow performance, by utilizing the correct transformation or the design alternat…
Having an SQL database can be a big investment for a small company. Hardware, setup and of course, the price of software all add up to a big bill that some companies may not be able to absorb.  Luckily, there is a free version SQL Express, but does …
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Excel styles will make formatting consistent and let you apply and change formatting faster. In this tutorial, you'll learn how to use Excel's built-in styles, how to modify styles, and how to create your own. You'll also learn how to use your custo…

772 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

12 Experts available now in Live!

Get 1:1 Help Now