惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

A
Arctic Wolf
T
Tenable Blog
T
Troy Hunt's Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
P
Privacy & Cybersecurity Law Blog
NISL@THU
NISL@THU
Application and Cybersecurity Blog
Application and Cybersecurity Blog
H
Hacker News: Front Page
S
Secure Thoughts
AWS News Blog
AWS News Blog
L
LINUX DO - 最新话题
D
Darknet – Hacking Tools, Hacker News & Cyber Security
M
MIT News - Artificial intelligence
T
Tor Project blog
S
Schneier on Security
PCI Perspectives
PCI Perspectives
OSCHINA 社区最新新闻
OSCHINA 社区最新新闻
美团技术团队
Google DeepMind News
Google DeepMind News
V
Visual Studio Blog
爱范儿
爱范儿
Google DeepMind News
Google DeepMind News
Cyberwarzone
Cyberwarzone
T
The Exploit Database - CXSecurity.com
罗磊的独立博客
T
Threat Research - Cisco Blogs
Recent Commits to openclaw:main
Recent Commits to openclaw:main
V
V2EX
C
CXSECURITY Database RSS Feed - CXSecurity.com
Stack Overflow Blog
Stack Overflow Blog
freeCodeCamp Programming Tutorials: Python, JavaScript, Git & More
G
GRAHAM CLULEY
L
LINUX DO - 热门话题
D
Docker
J
Java Code Geeks
GbyAI
GbyAI
H
Heimdal Security Blog
The Hacker News
The Hacker News
MongoDB | Blog
MongoDB | Blog
V
Vulnerabilities – Threatpost
T
Tailwind CSS Blog
Cloudbric
Cloudbric
TaoSecurity Blog
TaoSecurity Blog
C
CERT Recently Published Vulnerability Notes
Y
Y Combinator Blog
Recorded Future
Recorded Future
Cisco Talos Blog
Cisco Talos Blog
T
Threatpost
The Register - Security
The Register - Security
Hacker News - Newest:
Hacker News - Newest: "LLM"

博客园 - 落木

PowerDesigner中NAME和COMMENT的互相转换,需要执行语句 获取网站根目录的urli源代码 - 落木 - 博客园 Control的Invoke和BeginInvoke 扩大范围的多条件查询 用.net的GetCallbackEventReference函数来实现dropDownList联动的ajax效果 调用DirectX进行简单的多媒体编程系列(四) 调用DirectX进行简单的多媒体编程系列(三) 调用DirectX进行简单的多媒体编程系列(二) 调用DirectX进行简单的多媒体编程系列(一) 数据库分页算法 mysql想说爱你不容易啊,从mssql迁移到mysql时,几乎所有的存储过程都得改,语法相差很大,累人!! 自己写的sqlserver和mysql的行转列通用存储过程 MSSQL优化文章 C#中编写sqlserver中自定义函数,实现复杂报表 Ajax使用Post方式提交到.aspx页面交互的例子 核单台帐表(存储过程) 清欠率(存储过程) ExtJS中的面向对象设计,组件化编程思想 - 落木 - 博客园 ExtJS中如何扩展自定义的类
处理SQLSERVER死锁(转载)
落木 · 2009-12-17 · via 博客园 - 落木

/*--处理死锁

 查看当前进程,或死锁进程,并能自动杀掉死进程

 因为是针对死的,所以如果有死锁进程,只能查看死锁进程
 当然,你可以通过参数控制,不管有没有死锁,都只查看死锁进程

--邹建 2004.4--

*//*--调用示例

 exec p_lockinfo
--

*/
create proc p_lockinfo
@kill_lock_spid bit=1,  --是否杀掉死锁的进程,1 杀掉, 0 仅显示
@show_spid_if_nolock bit=1 --如果没有死锁的进程,是否显示正常进程信息,1 显示,0 不显示
as
declare @count int,@s nvarchar(1000),@i int
select id=identity(int,1,1),标志,
 进程ID
=spid,线程ID=kpid,块进程ID=blocked,数据库ID=dbid,
 数据库名
=db_name(dbid),用户ID=uid,用户名=loginame,累计CPU时间=cpu,
 登陆时间
=login_time,打开事务数=open_tran, 进程状态=status,
 工作站名
=hostname,应用程序名=program_name,工作站进程ID=hostprocess,
 域名
=nt_domain,网卡地址=net_address
into #t from(
 
select 标志='死锁的进程',
  spid,kpid,a.blocked,dbid,uid,loginame,cpu,login_time,open_tran,
  status,hostname,program_name,hostprocess,nt_domain,net_address,
  s1
=a.spid,s2=0
 
from master..sysprocesses a join (
  
select blocked from master..sysprocesses group by blocked
  )b 
on a.spid=b.blocked where a.blocked=0
 
union all
 
select '|_牺牲品_>',
  spid,kpid,blocked,dbid,uid,loginame,cpu,login_time,open_tran,
  status,hostname,program_name,hostprocess,nt_domain,net_address,
  s1
=blocked,s2=1
 
from master..sysprocesses a where blocked<>0
)a 
order by s1,s2select @count=@@rowcount,@i=1if @count=0 and @show_spid_if_nolock=1
begin
 
insert #t
 
select 标志='正常的进程',
  spid,kpid,blocked,dbid,
db_name(dbid),uid,loginame,cpu,login_time,
  open_tran,status,hostname,program_name,hostprocess,nt_domain,net_address
 
from master..sysprocesses
 
set @count=@@rowcount
endif @count>0
begin
 
create table #t1(id int identity(1,1),a nvarchar(30),b Int,EventInfo nvarchar(255))
 
if @kill_lock_spid=1
 
begin
  
declare @spid varchar(10),@标志 varchar(10)
  
while @i<=@count
  
begin
   
select @spid=进程ID,@标志=标志 from #t where id=@i
   
insert #t1 exec('dbcc inputbuffer('+@spid+')')
   
if @标志='死锁的进程' exec('kill '+@spid)
   
set @i=@i+1
  
end
 
end
 
else
  
while @i<=@count
  
begin
   
select @s='dbcc inputbuffer('+cast(进程ID as varchar)+')' from #t where id=@i
   
insert #t1 exec(@s)
   
set @i=@i+1
  
end
 
select a.*,进程的SQL语句=b.EventInfo
 
from #t a join #t1 b on a.id=b.id
end
go