Sql-server – BUILTIN\Administrators accidently removed

permissionssql serversql-server-2008-r2

Hi, so recently when trying to fix another bug within my sql server 2008 R2 db I removed the BUILTIN\Administrators login from sysadmin. Now it will not let me change anything winthin the database. Also I do not have the SA account password to log in as that user to change/ add any permission.

Can anyone help me add the BUILTIN\Administrators login back into sysadmin or find a way to alter the database using my windows account?

Best Answer

To assign sysadmin, you have to do it while logged in as a sysadmin. From here,

Requires membership in the role to which the new member is being added.

which is basic escalation prevention.

You'll need to do one of two things:

  1. Log in as a sysadmin (Windows account or otherwise), or have someone else do this if there are other sysadmin level logins on the server.

  2. Restart the instance in single-user mode (which allows local administrators to log in as sysadmin automatically), fix the login, then restart in multi-user mode.