How to Connect to a SQL 2005 Server When You Are Completely Locked Out

  • Hey,

    Is there any other way when dealing with SQL Server 2008; I tried the same trick on 2008 but it didn't work.

    So, will this trick only works for SQL 2005??

    [font="Comic Sans MS"]In 'Thoughts',

    Lonely Vampire.[/font]

    --In 'thoughts'...
    Lonely Rogue

  • Created a PowerShell Advanced Function to perform this as well you can find it here: http://www.sqlmashup.com/powershell-advanced-function-for-when-you-are

  • Hello and Happy New Year to everyone 🙂

    I have just tested this process on a SQL 2008 SP2 (x32 and x64) and it does work.

    You can also add a windows users instead of the builtin\administrators group and assign it sysadmin rights.

    I will be testing this soon on SQL 2008 R2 (x32 and x64) environment.

    Thanks,

    Rudy

    Rudy

  • It was a good article. I have not read all the comments but has anyone mentioned that you reference images, but I did not see them in the article?

    Shawn Melton
    Twitter: @wsmelton
    Blog: wsmelton.github.com
    Github: wsmelton

  • Thanks for the info and I'll see what has happened to the images.

    Rudy

    Rudy

  • When I try the sqlcmd -E i get an error saying sql is in single user mode and no one else can login.

  • Are you sure the server is in single user mode? What version of SQL server are you using?

    No sure why you cannot connect.

    Rudy

    Rudy

  • SQL Server is 2005. All SQL default services were shut down and then SQL restarted with -m. There are other SQL instances running on the server. The error states that since SQL is in single user mode, no other administrator can log on. I get this erro in the second command prompt window when the sqlcmd -E command.

  • i think this instance was installed as part of a vendor application. That could be why it is locked down.

  • Bill Stutters (3/11/2011)


    SQL Server is 2005. All SQL default services were shut down and then SQL restarted with -m. There are other SQL instances running on the server. The error states that since SQL is in single user mode, no other administrator can log on. I get this erro in the second command prompt window when the sqlcmd -E command.

    Looks like something or someone else is connected (maybe the application has a service running) and therefore is not letting you in.

    You should see if that's the case and try again.

    Rudy

    Rudy

  • Rudy,

    Thank you so much for posting this article.

    I found myself in this situation several times and this trick works well. However I find myself in a case where I cannot recover the SA password (or connect to the server in question)

    Scenario:

    MSSQL 2008 EE

    Server build by a DBA that left the company

    I don't have the SA password.

    There are no SYSADMIN than can be found.

    Server was build outside the domain, and the it joined the domain. (not sure if this is important)

    My windows ID is part of the Local Administrators Group

    When I start the server in single mode, and I try to log in, I get the error:

    Login Failed for user ". The user is not associated with a trusted SQL Server connection.

    Any suggestions?

    I've been in this situation for weeks and I've been just lucky that the server is running smoothly, but it's a matter of time before it breaks and I'll be in a pickle!

    Thank you

  • Great article - I've been locked out of servers by vendors who won't share the sa password and have had to go through hoops like this just so I could add a link to their server on the SQL server we use for monitoring all the SQL servers at our site.

  • I think you need to be part of the domain administrator's group. Check with your network team to see if they can add you until you have connected.

    Hope this helps,

    Rudy

    Rudy

  • Great article thanks for sharing!

    Some have mentioned that one must still have a local administrator account in order use this technique. Not entirely true because there are boot CD's available that have utilities to reset the local administrator account. So if anyone has physical access and the server can be booted by CD or USB the local administrator account can be reset and the technique from the article used to gain access to the SQL Server instance.

    It's tough to trump physical access but if enough security and encryption is in place it may be possible but this will result in the original problem. How to gain access if "completely" locked out?

  • Thanks Rudy,

    Once I found all the application services and shut them down I was able to add my group to SQl and then login.

    Bill

Viewing 15 posts - 61 through 75 (of 97 total)

You must be logged in to reply to this topic. Login to reply