![]() |
|
|
|
By: Manvendra Singh | Read Comments (6) | Related Tips: More > Security |
Below are the steps you need to perform to grant SYSADMIN access to SQL Server in case you are completely locked out.
1 - First stop the SQL Server and SQL Serve Agent services in SQL Server Management Studio.
2 - Open a cmd prompt window (Start | Run | cmd and press the 'OK' button) and navigate to SQL Server's Binn directory as shown below.

3 - Once you are in SQL Server's Binn directory run the 'sqlservr -m' command to start SQL Server in single user mode as shown below.

Starting SQL Server could take a few seconds to complete. Once your SQL Server instance has been started in single user mode, the following lines will be shown at the end of cmd prompt session:
4 - Now open a separate command prompt window (Start | Run | cmd and press the 'OK' button) and connect to your SQL Server instance by using the sqlcmd utility. If you have a named instance then use the '-S' parameter with full instance name. The '-E' switch is used for a trusted connection. If you are a Windows local Administrator on the machine, you will be granted SQL Server SYSADMIN rights when you connect to SQL Server in single user mode. This is the key to the access in order for this process to work.

5 - Now you are connected to your SQL Server instance with SYSADMIN rights. At this point you can add the BUILTIN\Administrators group back to the instance, create a login with SQL Server SYSADMIN rights or you can add your DBA Windows domain group as a SQL Server SYSADMIN.

6 - Assign the SQL Server sysadmin role to your newly created login:

7 - Now start the SQL Server services in SQL Server Management Studio and connect to the instance using the newly created login.
8 - Here you can validate the SQL Server sysadmin access for your new login i.e. mssqltips.

| Thursday, April 26, 2012 - 6:26:13 AM - BalaKrishna K | Read The Tip |
|
Thanks a lot... I got this problem .. and tried with this solution... It's working fine. |
|
| Thursday, April 26, 2012 - 7:31:46 AM - Ashok | Read The Tip |
|
Good One..! Thanks .. |
|
| Thursday, April 26, 2012 - 8:32:13 AM - Mark Ma | Read The Tip |
|
Neat and clever. Cheers |
|
| Thursday, April 26, 2012 - 12:35:49 PM - Calin OPREA | Read The Tip |
|
You can also try this: http://sqlblog.com/blogs/argenis_fernandez/archive/2011/07/10/think-your-windows-administrators-don-t-have-access-to-sql-server-2008-by-default-think-again.aspx ; nixe post |
|
| Friday, April 27, 2012 - 7:50:13 AM - Shamas | Read The Tip |
|
This is very good post for DBA's. |
|
| Tuesday, January 22, 2013 - 3:09:30 PM - Adam | Read The Tip |
|
Brilliant! Thanks a lot!! :) |
|
|
privacy | disclaimer | copyright | advertise | about authors | contribute | feedback | giveaways | user groups Some names and products listed are the registered trademarks of their respective owners. Edgewood Solutions LLC | MSSharePointTips.com | MSSQLTips.com |