?
Solved

How can a lost SA password be reset on SQL Server

Posted on 2014-12-17
7
Medium Priority
?
73 Views
Last Modified: 2015-03-03
I've been handed a SQL Server 2008 to maintain.  The previous admin has "lost" the SA password.  No other accounts on the database server have SA privilages.  I want to gain SA access to the database server.  I've read but never done the following:
1. Stop the sql server services.
2. Start the sql server instance in single-user mode:  SQLServr.exe -m
3. Connect to the instance:  SQLCMD -S <Server_Name\Instance_Name>
4.  Create a login: 1> CREATE LOGIN 'Login_Name>' with PASSWORD='<Password>'
                                 2> GO
5. Give the user SA rights:  SP_ADDSRVROLEMEMBER '<Login_Name>','SYSADMIN'
6. Stop the sql server services.
7.  Restart normally.

Is this the correct procedure?  Any suggestions?

There is one production database on this server.  The transaction log is about 36GM and the database is about 600MB.
I will tackle that once I gain SA rights.
0
Comment
Question by:Jack Seaman
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 75

Assisted Solution

by:Aneesh Retnakaran
Aneesh Retnakaran earned 1000 total points
ID: 40505815
That seems correct, you need to make sure that the you start the command prompt as administrator and run the statements 2 and 3.
0
 
LVL 51

Expert Comment

by:Vitor Montalvão
ID: 40506492
No, is not correct at all. if it was that easy what kind of security SQL Server is offering to us?
If you lost the SA password and no one more has SysAdmin permission on the instance you can try to connect with the SQL Server account (if it is a domain account) otherwise you can't do nothing but reinstall the SQL Server.
0
 
LVL 75

Expert Comment

by:Anthony Perkins
ID: 40575902
No, is not correct at all.
You may want to double check that.

Here is a good article on the subject:
Disaster Recovery: What to do when the SA account password is lost in SQL Server 2005
0
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 

Author Comment

by:Jack Seaman
ID: 40635769
I was able to stop the SQL Server and restart it in single user mode using: NET START MSSQL$<instancename> /m

I was able to use Sqlcmd -S <Server_Name\Instance_Name>

Then I tried this to create a user and assign sysadmin to it.
1>      CREATE LOGIN ‘Jack’ with PASSWORD= ‘*********’
2>      GO

1>      SP_ADDSRVROLEMEMBER ‘Jack’,’SYSADMIN’
2>      GO

But the user was not created.
How do I fix this one.
0
 
LVL 75

Accepted Solution

by:
Anthony Perkins earned 1000 total points
ID: 40636632
This
CREATE LOGIN ‘Jack’ with PASSWORD= ‘*********’

Would have caused the following error:
Msg 102, Level 15, State 1, Line 1
Incorrect syntax near 'Jack'.

The syntax to create a  Login (not a User) is as follows:
CREATE LOGIN Jack with PASSWORD= ‘YourPasswordGoesHere’
0
 

Author Comment

by:Jack Seaman
ID: 40641803
Thanks.  But now I cannot connect using Sqlcmd -S <Server_Name\Instance_Name>
I am at a loss to figure out why.
0
 

Author Comment

by:Jack Seaman
ID: 40641872
I was finally able to connect and create a user and give that user sysadmin rights.

Used this:
CREATE LOGIN [Jack2] WITH PASSWORD=N'********', DEFAULT_DATABASE=[master], CHECK_EXPIRATION=OFF, CHECK_POLICY=OFF
GO
EXEC master..sp_addsrvrolemember @loginame = N'Jack2', @rolename = N'sysadmin'
GO
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Recently we ran in to an issue while running some SQL jobs where we were trying to process the cubes.  We got an error saying failure stating 'NT SERVICE\SQLSERVERAGENT does not have access to Analysis Services. So this is a way to automate that wit…
Familiarize people with the process of utilizing SQL Server functions from within Microsoft Access. Microsoft Access is a very powerful client/server development tool. One of the SQL Server objects that you can interact with from within Microsoft Ac…
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question