I just received an email from one of the readers asking for help with error he encountered while attempting to run DMV.
Msg 297, Level 16, State 1, Line 1
The user does not have permission to perform this action.
The above error is usually generated when the user who is trying to run the DMV does not have access to the run the DMV. I suggested him to contact his server admin to grant him VIEW SERVER STATE permissions so that he can run the DMV.
If user does not have VIEW SERVER STATE permissions when he runs any DMV, an error is generated.
When the following script is run by Admin (please note that the user cannot modify its own property in this case), it will give the necessary rights to the user.
GRANT VIEW SERVER STATE TO UserName
After the above script is run on the same DMV, it should not show any error.
Reference: Pinal Dave (https://blog.sqlauthority.com)