The SELECT permissions was denied on the object 'dm_os_host_info', database 'mssqlsystemresource, system

Vijay Kumar 2,011 Reputation points

Hi Team,

Recently i am working on one test server, by mistakenly i revoked some permissions.

After that when i try to login i am getting error and i don't have any login account(Systadmin) to login to the server.

Please suggest me how to fix that.

I do have any account to login into the server to fix this issue by executing below command:

GRANT SELECT ON [sys].[dm_os_host_info] TO [public];

i tried with below command after putting SQL in single user mode but no use.

C:\Windows\system32>sqlcmd.exe -S MSSQLserver

Sqlcmd: Error: Microsoft ODBC Driver 13 for SQL Server : Login failed for user 'domain\userone'. Reason: Server is in single user mode. Only one administrator can connect at this time..

SQL Server
SQL Server
A family of Microsoft relational database management and analysis systems for e-commerce, line-of-business, and data warehousing solutions.
12,234 questions
0 comments No comments
{count} votes

2 answers

Sort by: Most helpful
  1. Erland Sommarskog 98,751 Reputation points

    When you have lost sysadmin addess, starting SQL Server in single-user mode is a good start. Next step would be to run something like


    But since SQL Server is in single-user you have to be careful so that no one else takes that single connection. Set SQL Server Agent to Manual start. Make sure you don't have any Windows open in SSMS. If there is an application server, stop it, etc.

  2. Seeya Xi-MSFT 16,411 Reputation points

    Hi @vijay kumar ,

    I have stopped SQL Agent.

    Please refer to this similar thread:

    1. Stop all SQL services
    2. Start with -m
    3. Run MSSQL Management Studio As administrator

    In addition, please read this blog:

    Best regards,


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".