Solved

Unable to restore test database from production database using Enterprise Manager

Posted on 2004-09-23
8
639 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
ID: 12139956
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
ID: 12140005
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
ID: 12140112
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
Windows Server 2016: All you need to know

Learn about Hyper-V features that increase functionality and usability of Microsoft Windows Server 2016. Also, throughout this eBook, you’ll find some basic PowerShell examples that will help you leverage the scripts in your environments!

 

Author Comment

by:cawthron
ID: 12140163
Have done as you suggested and still the same error message :(
0
 
LVL 12

Assisted Solution

by:ill
ill earned 80 total points
ID: 12140654
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
ID: 12141023
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
ID: 12142752
alter database test set single_user with rollback immediate
restore database test ....
0
 

Author Comment

by:cawthron
ID: 12148959
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

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Flattening heirachies 3 31
Increment column based of a FK 8 23
New to SSRS, extremely slow running report. 8 20
performance query 4 24
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 …
Why is this different from all of the other step by step guides?  Because I make a living as a DBA and not as a writer and I lived through this experience. Defining the name: When I talk to people they say different names on this subject stuff l…
Via a live example, show how to backup a database, simulate a failure backup the tail of the database transaction log and perform the restore.
Via a live example, show how to shrink a transaction log file down to a reasonable size.

823 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