sp_replflush
来源:这里教程网
时间:2026-03-02 11:06:20
作者:
EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 1
EXEC sp_repldone @xactid = NULL, @xact_segno = NULL, @numtrans = 0, @time = 0, @reset = 0
exec sp_replflush
with cte as (select replace(hostname,' ','') as hostname ,''''+replace(program_name,' ','')+'''' as program_name
, loginame, db_name(a.dbid) AS DBname,spid,blocked,waittime/1000 as waittime,a.status,a.lastwaittype,a.cmd
,Replace(substring(b.text,1,340),'''','''') as sqlmessage,cpu
from sys.sysprocesses as a with(nolock)
cross apply sys.dm_exec_sql_text(sql_handle) as b
where a.blocked>0 and sql_handle<>0x0000000000000000000000000000000000000000
and waittime>2000 )
select replace(hostname,' ','') as hostname ,''''+replace(program_name,' ','')+'''' as program_name
, loginame, db_name(a.dbid) AS DBname,spid,blocked,waittime/1000 as waittime,a.status,a.lastwaittype,a.cmd
,Replace(substring(b.text,1,340),'''','''') as sqlmessage,cpu
from sys.sysprocesses as a with(nolock)
cross apply sys.dm_exec_sql_text(sql_handle) as b
where exists(select blocked from cte where cte.blocked=a.spid)
and not exists (select spid from cte where cte.spid=a.spid)
union all
select * from cte
编辑推荐:
- sp_replflush03-02
- SQL实践一03-02
- 查看各个表所用空间大小03-02
- AGStatus SQL03-02
- sql server2012给我们挖的坑03-02
- MSSQL修改已有数据的表的自增列03-02
- 修改主机名后sqlserver配置修改03-02
- SQLServer执行存储过程失败(sys.xp_cmdshell)问题处理03-02
下一篇:
相关推荐
-
雷神推出 MIX PRO II 迷你主机:基于 Ultra 200H,玻璃上盖 + ARGB 灯效
2 月 9 日消息,雷神 (THUNDEROBOT) 现已宣布推出基于英
-
制造商 Musnap 推出彩色墨水屏电纸书 Ocean C:支持手写笔、第三方安卓应用
2 月 10 日消息,制造商 Musnap 现已在海外推出一款 Oce
热文推荐
- SQLServer执行存储过程失败(sys.xp_cmdshell)问题处理
- [SQL Server]镜像监视器的使用和配置
[SQL Server]镜像监视器的使用和配置
26-03-02 - 如何通过电脑BIOS 设置每天自动开机,通过操作系统设置定时关机
如何通过电脑BIOS 设置每天自动开机,通过操作系统设置定时关机
26-03-02 - sql server 体系结构
sql server 体系结构
26-03-02 - 深入理解 SQL Server 2008 的锁机制
深入理解 SQL Server 2008 的锁机制
26-03-02 - ISA、VESA、PCI、AGP、PCI-E显卡都什么样子的?
ISA、VESA、PCI、AGP、PCI-E显卡都什么样子的?
26-03-02 - 记一次sql server 数据库sa用户无法登录的故障处理
记一次sql server 数据库sa用户无法登录的故障处理
26-03-02 - 电脑新的驱动程序不一定适合你的应用程序
电脑新的驱动程序不一定适合你的应用程序
26-03-02 - sqlserver2008 收缩事务日志文件
sqlserver2008 收缩事务日志文件
26-03-02 - 日志收缩
日志收缩
26-03-02
