产品手册 实施方案 用户案例 问题中心

解除某一个数据库被应用程序占用的情况

分类:产品中心 实施方案 问题中心 366

—— 解除数据库占用
use master
go

declare @dbname sysname
set @dbname=’OIMobox’ –不能删除,或不能 还原的数据库

declare @s nvarchar(1000)
declare tb cursor local for
select s=’kill ‘+cast(spid as varchar)
from master..sysprocesses
where dbid=db_id(@dbname)

open tb
fetch next from tb into @s
while @@fetch_status=0
begin
exec(@s)
fetch next from tb into @s
end
close tb
deallocate tb

标签:手册方案 上一篇:
展开更多
预约软件体验

loading...