Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Repair-DbaDbOrphanUser Contained Database Message #5887

Closed
imyourdba opened this issue Jul 10, 2019 · 2 comments
Closed

Repair-DbaDbOrphanUser Contained Database Message #5887

imyourdba opened this issue Jul 10, 2019 · 2 comments
Assignees
Labels

Comments

@imyourdba
Copy link

Looks like we are getting a message that if a database is Contained then it can't have orphaned users. But if the user was mapped as a normal user to a login at the server level, then it can definitely be orphaned. Not all users in a Contained database have to be contained, it just gives them the option to be so.

WARNING: [10:24:16][Repair-DbaDbOrphanUser] Database '[blah]' is a contained database. Contained databases can't have orphaned users. Skipping validation.

To reproduce, create a login at the instance level using SSMS and go into User Mapping and add it as a user in a database. Then go delete the login at the instance level. You can see that the user still exists in the database and is now orphaned. If you then go recreate the login but don't map it to the user, then the user in the database is still orphaned. You can then run the cleanup to remap them.

My use case is that I was running the Copy-DbaLogin and then Copy-DbaDatabase and needed to cleanup any orphaned SQL Native logins that may now exist.

@sirsql
Copy link
Contributor

sirsql commented Aug 28, 2019

@ClaudioESSilva any concerns if I pick this up off your plate?

@ClaudioESSilva
Copy link
Collaborator

No @sirsql . Go ahead.
Thanks

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

4 participants