SQL SERVER – DMV Error: FIX: Error: Msg 297, Level 16 The user does not have permission to perform this action

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.

Fix/Solution/Workaround:

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.

Example:

If user does not have VIEW SERVER STATE permissions when he runs any DMV, an error is generated.

SQL SERVER - DMV Error: FIX: Error: Msg 297, Level 16 The user does not have permission to perform this action dmverror

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
GO

After the above script is run on the same DMV, it should not show any error.

SQL SERVER - DMV Error: FIX: Error: Msg 297, Level 16 The user does not have permission to perform this action dmverror1

Reference: Pinal Dave (https://blog.sqlauthority.com)

SQL DMV, SQL Scripts
Previous Post
SQL SERVER – Get Server Version and Additional Info
Next Post
SQL SERVER – SSMS Query Command(s) completed successfully without ANY Results

Related Posts

Leave a Reply