Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 SQL Server 2005 Forums
 SQL Server Administration (2005)
 SQL Server 2005 sa account problem

Author  Topic 

walnutacres
Starting Member

7 Posts

Posted - 2010-07-29 : 12:12:53
How can we reset/unlock the sa account if that is the only sysadmin account? Can we restore from a backup?

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-29 : 13:05:08
If you restore it, you still won't know the password.

If you don't have any local admin Windows accounts that are sysadmins, then you are stuck reinstalling SQL Server.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

walnutacres
Starting Member

7 Posts

Posted - 2010-07-29 : 13:10:28
We know the password and it is the same on our secondary server. Can we restore just the account information or will we need to restore the whole database?
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-29 : 13:32:42
You'll need to restore the master database.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-07-29 : 13:43:43
you don't have a windows account that is admin?
Go to Top of Page

walnutacres
Starting Member

7 Posts

Posted - 2010-07-29 : 13:54:18
We do not use Windows Authentications for the database. I don't think our Windows admin accounts have the necessary privileges.
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-29 : 13:55:56
Will someone probably does. Check with whoever is a local admin on the server. By default, local admins have sysadmin inside SQL Server. So unless someone removed the sysadmin privilege from the BUILTIN\Administrators group, then you should be able to easily fix this.

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

walnutacres
Starting Member

7 Posts

Posted - 2010-07-29 : 14:00:53
We were forced to remove BUILTIN\Administrators by the DoD.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-07-29 : 14:04:59
DoD contractor lost the sa pwd? Oh the irony

no offense intended...just having a little fun with ya
Go to Top of Page

walnutacres
Starting Member

7 Posts

Posted - 2010-07-29 : 14:07:31
Didn't lose the password. DoD STIG security requirements forced the removal of the user/group.
Go to Top of Page

russell
Pyro-ma-ni-yak

5072 Posts

Posted - 2010-07-29 : 14:12:16
oh sa is locked out?
Go to Top of Page

walnutacres
Starting Member

7 Posts

Posted - 2010-07-29 : 14:17:02
Yes, sa is locked out. Unless someone knows a back way in, I'm afraid we are going to have to restore the master database from backup.
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2010-07-29 : 14:55:56
There are several ways to get into a SQL Server 2005 instance as long as you are a local Windows administrator.

You can gain access to SQL Server 2005 by adding your Windows login to one of the following local groups on the server , depending on if it is default or named instance (replace ComputerName and InstanceName with the actual names)
Default instance: SQLServerMSSQLUser$ComputerName$MSSQLSERVER
Named instance: SQLServerMSSQLUser$ComputerName$InstanceName

You can refer to the following article and the related discussion for other methods:
How to Connect to a SQL 2005 Server When You Are Completely Locked Out
http://www.sqlservercentral.com/articles/Administration/68271/




CODO ERGO SUM
Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-29 : 15:40:03
Wow, what's the point of locking it down if you can "break-in" like that?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2010-07-29 : 16:18:51
quote:
Originally posted by tkizer

Wow, what's the point of locking it down if you can "break-in" like that?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



There was a lively debate about that on the SSC article discussion, but in the end it just comes down to "that's the way Microsoft did it, so that’s the way it is". It does make it important to secure the Windows server.

I'm not giving away any secrets, since Microsoft was kind enough to document the procedure in the article in SQL Server 2005 Books online. The trick of adding your login to the SQLServerMSSQLUser$ComputerName$MSSQLSERVER group is something I came up with myself, but it seems to work, and you do not have to restart SQL Server in single user mode.

I have found it's a very convenient way to gain access when someone sets up a SQL Server and forgets to give me access.






CODO ERGO SUM
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2010-07-29 : 21:33:10
quote:
Originally posted by tkizer

Wow, what's the point of locking it down if you can "break-in" like that?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog



The point really is that someone has to actually add themselves to that group to gain access. Instead of the usual default of local administrators having access by default.

Go to Top of Page

tkizer
Almighty SQL Goddess

38200 Posts

Posted - 2010-07-29 : 22:56:48
I get it, I'm just so surprised by it. What's the point of removing sysadmin from BUILTIN\Administrators group if you can do that?

Tara Kizer
Microsoft MVP for Windows Server System - SQL Server
http://weblogs.sqlteam.com/tarad/

Subscribe to my blog
Go to Top of Page

jeffw8713
Aged Yak Warrior

819 Posts

Posted - 2010-07-30 : 18:46:00
Well, I have seen that a lot of people get local administrator access on servers. I've even seen where desktop support were added to servers as local administrators because they were included in one of the groups added to the server.

At least with this, they won't be automatically added by any AD GPO's and won't have access by default.

Of course, if you are really looking to lock down SQL Server - add the service account directly, disable those groups and you have the same thing.
Go to Top of Page

walnutacres
Starting Member

7 Posts

Posted - 2010-07-31 : 08:12:54
Thanks everyone for your help. I was able to unlock the sa account and enable it.
However, I still have a problem. My server is set to mixed authentication. I cannot log into the sa account but I can log into another SQL Server Authentication account (both via SQL Server Management). Any ideas on this?
Go to Top of Page

Michael Valentine Jones
Yak DBA Kernel (pronounced Colonel)

7020 Posts

Posted - 2010-07-31 : 15:12:15
quote:
Originally posted by walnutacres

Thanks everyone for your help. I was able to unlock the sa account and enable it.
However, I still have a problem. My server is set to mixed authentication. I cannot log into the sa account but I can log into another SQL Server Authentication account (both via SQL Server Management). Any ideas on this?



Either you don't know the correct SA password, or the SA login is locked out or disabled.





CODO ERGO SUM
Go to Top of Page
   

- Advertisement -