Posts

Showing posts from November, 2018

Drop User Error Msg 15138, Level 16, State 1, Line 5 The database principal owns a schema in the database, and cannot be dropped.

Image
Msg 15138, Level 16, State 1, Line 5 The database principal owns a schema in the database, and cannot be dropped. Things constantly change and one such thing is the addition and removal of users and servers.  In an attempt to remove a Machine account SQL Server login that was being replaced we know that removing a user from an Instance is not the same as removing them from a databases.  The Instance removal was simple however I came across this error message at the database level "The database principal owns a schema in the database, and cannot be dropped. (Msg 15138, Level 16, State 1, Line 5)".   Here are some steps to successfully review and drop the SQL Server user database logins: 1. What schema(s) does the user own? The following example finds the user and each schema owner. SELECT s . name , USER_NAME ( s . principal_id ) AS Schema_Owner FROM sys . schemas s -- WHERE s.principal_id = USER_ID('You user Name') ; B. Now re...

OS Patching.... SQL Server DOWN!!!!!!! Yes I still like software patching

Image
All software has bugs so patch your SQL Servers regularly and by that I mean every 1 or 3 or 6 or 12 or even 18 months.  Older versions of SQL like 2012 may not have frequent updates while current versions seem to have monthly updates. If you take 5 minutes to hop on over to any unofficial build chart list of the known Service Packs (SP) and (CUs) look through the hotfixes in each cumulative update starting with the newest and work your way down for the version of SQL server you are on.  Simply find something or a situation you may or may not have had but don't want to and you now have a reason to patch!  Today was a fun day in the aspect that OS patching of SQL servers caused multiple SQL FCI to go down at 8am so what happened. 1. We are running a two node SQL 2016 with Server 2016 running Storage Spaces Direct (S2D) each with it's own enclosure. 2. They all have a Cloud Witness. 3. They were all last patched in June with May updates and have been in a pat...