简体   繁体   English

SQL Server 2005数据库还原无法完成

[英]SQL Server 2005 db Restore cannot complete

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. 我已经从IIS关闭了该站点,但是还原仍然无法完成,因为它说数据库正在使用中。 Do I have to stop all of the App Pools as well? 我是否还必须停止所有应用程序池?

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: 总之,使用Sql Server Management Studio:

  1. In Object Explorer, connect to an instance of the SQL Server Database Engine, and then expand that instance. 在对象资源管理器中,连接到SQL Server数据库引擎的实例,然后展开该实例。

  2. Right-click the database to change, and then click Properties. 右键单击要更改的数据库,然后单击“属性”。

  3. In the Database Properties dialog box, click the Options page. 在“数据库属性”对话框中,单击“选项”页面。

  4. From the Restrict Access option, select Single. 从“限制访问”选项中,选择“单个”。

  5. 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_who2 you can see what spids are connected to that DB. 另外,使用exec sp_who2您可以查看哪些spid连接到该DB。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM