有用的帖子链接:
http://www.dotblogs.com.tw/ricochen/archive/2012/07/10/73316.aspx
http://technet.microsoft.com/en-us/library/ms175519(v=sql.105).aspx
有用的查询或指令:
1.被block的sql
2.查找当前客户端和执行sql?
3.脏读:
4.spid的信息查询
5.表锁信息
http://www.dotblogs.com.tw/ricochen/archive/2012/07/10/73316.aspx
http://technet.microsoft.com/en-us/library/ms175519(v=sql.105).aspx
有用的查询或指令:
1.被block的sql
SELECT SPID=p.spid,
DBName = convert(CHAR(20),d.name),
ProgramName = program_name,
LoginName = convert(CHAR(20),l.name),
HostName = convert(CHAR(20),hostname),
Status = p.status,
BlockedBy = p.blocked,
LoginTime = login_time,
QUERY = CAST(TEXT AS VARCHAR(MAX))
FROM MASTER.dbo.sysprocesses p
INNER JOIN MASTER.dbo.sysdatabases d
ON p.dbid = d.dbid
INNER JOIN MASTER.dbo.syslogins l
ON p.sid = l.sid
CROSS APPLY sys.dm_exec_sql_text(sql_handle)
WHERE p.blocked = 0
AND EXISTS (SELECT 1
FROM MASTER..sysprocesses p1
WHERE p1.blocked = p.spid)
2.查找当前客户端和执行sql?
sp_who2
3.脏读:
select *from Table_1(nolock)
4.spid的信息查询
DBCC INPUTBUFFER(62)
5.表锁信息
sp_lock
select * from sys.objects where object_id='802101898'