Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Restore problem

Status
Not open for further replies.

cpitc

IS-IT--Management
Dec 20, 2009
77
GB
Hi

When I try and run a restore from our production to the test database I am getting this error message. Does anyone know what it is and how I can solve it. Thanks

ITLE: Microsoft SQL Server Management Studio
------------------------------

Restore failed for Server 'DB01'. (Microsoft.SqlServer.Smo)

For help, click:
------------------------------
ADDITIONAL INFORMATION:

System.Data.SqlClient.SqlError: Exclusive access could not be obtained because the database is in use. (Microsoft.SqlServer.Smo)

For help, click:
------------------------------
BUTTONS:

OK
------------------------------
 
How are you trying to do the restore? Did you create a backup first? Does the database already exist on the test server?

Normally the error about exclusive access means someone is connected to the database. One thing to check...are you connected to the database? You shouldn't be. Make sure you haven't selected the database, instead select Master and run the restore command from there.

Run master..sp_who2 and that will show you who is connected to which databases.

-SQLBill

The following is part of my signature block and is only intended to be informational.
Posting advice: FAQ481-4875
 
Hi

I found a solution on line. If you go into services and stop and restart the SQl services, this frees up whereever the lock or process was running. it then allowed me to restore the databse.

Thanks for your reply
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top