I have to restore a DB. DB and website are hosted on the same machine. I have turned the site off from IIS but restore still won’t complete because it says the DB is in use. Do I have to stop all of the App Pools as well?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
You need to put the database in single user mode That will close any connections to that database. Then you can proceed with the restore.
In summary, using Sql Server Management Studio:
In Object Explorer, connect to an instance of the SQL Server
Database Engine, and then expand that instance.
Right-click the database to change, and then click Properties.
In the Database Properties dialog box, click the Options page.
From the Restrict Access option, select Single.
If other users are connected to the database, an Open Connections
message will appear. To change the property and close all other
connections, click Yes.
Also, using
exec sp_who2you can see what spids are connected to that DB.