Home > Database > Mysql Tutorial > sql insert into .. select..死锁解决办法

sql insert into .. select..死锁解决办法

WBOY
Release: 2016-06-07 17:47:37
Original
2870 people have browsed it

sql insert into .. select..死锁解决办法

sql insert into .. select..死锁解决办法

方法一

insert into a select * from b with(xlock) where form_no=@form_no

方法二,

sp_who --sql2000及以上
dbcc inputbuffer(spid)--用于查看具体的语句
kill spid --杀掉进程。
--还是
select * from sys.sysprocesses --sql2005及以上
a. 按平均 cpu 时间排在前五个的查询
此方案提供有关 cpu 时间、io 读写以及按平均 cpu 时间排在前五个查询的执行次数的信息。

 复制代码

select top 5
total_worker_time/execution_count as [avg cpu time],
(select substring(text,statement_start_offset/2,(case when statement_end_offset = -1 then len(convert(nvarchar(max), text)) * 2 else statement_end_offset end -statement_start_offset)/2) from sys.dm_exec_sql_text(sql_handle)) as query_text
from sys.dm_exec_query_stats


order by [avg cpu time] desc

Related labels:
source:php.cn
Statement of this Website
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn
Popular Tutorials
More>
Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template