sqlserver 查看数据库连接情况
查看数据库链接情况,后边可接where条件~(备用)
select t2.name as 数据库名,t3.client_net_address as ip地址,
t1.host_name as 电脑名
from master.sys.dm_exec_sessions t1
inner join master.dbo.SYSDATABASES t2 on t1.database_id=t2.dbid
inner join master.sys.dm_exec_connections t3 on t1.session_id=t3.session_id
相关文章