Solved

How to map windows accounts ?

Posted on 2008-10-24
7
538 Views
Last Modified: 2008-12-06
I want to transfer a database between server A and server B.

On server A I have some sql and windows accounts with user mappings to that database.

I may use the store procedure sp_change_users_login to map sql account but not to map windows accounts.

How map windows accounts ?
0
Comment
Question by:LuisGavinhos
  • 3
  • 2
7 Comments
 
LVL 4

Accepted Solution

by:
ThorSG1 earned 500 total points
ID: 22803826
All of these will work for both domain accounts or sql accounts.  For domain accounts use this format: Domain\username
If you end up with orphaned accounts from Server A  use this:
EXEC sp_revokedbaccess 'username'
This grants access to the database in question.
EXEC sp_grantdbaccess 'username', 'username'
This grants the priviledge level you want to use.

EXEC sp_addrolemember 'db_datareader', 'username'

You can check help for each of these to verify the formating.
0
 

Author Comment

by:LuisGavinhos
ID: 22819800

The sp  sp_change_users_login  at Windows 2005 no longer support mapping windows logins like XXX\XXX. You may read at book online at this sp : "sp_change_users_login cannot be used with windows logins"

I tried and receive the following error : "Terminating this procedure. The User name 'PDGRN\sqladmin' is absent or invalid.

Any idears ?
0
 
LVL 4

Expert Comment

by:ThorSG1
ID: 22822796
I'm not saying to use that stored procedure.
Microsoft suggests not using the sp_grantdbaccess as it will not be supported in future versions.  It will be replaced with the command create user.
So weather you use the sp_granddbaccess or create user those are what you need to use.  You are correct the stored procudure sp_change_users_login will not work for windows accounts.  Both will work with SQL 2005.
Once you use one of the above options I've suggested you can then run the stored procedure sp_addrolemember.  This will grant the user the permissions you want to give them.
Examples:
-- First example is a domain account.  Second example is a sql account.
exec sp_grantdbaccess 'microsoft\jimbob', 'microsoft\jimbob'
exec sp_grantdbaccess 'jimbob', 'jimbob'
--
exec sp_addrolemember 'db_dataowner', 'microsoft\jimbob'
exec sp_addrolemember 'db_datareader', microsoft\jimbob'
exec sp_addrolemember 'db_datareader', 'jimbob'
0
 
LVL 4

Expert Comment

by:ThorSG1
ID: 22907623
Have you had any luck with this issue?
0
 

Author Comment

by:LuisGavinhos
ID: 22916610
I created the accounts manualy and run sp_change_users_login.
Finaly I had no need to create windows accounts.

0

Featured Post

PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Sql Data via Excel--performance issues 2 56
sql help 5 54
SQL query with cast 38 53
Help Required 2 39
In this article I will describe the Backup & Restore method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
In this article I will describe the Copy Database Wizard method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

837 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