{"id":2338,"date":"2014-04-11T11:00:07","date_gmt":"2014-04-11T15:00:07","guid":{"rendered":"http:\/\/sqlity.net\/en\/?p=2338"},"modified":"2015-01-02T12:01:19","modified_gmt":"2015-01-02T17:01:19","slug":"fix-orphaned-users","status":"publish","type":"post","link":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/","title":{"rendered":"How to Fix Orphaned Users in SQL Server"},"content":{"rendered":"<div>\n<h3>Introduction<\/h3>\n<p>\nSQL Server separates the concept of login and user. A login has the main purpose of allowing to connect to the SQL Server instance itself. However, by default a login cannot connect to any (non-system) database. Database access is controlled by users. A user is defined within the database. That allows easier management of database permissions and allows for those permissions to be included in a database backup. To allow a login access to a database, the login must be associated with a user in that same database.\n<\/p>\n<p>\nSometimes that login-user association breaks. That can for example happen, when a backup is restored on a different server. In this article, we are going to look at why that disassociation happens. We are also going to find out how to fix such an orphaned user.\n<\/p>\n<h3>Login User Association Example<\/h3>\n<p>\nTo start out we need a login and an associated user:\n<\/p>\n<div>\n[sql]\nCREATE LOGIN TestPrincipal WITH PASSWORD='********';<br \/>\nCREATE USER TestPrincipal FROM LOGIN TestPrincipal;<br \/>\n[\/sql]\n<\/div>\n<p>\nBy adding the <span class=\"tt\">FROM LOGIN<\/span> clause to the <span class=\"tt\">CREATE USER<\/span> statement, we specify that the new user should be linked to that particular login. While it is a good practice to name logins and their associated users identically, it is not a requirement. You can link a new user to any existing login by specifying that login in the <span class=\"tt\">FROM LOGIN<\/span> clause, even if it has a different name than the new user.\n<\/p>\n<p>\nTo show that the association worked, you can run the following code snippet:\n<\/p>\n<div>\n[sql]\nEXECUTE AS LOGIN='TestPrincipal';<br \/>\nGO<br \/>\nSELECT USER_NAME();<br \/>\nGO<br \/>\nREVERT;<br \/>\n[\/sql]\n<\/div>\n<p>\nIn here, <span class=\"tt\">EXECUTE AS<\/span> is used to switch the security context to the <span class=\"tt\">TestPrincipal<\/span> login. <span class=\"tt\">USER_NAME<\/span> on the other hand returns the name of the current user. When executing the above snippet, you will get this output:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_linked_user.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_linked_user.jpg\" alt=\"The login is linked to the used with the same name.\" width=\"753\" height=\"479\" class=\"aligncenter size-full wp-image-2342\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_linked_user.jpg 753w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_linked_user-300x190.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_linked_user-150x95.jpg 150w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/a>\n<\/p>\n<p>\nIt shows that the <span class=\"tt\">TestPricipal<\/span>login and the <span class=\"tt\">TestPrincipal<\/span> user are indeed currently associated.\n<\/p>\n<h3>Creating an Orphaned User<\/h3>\n<p>\nNow let us see what happens, when that association is broken. Instead of taking a backup and restoring it on a different server, we are going to just drop the login and recreate it. That has basically the same effect on the inner linkage structure.\n<\/p>\n<div>\n[sql]\nDROP LOGIN TestPrincipal<br \/>\nCREATE LOGIN TestPrincipal WITH PASSWORD='********';<br \/>\n[\/sql]\n<\/div>\n<p>\nWhen we now try to execute as that login, while still being connected to the database that we created the user in, we get an error right away:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_without_user.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_without_user.jpg\" alt=\"The login does not have an associated user.\" width=\"753\" height=\"479\" class=\"aligncenter size-full wp-image-2341\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_without_user.jpg 753w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_without_user-300x190.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_without_user-150x95.jpg 150w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/a>\n<\/p>\n<p>\nThe <span class=\"tt\">TestPrincipal<\/span> login does not have an associated user in the database anymore. As the <span class=\"tt\">TestPrincipal<\/span> user still exists, this proves that the linkage is not established by the name. It is instead established using the SID. SID stands for security identifier and it is a GUID. A login and a user are associated with each other if they have the same SID. A user the does not have an associated login anymore is called an orphaned user.\n<\/p>\n<p>\nSIDs are also used by Windows. Every Windows account has a unique SID. If you create a Windows login in SQL Server, it assigns the same SID to it that is used for that account in Windows already.\n<\/p>\n<h3>How to Fix Orphaned Users<\/h3>\n<p>\nSo, how can we see if a login and a user in SQL Server have the same SID? Both, the <a href=\"http:\/\/sqlity.net\/en\/1749\/sql-server-logins-server-principals\/\"><span class=\"tt\">sys.server_principals<\/span><\/a> and the <a href=\"http:\/\/sqlity.net\/en\/1755\/sql-server-database-users-sys-database_principals-catalog-view\/\"><span class=\"tt\">sys.database_principals<\/span><\/a> catalog views have an <span class=\"tt\">SID<\/span> column:\n<\/p>\n<div>\n[sql]\nSELECT 'Login' AS principal_type,SP.name,SP.sid<br \/>\n  FROM sys.server_principals AS SP<br \/>\n WHERE name = 'testPrincipal'<br \/>\nUNION ALL<br \/>\nSELECT 'User' AS principal_type,DP.name,DP.sid<br \/>\n  FROM sys.database_principals AS DP<br \/>\n WHERE name = 'testPrincipal';<br \/>\n[\/sql]\n<\/div>\n<p>\nWhen you execute that query, you will get the following output:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg\" alt=\"The SID of the login and the user do not match.\" width=\"753\" height=\"479\" class=\"aligncenter size-full wp-image-2340\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg 753w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid-300x190.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid-150x95.jpg 150w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/a>\n<\/p>\n<p>\nYou can clearly see that the two SIDs are not identical. To fix that and get the orphaned user to have the same SID as \"its\" login again, we just need to remind SQL Server that this was indeed our intend, by running the following <span class=\"tt\">ALTER USER<\/span> statement:\n<\/p>\n<div>\n[sql]\nALTER USER TestPrincipal WITH LOGIN = TestPrincipal;<br \/>\n[\/sql]\n<\/div>\n<p>\nAfter executing that statement, we can run above SID-comparing query again:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_matching_sid_again.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_matching_sid_again.jpg\" alt=\"The login and the user have a matching SID again.\" width=\"753\" height=\"479\" class=\"aligncenter size-full wp-image-2339\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_matching_sid_again.jpg 753w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_matching_sid_again-300x190.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_matching_sid_again-150x95.jpg 150w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/a>\n<\/p>\n<p>\nNote that the SID of the user changed. It is now the same as the login's SID again.\n<\/p>\n<p>\nJust to make sure that this did correctly associate the two principals with each other, let us run our first query again:\n<\/p>\n<p>\n<a href=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_are_linked_again.jpg\"><img loading=\"lazy\" decoding=\"async\" src=\"http:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_are_linked_again.jpg\" alt=\"The login and the user are linked again.\" width=\"753\" height=\"479\" class=\"aligncenter size-full wp-image-2343\" srcset=\"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_are_linked_again.jpg 753w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_are_linked_again-300x190.jpg 300w, https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_are_linked_again-150x95.jpg 150w\" sizes=\"auto, (max-width: 753px) 100vw, 753px\" \/><\/a>\n<\/p>\n<h3>Summary<\/h3>\n<p>\nSQL Server separates logins and database users. Logins control access to the instance itself. Users on the other hand control access to a single database. For a login to be able to access a database, it needs to have an associated user in that database. That association is implemented using the SID. When the SID on a login and a user match, SQL Server considers them linked. If that link should ever break, you can repair it with the <span class=\"tt\">ALTER USER<\/span> statement, specifying the <span class=\"tt\">WITH LOGIN<\/span> clause.\n<\/p>\n<\/div>\n","protected":false},"excerpt":{"rendered":"<p> To access a database in SQL Server, a login needs to have an associated user in that database. Read on to see how that association is implemented and what you need to do to repair it if it breaks.<\/p>\n<p> <a href=\"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/\">[more&#8230;]<\/a><\/p>\n","protected":false},"author":3,"featured_media":2340,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_jetpack_newsletter_access":"","_jetpack_dont_email_post_to_subs":false,"_jetpack_newsletter_tier_id":0,"_jetpack_memberships_contains_paywalled_content":false,"_jetpack_memberships_contains_paid_content":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","default_image_id":0,"font":"","enabled":false},"version":2},"jetpack_post_was_ever_published":false},"categories":[5,34],"tags":[163,162,38,58,56,15],"class_list":["post-2338","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-general","category-security","tag-associated-user","tag-database_principal","tag-security-2","tag-security-management","tag-server-principals","tag-sql-server"],"acf":[],"yoast_head":"<!-- This site is optimized with the Yoast SEO plugin v27.8 - https:\/\/yoast.com\/product\/yoast-seo-wordpress\/ -->\n<title>How to Fix Orphaned Users in SQL Server - sqlity.net<\/title>\n<meta name=\"description\" content=\"To access a DB, a login needs to have an associated DB user. Read on to see how that association is implemented and how you can repair it if it breaks.\" \/>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"How to Fix Orphaned Users in SQL Server - sqlity.net\" \/>\n<meta property=\"og:description\" content=\"To access a DB, a login needs to have an associated DB user. Read on to see how that association is implemented and how you can repair it if it breaks.\" \/>\n<meta property=\"og:url\" content=\"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/\" \/>\n<meta property=\"og:site_name\" content=\"sqlity.net\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/sqlity.net\" \/>\n<meta property=\"article:published_time\" content=\"2014-04-11T15:00:07+00:00\" \/>\n<meta property=\"article:modified_time\" content=\"2015-01-02T17:01:19+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"753\" \/>\n\t<meta property=\"og:image:height\" content=\"479\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"Sebastian Meine\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@sqlity\" \/>\n<meta name=\"twitter:site\" content=\"@sqlity\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"Sebastian Meine\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"4 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/\"},\"author\":{\"name\":\"Sebastian Meine\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"headline\":\"How to Fix Orphaned Users in SQL Server\",\"datePublished\":\"2014-04-11T15:00:07+00:00\",\"dateModified\":\"2015-01-02T17:01:19+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/\"},\"wordCount\":845,\"commentCount\":2,\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/login_and_user_have_mismatching_sid.jpg\",\"keywords\":[\"associated user\",\"database_principal\",\"security\",\"security management\",\"server principals\",\"SQL Server\"],\"articleSection\":[\"General\",\"Security\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/\",\"name\":\"How to Fix Orphaned Users in SQL Server - sqlity.net\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/login_and_user_have_mismatching_sid.jpg\",\"datePublished\":\"2014-04-11T15:00:07+00:00\",\"dateModified\":\"2015-01-02T17:01:19+00:00\",\"author\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\"},\"description\":\"To access a DB, a login needs to have an associated DB user. Read on to see how that association is implemented and how you can repair it if it breaks.\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/#primaryimage\",\"url\":\"https:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/login_and_user_have_mismatching_sid.jpg\",\"contentUrl\":\"https:\\\/\\\/sqlity.net\\\/wp-content\\\/uploads\\\/2014\\\/04\\\/login_and_user_have_mismatching_sid.jpg\",\"width\":753,\"height\":479,\"caption\":\"The SID of the login and the user do not match.\"},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/2338\\\/fix-orphaned-users\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"How to Fix Orphaned Users in SQL Server\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#website\",\"url\":\"https:\\\/\\\/sqlity.net\\\/en\\\/\",\"name\":\"sqlity.net\",\"description\":\"Quality for SQL\",\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/sqlity.net\\\/en\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/sqlity.net\\\/en\\\/#\\\/schema\\\/person\\\/bcffd8c572bc2f1bd10fdba80135e53c\",\"name\":\"Sebastian Meine\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"url\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"contentUrl\":\"https:\\\/\\\/secure.gravatar.com\\\/avatar\\\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g\",\"caption\":\"Sebastian Meine\"},\"sameAs\":[\"http:\\\/\\\/sqlity.net\",\"https:\\\/\\\/x.com\\\/sqlity\"]}]}<\/script>\n<!-- \/ Yoast SEO plugin. -->","yoast_head_json":{"title":"How to Fix Orphaned Users in SQL Server - sqlity.net","description":"To access a DB, a login needs to have an associated DB user. Read on to see how that association is implemented and how you can repair it if it breaks.","robots":{"index":"index","follow":"follow","max-snippet":"max-snippet:-1","max-image-preview":"max-image-preview:large","max-video-preview":"max-video-preview:-1"},"canonical":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/","og_locale":"en_US","og_type":"article","og_title":"How to Fix Orphaned Users in SQL Server - sqlity.net","og_description":"To access a DB, a login needs to have an associated DB user. Read on to see how that association is implemented and how you can repair it if it breaks.","og_url":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/","og_site_name":"sqlity.net","article_publisher":"https:\/\/www.facebook.com\/sqlity.net","article_published_time":"2014-04-11T15:00:07+00:00","article_modified_time":"2015-01-02T17:01:19+00:00","og_image":[{"width":753,"height":479,"url":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg","type":"image\/jpeg"}],"author":"Sebastian Meine","twitter_card":"summary_large_image","twitter_creator":"@sqlity","twitter_site":"@sqlity","twitter_misc":{"Written by":"Sebastian Meine","Est. reading time":"4 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/#article","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/"},"author":{"name":"Sebastian Meine","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"headline":"How to Fix Orphaned Users in SQL Server","datePublished":"2014-04-11T15:00:07+00:00","dateModified":"2015-01-02T17:01:19+00:00","mainEntityOfPage":{"@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/"},"wordCount":845,"commentCount":2,"image":{"@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/#primaryimage"},"thumbnailUrl":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg","keywords":["associated user","database_principal","security","security management","server principals","SQL Server"],"articleSection":["General","Security"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/","url":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/","name":"How to Fix Orphaned Users in SQL Server - sqlity.net","isPartOf":{"@id":"https:\/\/sqlity.net\/en\/#website"},"primaryImageOfPage":{"@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/#primaryimage"},"image":{"@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/#primaryimage"},"thumbnailUrl":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg","datePublished":"2014-04-11T15:00:07+00:00","dateModified":"2015-01-02T17:01:19+00:00","author":{"@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c"},"description":"To access a DB, a login needs to have an associated DB user. Read on to see how that association is implemented and how you can repair it if it breaks.","breadcrumb":{"@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/#primaryimage","url":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg","contentUrl":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg","width":753,"height":479,"caption":"The SID of the login and the user do not match."},{"@type":"BreadcrumbList","@id":"https:\/\/sqlity.net\/en\/2338\/fix-orphaned-users\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/sqlity.net\/en\/"},{"@type":"ListItem","position":2,"name":"How to Fix Orphaned Users in SQL Server"}]},{"@type":"WebSite","@id":"https:\/\/sqlity.net\/en\/#website","url":"https:\/\/sqlity.net\/en\/","name":"sqlity.net","description":"Quality for SQL","potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/sqlity.net\/en\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Person","@id":"https:\/\/sqlity.net\/en\/#\/schema\/person\/bcffd8c572bc2f1bd10fdba80135e53c","name":"Sebastian Meine","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","url":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","contentUrl":"https:\/\/secure.gravatar.com\/avatar\/4ab0a6d02dd494849a584a2c3c8bc3bdcef1d0aa5f87e98bf905dbdb9ad2ce3a?s=96&d=mm&r=g","caption":"Sebastian Meine"},"sameAs":["http:\/\/sqlity.net","https:\/\/x.com\/sqlity"]}]}},"jetpack_publicize_connections":[],"jetpack_featured_media_url":"https:\/\/sqlity.net\/wp-content\/uploads\/2014\/04\/login_and_user_have_mismatching_sid.jpg","jetpack_sharing_enabled":true,"jetpack_shortlink":"https:\/\/wp.me\/p2wXuw-BI","jetpack-related-posts":[],"_links":{"self":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/2338","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/comments?post=2338"}],"version-history":[{"count":0,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/posts\/2338\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/media\/2340"}],"wp:attachment":[{"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/media?parent=2338"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/categories?post=2338"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/sqlity.net\/en\/wp-json\/wp\/v2\/tags?post=2338"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}