Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

cannot execute the following sql query because of permission

Tags:

sql

sql-server

What level of rights would i need to execute the following query ?

SELECT S.*
FROM sys.dm_exec_requests R
INNER JOIN sys.dm_exec_sessions S
ON S.session_id = R.blocking_session_id

sys.dm_exec_sessions is a Dynamic Management view 

i am getting an error saying that it cant start debugger;

like image 230
Chani Avatar asked Jan 23 '26 03:01

Chani


2 Answers

According to this very helpful article:

These DM Views are secured, since they might show information you'd rather not have available to everyone.

Grant the VIEW SERVER STATE permission for server-level and VIEW DATABASE STATE permissions for database-level Dynamic Management Views and Functions. It's usually best to create a Role and then grant the permissions to that.

GRANT VIEW SERVER STATE TO <<login name>>
like image 129
DOK Avatar answered Jan 24 '26 18:01

DOK


VIEW SERVER STATE

As per the relevant MSDN pages for the Dynamic Management Views: One, Two

like image 31
gbn Avatar answered Jan 24 '26 18:01

gbn



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!