Solved

How to map windows accounts ?

Posted on 2008-10-24
7
546 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
[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
  • 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

Three Reasons Why Backup is Strategic

Backup is strategic to your business because your data is strategic to your business. Without backup, your business will fail. This white paper explains why it is vital for you to design and immediately execute a backup strategy to protect 100 percent of your data.

Question has a verified solution.

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

Suggested Solutions

by Mark Wills PIVOT is a great facility and solves many an EAV (Entity - Attribute - Value) type transformation where we need the information held as data within a column to become columns in their own right. Now, in some cases that is relatively…
Introduction This article will provide a solution for an error that might occur installing a new SQL 2005 64-bit cluster. This article will assume that you are fully prepared to complete the installation and describes the error as it occurred durin…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

730 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