Solved

How do I add a login to the "sysadmin" server role?

Posted on 2009-02-20
8
6,568 Views
Last Modified: 2012-05-06
I am having trouble with the following scenario:

Windows Server 2008 Enterprise Edition, SQL Server 2008 Enterprise Edition, and Team Foundation Server all running on one machine.

I am trying to create a maintenance plan to backup the TFS databases. In order to do that I have to be able to work in the SQL Management Studio with an account that is a member of the "sysadmin" server role.

The only member of the "sysadmin" server role is the "SA" account. The "SA" account password was left blank during install. When I try to add a new login (my domain admin account in this case) to the "sysadmin" server role I recieve the error message noted in "ERROR MESSAGE 1" below.

If I try to log into the SQL Management Studio with the SA account via the SQL Authentication mode I receive the error message noted in "ERROR MESSAGE 2" below.

My goal is to either:

(A) Add another login to the "sysadmin" role
or
(B) Login to the SQL Management Studio with the "SA" account

Please help! Thank you.
ERROR MESSAGE 1:
 

Add member failed for ServerRole 'sysadmin'. (Microsoft SqlServer.Smo).

|_  An Exception occurred while executing a Transact-SQL statement or batch.

    (Microsoft.SqlServer.ConnectionInfo)

    |_ User does not have permission to perform this action. (Microsoft SQL Server, Error: 15247)
 

ERROR MESSAGE 2:
 

Cannot connect to <INSTANCENAME>

|_ Login failed for user 'SA'. (Microsoft SQL Server, Error: 18456)

Open in new window

0
Comment
Question by:dfxdeimos
  • 4
  • 3
8 Comments
 
LVL 60

Assisted Solution

by:chapmandew
chapmandew earned 100 total points
ID: 23695069
you can do this:

execute sp_addsrvrolemember  @loginame=  'domain\loginname'
    , @rolename = 'sa'
0
 
LVL 35

Expert Comment

by:David Todd
ID: 23695127
Hi,

when trying to log in as SA, do you have authentication set to mixed? And I'd fix the blank password ASAP.

Cheers
  David
0
 
LVL 14

Author Comment

by:dfxdeimos
ID: 23695181
@ Chapmandew

How would I execute that command? You can't just type what you posted at the command line... Please provide the FULL command.

@ Dtodd

How would I confirm that? In the login window there is a dropdown next to "Authentication" that has "Windows Authentication" and "SQL Server Authentication" in it. I set it to "SQL Server Authentication" when trying to log into the SA account.
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 23695753
Well, that is the FULL command.  connect to the database in managemetn studio, open a new query window, paste that in there and run it.
0
Enterprise Mobility and BYOD For Dummies

Like “For Dummies” books, you can read this in whatever order you choose and learn about mobility and BYOD; and how to put a competitive mobile infrastructure in place. Developed for SMBs and large enterprises alike, you will find helpful use cases, planning, and implementation.

 
LVL 14

Author Comment

by:dfxdeimos
ID: 23695927
Ok, you didn't mention anything about a query window, so I had no idea.

"SA" doesn't work, I had to replace it with "sysadmin". Result is:

Msg 15247, Level 16, State 1, Procedure sp_addsrvrolemember, Line 29
User does not have permission to perform this action.
0
 
LVL 14

Author Comment

by:dfxdeimos
ID: 23695937
Perhaps you didn't read my question thouroughly. As I noted, the only "sysadmin" is the "SA" account, and I cannot log into the Management Studio with the SA account.
0
 
LVL 60

Expert Comment

by:chapmandew
ID: 23695945
lets try this.  do you know of anyone who is an admin on the machine that SQL is installed on?  likely, the local admins are also members of the sa group, and can add you as a sysadmin on the box using the commands I gave above.
0
 
LVL 14

Accepted Solution

by:
dfxdeimos earned 0 total points
ID: 23695995
No, the ONLY member of the "sysadmins" group is the "SA" account.

The "SA" account has it's login abilities disabled.

What it seems like I am going to have to do is to start cycle the service and put it in matainence mode and then use a local admin account to run a "sp_addsrvrolemember" command.
0

Featured Post

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

If you have heard of RFC822 date formats, they can be quite a challenge in SQL Server. RFC822 is an Internet standard format for email message headers, including all dates within those headers. The RFC822 protocols are available in detail at:   ht…
The Delta outage: 650 cancelled flights, more than 1200 delayed flights, thousands of frustrated customers, tens of millions of dollars in damages – plus untold reputational damage to one of the world’s most trusted airlines. All due to a catastroph…
This video shows, step by step, how to configure Oracle Heterogeneous Services via the Generic Gateway Agent in order to make a connection from an Oracle session and access a remote SQL Server database table.
This video shows how to set up a shell script to accept a positional parameter when called, pass that to a SQL script, accept the output from the statement back and then manipulate it in the Shell.

867 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

Need Help in Real-Time?

Connect with top rated Experts

20 Experts available now in Live!

Get 1:1 Help Now