Here are some simple queries that might be helpful for you.
To check number of open connection in SQL server:
- SELECT DB_NAME(dbid) AS DBName, COUNT(dbid) AS NumberOfConnections, loginame AS LoginName
- FROM sys.sysprocesses
- WHERE dbid > 0
- GROUP BY dbid, loginame;
To check the number of queries running currently on your server:
- SELECT sqltext.TEXT, req.session_id, req.STATUS, req.command, req.cpu_time, req.total_elapsed_time
- FROM sys.dm_exec_requests REQ
- CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext;
Find all dependencies of a table in Sql server
- SELECT referencing_schema_name, referencing_entity_name, referencing_id, referencing_class_desc
- FROM sys.dm_sql_referencing_entities('dbo.Clients', 'OBJECT');
Shows all the sessions that are currently established in Sql server.
- EXEC sp_who2
-
- //Or
-
- EXEC sp_who
Shows all ACTIVE sessions that are currently established in SQL server.
- EXEC sp_who 'Active'
-
- //Or
-
- EXEC sp_who2 'Active'