{"id":10683,"date":"2017-12-08T08:15:04","date_gmt":"2017-12-08T07:15:04","guid":{"rendered":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/"},"modified":"2017-12-08T08:15:04","modified_gmt":"2017-12-08T07:15:04","slug":"sql-server-tips-an-orphan-user-owns-a-database-role","status":"publish","type":"post","link":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/","title":{"rendered":"SQL Server Tips: an orphan user owns a database role"},"content":{"rendered":"<p>A few days ago, I conduct an audit to detect all orphan\u2019s windows accounts in a database and I was surprise to have an error during the drop user query.<\/p>\n<p>&nbsp;<\/p>\n<p>The first step is to find all orphan&#8217;s windows accounts in a database<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">USE [dbi_database]\n\nGO\n\n\/*Step1: Search the orphan user *\/\n\nSELECT * FROM  sys.database_principals a\n\nLEFT OUTER JOIN sys.server_principals b ON a.sid = b.sid\n\nWHERE b.sid IS NULL\n\nAND   a.type In ('U', 'G')\n\nAND   a.principal_id &gt; 4<\/pre>\n<p>&nbsp;<\/p>\n<p>I find the user called \u201cdbi\\orphan_user\u201d and run the query to drop it<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\/*Drop Orphran User*\/\n\nDROP USER [dbi\\orphan_user]\n\nGO<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user01.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-19942 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user01.jpg\" alt=\"orphan_user01\" width=\"300\" height=\"225\" \/><\/a><\/p>\n<p>But as you can see, I receive the error message:<\/p>\n<p><em><span style=\"color: red\">Msg 15421, Level 16, State 1, Line4<\/span><\/em><\/p>\n<p><em><span style=\"color: red\">&#8220;The database principal owns a database role and cannot be dropped.&#8221;<\/span><\/em><\/p>\n<p>&nbsp;<\/p>\n<p>This user is owner of database roles&#8230;<\/p>\n<p>Be careful it is not this error message:<\/p>\n<p><em><span style=\"color: red\">Msg 15138, Level 16, State 1, Line 4<\/span><\/em><\/p>\n<p><em><span style=\"color: red\">The database principal owns a schema in the database, and cannot be dropped.<\/span><\/em><\/p>\n<p>In this case, the user is owner on schema.<\/p>\n<p>Do not confuse these two error messages:<\/p>\n<ul>\n<li><strong>Msg 15421 is for database role<\/strong><\/li>\n<li><strong>Msg 15138 is for schema<\/strong><\/li>\n<\/ul>\n<p>&nbsp;<\/p>\n<p>The goal is to search all database roles owns by the user dbi\\orphan_user<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\/*Search database role onws by this Orphran  user*\/\n\n  SELECT dp2.name, dp1.name FROM sys.database_principals AS dp1\n\n                JOIN sys.database_principals AS dp2\n\n                ON dp1.owning_principal_id = dp2.principal_id\n\n                WHERE dp1.type = 'R' AND dp2.name = 'dbi\\orphan_user';<\/pre>\n<p>As you can see in my select, I use two times the view sys.database_principals to do a cross check between the owning_principal_id and the principal_id.<\/p>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user02.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-19944 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user02.jpg\" alt=\"orphan_user02\" width=\"300\" height=\"262\" \/><\/a><\/p>\n<p>After that, I change the owner from this role to the good one (by default dbo).<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\/*Change the owner from these database role*\/\n\nALTER AUTHORIZATION ON ROLE::&lt;database role&gt; TO dbo;<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user03.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-19941 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user03.jpg\" alt=\"orphan_user03\" width=\"300\" height=\"232\" \/><\/a><\/p>\n<p>And I drop the orphan user without problems&#8230;<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">\/*Drop Orphran User*\/\n\nDROP USER [dbi\\orphan_user]\n\nGO<\/pre>\n<p><a href=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user04.jpg\"><img loading=\"lazy\" decoding=\"async\" class=\" size-medium wp-image-19940 aligncenter\" src=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user04.jpg\" alt=\"orphan_user04\" width=\"300\" height=\"220\" \/><\/a><\/p>\n<p>To finish, I give you a Santa Klaus Gift:<\/p>\n<p>I also rewrite the query to have the &#8220;Alter Authorization&#8221; query directly in the SELECT. You have just to copy\/paste and execute it<\/p>\n<pre class=\"brush: sql; gutter: true; first-line: 1\">SELECT dp2.name, dp1.name, 'ALTER AUTHORIZATION ON ROLE::' + dp1.name + ' TO dbo;' as query\n\nFROM sys.database_principals AS dp1\n\nJOIN sys.database_principals AS dp2\n\nON dp1.owning_principal_id = dp2.principal_id\n\nWHERE dp1.type = 'R' AND dp2.name = 'dbi\\orphan_user';<\/pre>\n<p>&nbsp;<\/p>\n<p>Et voila! \ud83d\ude0e<\/p>\n","protected":false},"excerpt":{"rendered":"<p>A few days ago, I conduct an audit to detect all orphan\u2019s windows accounts in a database and I was surprise to have an error during the drop user query. &nbsp; The first step is to find all orphan&#8217;s windows accounts in a database USE [dbi_database] GO \/*Step1: Search the orphan user *\/ SELECT *&hellip;&nbsp;<\/p>\n","protected":false},"author":15,"featured_media":10687,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"neve_meta_sidebar":"","neve_meta_container":"","neve_meta_enable_content_width":"","neve_meta_content_width":0,"neve_meta_title_alignment":"","neve_meta_author_avatar":"","neve_post_elements_order":"","neve_meta_disable_header":"","neve_meta_disable_footer":"","neve_meta_disable_title":"","neve_meta_reading_time":"","_themeisle_gutenberg_block_has_review":false,"footnotes":""},"categories":[4133,99],"tags":[49,44],"class_list":["post-10683","post","type-post","status-publish","format-standard","has-post-thumbnail","category-database","category-sql-server","tag-microsoft","tag-troubleshooting"],"yoast_head":"<!-- This site is optimized with the Yoast SEO Premium plugin v28.9 (Yoast SEO v28.9) - https:\/\/yoast.com\/product\/yoast-seo-premium-wordpress\/ -->\n<title>SQL Server Tips: an orphan user owns a database role - dbi services Blog<\/title>\n<meta name=\"robots\" content=\"index, follow, max-snippet:-1, max-image-preview:large, max-video-preview:-1\" \/>\n<link rel=\"canonical\" href=\"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/\" \/>\n<meta property=\"og:locale\" content=\"en_US\" \/>\n<meta property=\"og:type\" content=\"article\" \/>\n<meta property=\"og:title\" content=\"SQL Server Tips: an orphan user owns a database role\" \/>\n<meta property=\"og:description\" content=\"A few days ago, I conduct an audit to detect all orphan\u2019s windows accounts in a database and I was surprise to have an error during the drop user query. &nbsp; The first step is to find all orphan&#8217;s windows accounts in a database USE [dbi_database] GO \/*Step1: Search the orphan user *\/ SELECT *&hellip;&nbsp;\" \/>\n<meta property=\"og:url\" content=\"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/\" \/>\n<meta property=\"og:site_name\" content=\"dbi services Blog\" \/>\n<meta property=\"article:publisher\" content=\"https:\/\/www.facebook.com\/dbiservices\/\" \/>\n<meta property=\"article:published_time\" content=\"2017-12-08T07:15:04+00:00\" \/>\n<meta property=\"og:image\" content=\"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user04.jpg\" \/>\n\t<meta property=\"og:image:width\" content=\"510\" \/>\n\t<meta property=\"og:image:height\" content=\"374\" \/>\n\t<meta property=\"og:image:type\" content=\"image\/jpeg\" \/>\n<meta name=\"author\" content=\"St\u00e9phane Haby\" \/>\n<meta name=\"twitter:card\" content=\"summary_large_image\" \/>\n<meta name=\"twitter:creator\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:site\" content=\"@dbiservices\" \/>\n<meta name=\"twitter:label1\" content=\"Written by\" \/>\n\t<meta name=\"twitter:data1\" content=\"St\u00e9phane Haby\" \/>\n\t<meta name=\"twitter:label2\" content=\"Est. reading time\" \/>\n\t<meta name=\"twitter:data2\" content=\"2 minutes\" \/>\n<script type=\"application\/ld+json\" class=\"yoast-schema-graph\">{\"@context\":\"https:\\\/\\\/schema.org\",\"@graph\":[{\"@type\":\"Article\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/#article\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/\"},\"author\":{\"name\":\"St\u00e9phane Haby\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/7980252d7d7a521e285e7c66114cf82a\"},\"headline\":\"SQL Server Tips: an orphan user owns a database role\",\"datePublished\":\"2017-12-08T07:15:04+00:00\",\"mainEntityOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/\"},\"wordCount\":262,\"commentCount\":0,\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/orphan_user04.jpg\",\"keywords\":[\"Microsoft\",\"Troubleshooting\"],\"articleSection\":[\"Database\",\"SQL Server\"],\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"CommentAction\",\"name\":\"Comment\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/#respond\"]}]},{\"@type\":\"WebPage\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/\",\"name\":\"SQL Server Tips: an orphan user owns a database role - dbi services Blog\",\"isPartOf\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\"},\"primaryImageOfPage\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/#primaryimage\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/#primaryimage\"},\"thumbnailUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/orphan_user04.jpg\",\"datePublished\":\"2017-12-08T07:15:04+00:00\",\"breadcrumb\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/#breadcrumb\"},\"inLanguage\":\"en-US\",\"potentialAction\":[{\"@type\":\"ReadAction\",\"target\":[\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/\"]}]},{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/#primaryimage\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/orphan_user04.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/04\\\/orphan_user04.jpg\",\"width\":510,\"height\":374},{\"@type\":\"BreadcrumbList\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/sql-server-tips-an-orphan-user-owns-a-database-role\\\/#breadcrumb\",\"itemListElement\":[{\"@type\":\"ListItem\",\"position\":1,\"name\":\"Home\",\"item\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\"},{\"@type\":\"ListItem\",\"position\":2,\"name\":\"SQL Server Tips: an orphan user owns a database role\"}]},{\"@type\":\"WebSite\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#website\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/\",\"name\":\"dbi services Blog\",\"description\":\"#BeSharing\",\"publisher\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\"},\"potentialAction\":[{\"@type\":\"SearchAction\",\"target\":{\"@type\":\"EntryPoint\",\"urlTemplate\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/?s={search_term_string}\"},\"query-input\":{\"@type\":\"PropertyValueSpecification\",\"valueRequired\":true,\"valueName\":\"search_term_string\"}}],\"inLanguage\":\"en-US\"},{\"@type\":\"Organization\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/#organization\",\"name\":\"dbi services\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/\",\"logo\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2026\\\/09\\\/dbi-services-logo.png\",\"width\":512,\"height\":512,\"caption\":\"dbi services\"},\"image\":{\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/logo\\\/image\\\/\"},\"sameAs\":[\"https:\\\/\\\/www.facebook.com\\\/dbiservices\\\/\",\"https:\\\/\\\/x.com\\\/dbiservices\",\"https:\\\/\\\/www.linkedin.com\\\/company\\\/dbi-services\\\/\",\"https:\\\/\\\/www.youtube.com\\\/user\\\/dbiservices\"],\"description\":\"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.\",\"email\":\"info@dbi-services.com\",\"telephone\":\"+41 32 422 96 00\",\"legalName\":\"dbi services SA\"},{\"@type\":\"Person\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/#\\\/schema\\\/person\\\/7980252d7d7a521e285e7c66114cf82a\",\"name\":\"St\u00e9phane Haby\",\"image\":{\"@type\":\"ImageObject\",\"inLanguage\":\"en-US\",\"@id\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/STH_web-min-scaled.jpg\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/STH_web-min-scaled.jpg\",\"contentUrl\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/wp-content\\\/uploads\\\/2022\\\/08\\\/STH_web-min-scaled.jpg\",\"caption\":\"St\u00e9phane Haby\"},\"description\":\"St\u00e9phane Haby has more than 20 years of experience in Microsoft solutions, specializing in the installation, migration, best practices, and performance analysis of Microsoft SQL Server, as well as Microsoft Business Intelligence solutions (SharePoint, Office) and .NET development for the banking sector. A former Microsoft Most Valuable Professional (MVP) and early adopter of Microsoft Team System in France, he has authored several technical articles. He holds Microsoft Certified Solutions Associate (MCSA) and Expert (MCSE) for SQL Server, MCTS, MCITP for SQL Server 2008, and ITIL V3 Foundation certifications. His industry experience covers chemicals and pharma, banking, and financial services.\",\"url\":\"https:\\\/\\\/www.dbi-services.com\\\/blog\\\/author\\\/stephane-haby\\\/\"}]}<\/script>\n<!-- \/ Yoast SEO Premium plugin. -->","yoast_head_json":{"title":"SQL Server Tips: an orphan user owns a database role - dbi services Blog","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:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/","og_locale":"en_US","og_type":"article","og_title":"SQL Server Tips: an orphan user owns a database role","og_description":"A few days ago, I conduct an audit to detect all orphan\u2019s windows accounts in a database and I was surprise to have an error during the drop user query. &nbsp; The first step is to find all orphan&#8217;s windows accounts in a database USE [dbi_database] GO \/*Step1: Search the orphan user *\/ SELECT *&hellip;&nbsp;","og_url":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/","og_site_name":"dbi services Blog","article_publisher":"https:\/\/www.facebook.com\/dbiservices\/","article_published_time":"2017-12-08T07:15:04+00:00","og_image":[{"width":510,"height":374,"url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user04.jpg","type":"image\/jpeg"}],"author":"St\u00e9phane Haby","twitter_card":"summary_large_image","twitter_creator":"@dbiservices","twitter_site":"@dbiservices","twitter_misc":{"Written by":"St\u00e9phane Haby","Est. reading time":"2 minutes"},"schema":{"@context":"https:\/\/schema.org","@graph":[{"@type":"Article","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/#article","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/"},"author":{"name":"St\u00e9phane Haby","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/7980252d7d7a521e285e7c66114cf82a"},"headline":"SQL Server Tips: an orphan user owns a database role","datePublished":"2017-12-08T07:15:04+00:00","mainEntityOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/"},"wordCount":262,"commentCount":0,"publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user04.jpg","keywords":["Microsoft","Troubleshooting"],"articleSection":["Database","SQL Server"],"inLanguage":"en-US","potentialAction":[{"@type":"CommentAction","name":"Comment","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/#respond"]}]},{"@type":"WebPage","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/","url":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/","name":"SQL Server Tips: an orphan user owns a database role - dbi services Blog","isPartOf":{"@id":"https:\/\/www.dbi-services.com\/blog\/#website"},"primaryImageOfPage":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/#primaryimage"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/#primaryimage"},"thumbnailUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user04.jpg","datePublished":"2017-12-08T07:15:04+00:00","breadcrumb":{"@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/#breadcrumb"},"inLanguage":"en-US","potentialAction":[{"@type":"ReadAction","target":["https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/"]}]},{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/#primaryimage","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user04.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/04\/orphan_user04.jpg","width":510,"height":374},{"@type":"BreadcrumbList","@id":"https:\/\/www.dbi-services.com\/blog\/sql-server-tips-an-orphan-user-owns-a-database-role\/#breadcrumb","itemListElement":[{"@type":"ListItem","position":1,"name":"Home","item":"https:\/\/www.dbi-services.com\/blog\/"},{"@type":"ListItem","position":2,"name":"SQL Server Tips: an orphan user owns a database role"}]},{"@type":"WebSite","@id":"https:\/\/www.dbi-services.com\/blog\/#website","url":"https:\/\/www.dbi-services.com\/blog\/","name":"dbi services Blog","description":"#BeSharing","publisher":{"@id":"https:\/\/www.dbi-services.com\/#organization"},"potentialAction":[{"@type":"SearchAction","target":{"@type":"EntryPoint","urlTemplate":"https:\/\/www.dbi-services.com\/blog\/?s={search_term_string}"},"query-input":{"@type":"PropertyValueSpecification","valueRequired":true,"valueName":"search_term_string"}}],"inLanguage":"en-US"},{"@type":"Organization","@id":"https:\/\/www.dbi-services.com\/#organization","name":"dbi services","url":"https:\/\/www.dbi-services.com\/","logo":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2026\/09\/dbi-services-logo.png","width":512,"height":512,"caption":"dbi services"},"image":{"@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/logo\/image\/"},"sameAs":["https:\/\/www.facebook.com\/dbiservices\/","https:\/\/x.com\/dbiservices","https:\/\/www.linkedin.com\/company\/dbi-services\/","https:\/\/www.youtube.com\/user\/dbiservices"],"description":"Swiss IT consulting and services company specialized in efficient data infrastructures and platforms: databases, application servers, cloud, DevOps, digitalization, analytics, data quality and monitoring. Headquartered in Del\u00e9mont with offices in Nyon, Basel, Bern and Zurich.","email":"info@dbi-services.com","telephone":"+41 32 422 96 00","legalName":"dbi services SA"},{"@type":"Person","@id":"https:\/\/www.dbi-services.com\/blog\/#\/schema\/person\/7980252d7d7a521e285e7c66114cf82a","name":"St\u00e9phane Haby","image":{"@type":"ImageObject","inLanguage":"en-US","@id":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/STH_web-min-scaled.jpg","url":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/STH_web-min-scaled.jpg","contentUrl":"https:\/\/www.dbi-services.com\/blog\/wp-content\/uploads\/2022\/08\/STH_web-min-scaled.jpg","caption":"St\u00e9phane Haby"},"description":"St\u00e9phane Haby has more than 20 years of experience in Microsoft solutions, specializing in the installation, migration, best practices, and performance analysis of Microsoft SQL Server, as well as Microsoft Business Intelligence solutions (SharePoint, Office) and .NET development for the banking sector. A former Microsoft Most Valuable Professional (MVP) and early adopter of Microsoft Team System in France, he has authored several technical articles. He holds Microsoft Certified Solutions Associate (MCSA) and Expert (MCSE) for SQL Server, MCTS, MCITP for SQL Server 2008, and ITIL V3 Foundation certifications. His industry experience covers chemicals and pharma, banking, and financial services.","url":"https:\/\/www.dbi-services.com\/blog\/author\/stephane-haby\/"}]}},"_links":{"self":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/10683","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/users\/15"}],"replies":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/comments?post=10683"}],"version-history":[{"count":0,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/posts\/10683\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media\/10687"}],"wp:attachment":[{"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/media?parent=10683"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/categories?post=10683"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.dbi-services.com\/blog\/wp-json\/wp\/v2\/tags?post=10683"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}