-2

I have a database low performance problem that occurs everyday at 2pm. I think the problem is caused by a process from an user application that is using the database.

Is there any script that shows who and what is running on the database?

Lachezar
  • 6,523
  • 3
  • 33
  • 34
fba_pereira
  • 196
  • 2
  • 12
  • This query show all users info, or just loged user's info? Do I need any special permission to use this script ? – fba_pereira Jul 21 '15 at 14:55

1 Answers1

1

i have one for you

SELECT sqltext.TEXT,
    req.session_id,
    req.status,
    req.command,
    req.cpu_time,
    req.total_elapsed_time,
    u.name as UserName,
    d.name as DatabaseName,
    Wait_type,
    Wait_time,
    Wait_resource,
    req.Blocking_session_id,Granted_query_memory
FROM sys.dm_exec_requests req
join sys.sysusers u on req.user_id=u.uid
join sys.databases d on d.database_id = req.database_id
CROSS APPLY sys.dm_exec_sql_text(sql_handle) AS sqltext
danvasiloiu
  • 751
  • 7
  • 24