ALTER DATABASE failed because a lock could not be placed on database

后端 未结 10 2264
感情败类
感情败类 2020-12-12 09:52

I need to restart a database because some processes are not working. My plan is to take it offline and back online again.

I am trying to do this in Sql Server Manage

10条回答
  •  既然无缘
    2020-12-12 10:19

    After you get the error, run

    EXEC sp_who2
    

    Look for the database in the list. It's possible that a connection was not terminated. If you find any connections to the database, run

    KILL 
    

    where is the SPID for the sessions that are connected to the database.

    Try your script after all connections to the database are removed.

    Unfortunately, I don't have a reason why you're seeing the problem, but here is a link that shows that the problem has occurred elsewhere.

    http://www.geakeit.co.uk/2010/12/11/sql-take-offline-fails-alter-database-failed-because-a-lock-could-not-error-5061/

提交回复
热议问题