SQLSERVER数据库常用查询

常用查询

Posted by Sunfy on 2022-06-09
Words 65 and Reading Time 1 Minutes
Viewed Times
Viewed Times
Visitors In Total

1. 死锁相关

1
2
3
4
5
6
7
8
9
10
--查询死锁
SELECT request_session_id spid,OBJECT_NAME(resource_associated_entity_id)tableName
FROM sys.dm_tran_locks
WHERE resource_type='OBJECT '

--杀死死锁
KILL 155

--显示死锁相关信息
exec sp_who2 137

2.并发线程

1
2
--查询正在使用的并发线程数
select * from sysprocesses where dbid= db_id('数据库名')

Copyright 2021 sunfy.top ALL Rights Reserved

...

...

00:00
00:00