Solved

How to map windows accounts ?

Posted on 2008-10-24
7
503 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

What Should I Do With This Threat Intelligence?

Are you wondering if you actually need threat intelligence? The answer is yes. We explain the basics for creating useful threat intelligence.

Join & Write a Comment

Recently, when I was asked to create a new SQL 2005 cluster, Microsoft released a new service pack for MS SQL 2005 what is Service Pack 3. When I finished the installation of MS SQL 2005 I found myself troubled why the installation of SP3 failed …
In this article we will get to know that how can we recover deleted data if it happens accidently. We really can recover deleted rows if we know the time when data is deleted by using the transaction log.
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

706 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

19 Experts available now in Live!

Get 1:1 Help Now