Posts

Showing posts from September, 2018

SQL Server - Curious case of SQL orphaned users

Image
Hello everyone and welcome back to your friendly SQL blog. While working on a recent project, which was to get SQL login related information, I came across an interesting ambiguity regarding orphaned users in SQL Server that a database user could be orphaned and still may not come up in your orphaned users report. Sounds interesting, yes it is.  Remediation of this scenario unearthed a flaw/miss of our old and reliable inbuilt SQL Server stored procedure i.e. “sp_change_users_login” , which we generally use to verify broken or orphaned Database SQL users. Such interesting facts and useful piece of information are meant to be shared and hence came up this blog of today. Scenario: Now let me put more details regarding this particular scenario. Generally, a user is called orphaned when you’ve a database user present on the database that has no corresponding SQL login present on the server level. This relationship between a database user and SQL login is established using SIDs