由于无法在数据库 'TestNonContainedDB' 上放置锁 ALTER DATABASE 失败
Error:
消息5601,级别16,状态1,第1行,由于无法在数据库 'TestNonContainedDB' 上放置锁,ALTER DATABASE 失败。请稍后再试。消息5069,级别16,状态1,第一行ALTER DATABASE 语句失败。
对应的英文信息是:Msg 5061, Level 16, State 1, Line 1 ALTER DATABASE failed because a lock could not be placed on database 'TestNonContainedDB'. Try again later. Msg 5069, Level 16, State 1, Line 1 ALTER DATABASE statement failed.
Solution:
declare @kill varchar(8000) = '';
select @kill=@kill+'kill '+convert(varchar(5),spid)+';'
from master..sysprocesses
where dbid=db_id('WSS_Content_81');
exec (@kill);