sqlserver 数据库死锁后多长时间解锁?
各位大侠,sqlserver 数据库死锁后,会不会自动解锁呢?多长时间能自动解锁呢?谢谢!
SQL code:
use master
go
create procedure sp_who_lock
as
begin
declare @spid int,@bl int,
@intTransactionCountOnEntry int,
@intRowcount int,
@intCountProperties int,
@intCounter int
create table #tmp_lock_who (
id int identity(1,1),
spid smallint,
bl smallint)
IF @@ERROR<>0 RETURN @@ERROR
insert into #tmp_lock_who(spid,bl) select 0 ,blocked
from (select * from sysprocesses where blocked>0 ) a
where not exists(select * from
(select * from sysprocesses where blocked>0 ) b
where a.blocked=spid)
union select spid,blocked from sysprocesses where blocked>0
IF @@ERROR<>0 RETURN @@ERROR
-- 找到临时表的记录数
select @intCountProperties = Count(*),@intCounter = 1
from #tmp_lock_who
IF @@ERROR<>0 RETURN @@ERROR
if @intCountProperties=0
select '现在没有阻塞和死锁信息' as message
-- 循环开始
while @intCounter <= @intCountProperties
begin
-- 取第一条记录
select @spid = spid,@bl = bl
from #tmp_lock_who where Id = @intCounter
begin
if @spid =0
select '引起数据库死锁的是: '+ CAST(@bl AS VARCHAR(10))
+ '进程号,其执行的SQL语法如下'
else
select '进程号SPID:'+ CAST(@spid AS VARCHAR(10))+ '被'
+ '进程号SPID:'+ CAST(@bl AS VARCHAR(10)) +'阻塞,其当
前进程执行的SQL语法如下'DBCC INPUTBUFFER
自己试下
{{--
相关问答:
我的数据库是简体sqlserver2000 ,我想在繁体access下连接,通过odbc是可以了,但在access下出现打开的表全中"#已删除"
不知道要怎么操作才可以用ACCESS繁体连接简体sqlserver2000.谢谢!!!
大家都 ......
数据10W条以上,wm6.5平台,内存有限
C# code:
private void connserver()
{
Cursor.Current = Cursors.WaitCursor;
try
{
......
sqlserver存储过程改oracle
谁会啊。。。帮忙改改··
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_NULLS ON
GO
ALTER PROCEDURE tp_Fetch_List(
  ......
CREATE PROCEDURE [dbo].[getNews]
@News_subject nvarchar(1000) =null,
@News_content nvarchar(max) =null,
@type int,
@FileName varchar(255) =null,
@descriptions nvarchar(1000) =null,
@ ......
sqlserver 占用内存太高怎么解决?
sqlserver 2000 sp4,xp 系统,我自己的机子是开发机,占用内存太高了,机子反应慢,请问有没针对开发的配置,让sqlserver在后台跑起来的时候占用内存稍微小一点。如果有应 ......