--查询数据库的连接情况:(数据库SQL可直接执行) SELECT [dec].client_net_address, [des].[program_name], [des].[host_name], Count([dec].session_id) AS connection_count FROM sys.dm_exec_sessions AS [des] INNER JOIN sys.dm_exec_connections AS [dec] ON [des].session_id = [dec].session_id GROUP BY [dec].client_net_address, [des].[program_name], [des].[host_name] ORDER BY [des].[program_name], [dec].[client_net_address]
查询结果如下:
查看应用程序池占用数量
select * from sysprocesses where dbid= db_id('数据库名')