Click here to monitor SSC
SQLServerCentral is supported by Red Gate Software Ltd.
 
Log in  ::  Register  ::  Not logged in
 
 
 
        
Home       Members    Calendar    Who's On


Add to briefcase 12345»»»

How to Connect to a SQL 2005 Server When You Are Completely Locked Out Expand / Collapse
Author
Message
Posted Monday, November 2, 2009 8:29 PM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 11:08 AM
Points: 316, Visits: 1,117
Comments posted to this topic are about the item How to Connect to a SQL 2005 Server When You Are Completely Locked Out


Post #812701
Posted Monday, November 2, 2009 9:22 PM
Hall of Fame

Hall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of FameHall of Fame

Group: General Forum Members
Last Login: Friday, October 3, 2014 2:23 AM
Points: 3,108, Visits: 11,503
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 should not have to restart SQL Server to gain access this way.



Post #812710
Posted Tuesday, November 3, 2009 4:31 AM
Grasshopper

GrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopperGrasshopper

Group: General Forum Members
Last Login: Tuesday, July 29, 2014 9:08 AM
Points: 13, Visits: 285
this way is not good, because yoiu dont have the permission to connect just with sqlcmd -E, this way is not excat.
You must add your login to local group created by installation sql
Post #812857
Posted Tuesday, November 3, 2009 6:47 AM
Forum Newbie

Forum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum NewbieForum Newbie

Group: General Forum Members
Last Login: Tuesday, June 17, 2014 10:10 AM
Points: 8, Visits: 53
harriga.rabie-1008938 (11/3/2009)
this way is not good, because yoiu dont have the permission to connect just with sqlcmd -E, this way is not excat.
You must add your login to local group created by installation sql


That is correct.

Also, using sqlcmd -E uses the trusted account you are logged into as your sql login. Well, if you are completely locked out, how would this work? If you could get in this way and had permissions to create logins, why couldn't you just login to sql management studio and just change the sa password?
Post #812898
Posted Tuesday, November 3, 2009 7:50 AM
Old Hand

Old HandOld HandOld HandOld HandOld HandOld HandOld HandOld Hand

Group: General Forum Members
Last Login: Tuesday, October 7, 2014 11:08 AM
Points: 316, Visits: 1,117
Hello everyone and thank you for reading my article.

I would like to make two points on the comments I have seen here.

There are some questions about the "sqlcmd -E" command. Once you place the SQL server into single user mode (sqlservr.exe -m), this is the best and recommended way to connect to the SQL server in this mode. You could use an id/account to connect but if you have an id/account already then you would not be locked out.

Yes, by adding your own id/account to the SQL server, you should not get locked out. But this is not always the case. Here are some scenarios that could happen where you can not add your id/account and thus be locked out.

1) The application is very sensitive and you are not allowed by the business owner, auditors and/or government agencies to just add your id/account and are forced to use a supplied account for access.

2) The SQL server is inherited. When a company is bought out by another and people are let go, not everyone is nice enough to leave all the information.

3) Someone has deliberately deleted id/account from the SQL server. Possibly an unhappy employee/staff member or worse.

As you can see there are many reasons why you many not be able to connect to SQL server and if you ever run into this problem, I hope you will find this article helpful.

Thanks,

Rudy




Post #812933
Posted Tuesday, November 3, 2009 7:54 AM
SSC Veteran

SSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC VeteranSSC Veteran

Group: General Forum Members
Last Login: Thursday, October 2, 2014 7:22 AM
Points: 241, Visits: 189
The real way is to use the Dedicated Administrator Connection. You need to be on the physical box and member of sysadmin, and you can use either sqlcmd or Management Studio. This way you will not remove any information as to why you could not get in in the first place.

See this very short and precise way to do this:
http://msdn.microsoft.com/en-us/library/ms178068.aspx

Christian Mark Jensen
DBA



Post #812934
Posted Tuesday, November 3, 2009 7:55 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Wednesday, January 25, 2012 8:14 AM
Points: 567, Visits: 512
I still do not understand how you can use integrated security to connect to an instance that the user your logged into the machine with does not have permission to? I am confused here. does -e in single user mode bypass all security and let anyone log in? I would be very shocked at that.
Post #812935
Posted Tuesday, November 3, 2009 8:21 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, December 22, 2010 10:46 AM
Points: 88, Visits: 181
Per MSDN:

Under certain circumstances, you may have to start an instance of SQL Server in single-user mode by using the startup option -m. For example, you may want to change server configuration options or recover a damaged master database or other system database. Both actions require starting an instance of SQL Server in single-user mode.

Starting SQL Server in single-user mode enables any member of the computer's local Administrators group to connect to the instance of SQL Server as a member of the sysadmin fixed server role.

Thank you for the article OP. Very useful

Post #812959
Posted Tuesday, November 3, 2009 8:24 AM
SSC Journeyman

SSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC JourneymanSSC Journeyman

Group: General Forum Members
Last Login: Wednesday, December 22, 2010 10:46 AM
Points: 88, Visits: 181
chrismj (11/3/2009)
The real way is to use the Dedicated Administrator Connection. You need to be on the physical box and member of sysadmin, and you can use either sqlcmd or Management Studio. This way you will not remove any information as to why you could not get in in the first place.

See this very short and precise way to do this:
http://msdn.microsoft.com/en-us/library/ms178068.aspx

Christian Mark Jensen
DBA


The DAC, which has to be enabled as it is off by default, still requires sql server credentials. Starting the sql server service in single-user-mode only requires that you're an admin on the server, not the sql server. The article is about how to get yourself access when all other methods are lost.
Post #812962
Posted Tuesday, November 3, 2009 8:26 AM


Mr or Mrs. 500

Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500Mr or Mrs. 500

Group: General Forum Members
Last Login: Wednesday, January 25, 2012 8:14 AM
Points: 567, Visits: 512
From the article:

The builtin\administrators account has been removed for security reasons

??

Post #812965
« Prev Topic | Next Topic »

Add to briefcase 12345»»»

Permissions Expand / Collapse