SQL : Trouver les requêtes en cours d'exécution

Voici les deux requêtes que j'utilise lorsque je veux les requêtes en cours d'exécution sur les base de données de mon serveur SQL.

SELECT
cast(context_info as varchar(128)) AS context_info,
req.session_id AS sql_spid,
req.command,
sqltext.text,
req.status,
req.cpu_time,
req.reads,
req.writes,
req.logical_reads,
req.last_wait_type,
req.wait_time,
req.total_elapsed_time,
req.open_transaction_count,
d.name AS db_name
FROM sys.databases d, sys.dm_exec_requests req
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
WHERE d.database_id = req.database_id --AND name ='MicrosoftDynamicsAX_PROD'

SELECT cast(context_info as varchar(128)) AS context_info,
session_id,
login_time,
host_name,
client_version,
login_name,
nt_domain,
nt_user_name,
status,
cpu_time,
memory_usage,
total_scheduled_time,
total_elapsed_time,
reads,
writes,
logical_reads,
open_transaction_count
FROM sys.dm_exec_sessions
WHERE program_name like '%Dynamics%'



Previous
« Prev Post