You administer a SQL Server 2014 instance.
Users report that the SQL Server has seemed slow today. A large database was being
restored for much of the day, which could be causing issues.
You want to write a query of the system views that will report the following:
• Number of users that have a connection to the server
• Whether a user’s connection is active
• Whether any connections are blocked
• What queries are being executed
• Whether the database restore is still executing and, if it is, what percentage of the
restore is complete.
Which system objects should you use in your query to best achieve this task?
A.
sys.dm_exec_requests, sys.dm_exec_sessions, sys.objects
B.
sys.dm_exec_sessions, sys.dm_exec_query_stats, sys.dm_exec_query_text,sys.objects
C.
sys.sysprocesses, sys.dm_exec_query_text, sys.objects
D.
sys.dm_exec_requests, sys.dm_exec_sessions, sys.dm_exec_query_text
D. sys.dm_exec_requests, sys.dm_exec_sessions, sys.dm_exect_query_text
no such DMV exists: sys.dm_exec_query_text.
CORRECT ANSWER:
sys.dm_exec_requests, sys.dm_exec_sessions, sys.dm_exec_sql_text
Don’t think I ever had an answer on MS exam that offered non-existing objects, never use that elimination process, it’s just an error while copying these questions.
Select
s.session_id, s.login_name, s.[status],
r.blocking_session_id, r.percent_complete, r.estimated_completion_time,
t.[text]
From sys.dm_exec_requests r
Join sys.dm_exec_sessions s On r.session_id = s.session_id
Cross Apply sys.dm_exec_sql_text (r.[sql_handle]) As t;