Want to win a PS4? Go Premium and enter to win our High-Tech Treats giveaway. Enter to Win

x
?
Solved

Unable to restore test database from production database using Enterprise Manager

Posted on 2004-09-23
8
Medium Priority
?
675 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 320 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
NFR key for Veeam Backup for Microsoft Office 365

Veeam is happy to provide a free NFR license (for 1 year, up to 10 users). This license allows for the non‑production use of Veeam Backup for Microsoft Office 365 in your home lab without any feature limitations.

 

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 320 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 360 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

Free learning courses: Active Directory Deep Dive

Get a firm grasp on your IT environment when you learn Active Directory best practices with Veeam! Watch all, or choose any amount, of this three-part webinar series to improve your skills. From the basics to virtualization and backup, we got you covered.

Question has a verified solution.

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

I have a large data set and a SSIS package. How can I load this file in multi threading?
When trying to connect from SSMS v17.x to a SQL Server Integration Services 2016 instance or previous version, you get the error “Connecting to the Integration Services service on the computer failed with the following error: 'The specified service …
Via a live example, show how to extract insert data into a SQL Server database table using the Import/Export option and Bulk Insert.
Viewers will learn how to use the SELECT statement in SQL and will be exposed to the many uses the SELECT statement has.

618 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