1

Example,

I have a create a windows login DOMAIN\GROUP01, and mapped that login to a database DATABASE01 with lets say DB_OWNER permissions

I want to change the login name, I went into Active Directory, changed the name to DOMAIN\GROUP01_OLD, and ran the following query in SQL, on the master db :

alter login [DOMAIN\GROUP01] with name = [DOMAIN\GROUP01_OLD]

So far so good, the login is renamed. Now comes the actual problem. When I look into the security->users settings of DATABASE01, the login still has the old value; DOMAIN\GROUP01

How can I change this at one level, instead of doing it at multiple databases?

Reason I am asking this, i need to rename +/- 500 groups, I am doing this with scripts. This will take a hell of time if I need to change it manually for all databases at DOMAIN\GROUP01 level

PS: I am a SQL newbie, so please bear with me.

8
  • 2
    If you want the names to match then you are going to have to rename them at all levels. However, you say you are using scripts so it shouldn't be that much of an effort. Create a script that will take old name and new name and have it walk the databases issuing the rename command. Have that script read from a text file. You could even have the script do the AD renaming if you wanted. Feb 9, 2016 at 13:45
  • Well I actually have a script that renames the AD groups, but for some reason they dont seem to replicate the new names into SQL. Is this normal behavior, or am I missing something crucial?
    – doenoe
    Feb 9, 2016 at 13:46
  • That's normal behavior. SQL uses the Security Identifier to tie the objects together, the name isn't terribly important. It will get confusing later, though. Feb 9, 2016 at 13:48
  • That's a shame, would have made my day a lot easier if it would replicate. ;). I'll try to build some kind of script to rename the groups at all levels.
    – doenoe
    Feb 9, 2016 at 13:50
  • It's possible you just need to restart SQL Server to force it to pull from AD again. Some of this may just be caching. Feb 9, 2016 at 15:09

0

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Browse other questions tagged or ask your own question.