none
Cannot alter the role 'db_owner', because it does not exist or you do not have permission...[on the SPSubscriptionSettingsDatabase]

    Question

  • After upgrading a SharePoint 2013 On-Prem farm from June 2017 CU level to the January 2018 CU level, I encountered the following exception(s) on step 9 of 10 of the first run of the Configuration Wizard:

    Configuration Failed
    One or more configuration tasks failed. . .
    Failed to upgrade SharePoint Products.
    This is a critical task. You have to fix the failures before you can continue. Follow this link for more information about how to troubleshoot upgrade failures: ... An exception of type Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException was thrown.  Additional exception information:
    Error running SQL DDL Script:                 IF  EXISTS (SELECT TOP 1 1 FROM sys.database_principals WHERE name = N'db_owner' A.... System.Data.SqlClient.SqlException (0x80131904): Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.ClientConnectionId:7454882a-1aa0-43bc-bc05-84e79ec5d989Error Number:15151,State:1,Class:16        (EventID:al2pi)
    Upgrade [SPSubscriptionSettingsDatabase Name=SPI_Prod_SubscriptionSetting...] failed.        (EventID:ajxnm)
    Exception: Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.        (EventID:ajxnm)
    (EventID:ajxnm)
    Upgrade Timer job is exiting due to exception: System.Data.SqlClient.SqlException (0x80131904): Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.

    Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException: Exception of type 'Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException' was thrown.

       at Microsoft.SharePoint.PostSetupConfiguration.UpgradeTask.Run()

       at Microsoft.SharePoint.PostSetupConfiguration.TaskThread.ExecuteTask()

    Running [PSConfig.exe -cmd upgrade -inplace b2b -force -cmd applicationcontent -install -cmd installfeatures] failed with the same exception(s) at task 5 of 6:

    The farm is being upgraded in the timer service process. The task is 14.71% completed.
    Failed to upgrade SharePoint Products.
    An exception of type Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException was thrown.  Additional exception information: The upgrade command is invalid or a failure has been encountered.
    Error running SQL DDL Script: IF  EXISTS (SELECT TOP 1 1 FROM sys.database_principals WHERE name = N'db_owner' A.... System.Data.SqlClient.SqlException (0x80131904): Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.ClientConnectionId:5395f82b-1016-4eb6-a18c-a11e7958406cError Number:15151,State:1,Class:16 (EventID:al2pi)
    Upgrade [SPSubscriptionSettingsDatabase Name=SPI_Prod_SubscriptionSetting...] failed.   (EventID:ajxnm)
    Exception: Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.     (EventID:ajxnm)(EventID:ajxnm)
    Upgrade Timer job is exiting due to exception: System.Data.SqlClient.SqlException (0x80131904): Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner', because it does not exist or you do not have permission.Cannot alter the role 'db_owner',because it does not exist or you do not have permission.

    Research suggested a few possibilities.

    Some forum posts showed some people who encountered this type of error could get past it by opening SQL Management Studio, drilling down to the subscription settings service database > drilling into the security folder of that database > drilling further down to Users > finding and right-clicking the account that you're using to run the ConfigWiz in the list of users > Properties > Owned Schemas > select "db_owner" and click OK.  But that didn't help me. I did it several times and ran into the exact same exceptions every time I ran psconfigUI.exe or psconfig.exe. Also, the permissions I added were stripped away every time I ran configwiz.

    Two forum posts I found suggested this was related to SQL Always-On and/or Availability-Groups. I removed the subscription database from the AO AG and that didn't help either. Same exceptions. But I did not set it from full recovery mode to simple recovery mode like some suggested.  So maybe I didn't go far enough with this.

    Monday, May 7, 2018 3:40 PM

All replies

  • The way I got around this was to run the following command to manually upgrade the Subscription Settings database:

    (Get-SPDatabase | ?{$_.type -eq "Microsoft SharePoint Foundation Subscription Settings Database"}).Provision()

    After running this command, I did run into the exact same exceptions during the next psconfig/psconfigUI run, but it made it past the Subscriptions database and was failing on a different service application database.  I got past that one by running this:

    (Get-SPDatabase | ?{$_.type -eq "Microsoft.SharePoint.BusinessData.SharedService.BdcServiceDatabase"}).Provision()

    (Get-SPDatabase | ?{$_.type -eq "Microsoft.Office.Server.Administration.SocialDatabase"}).Provision()

    (Get-SPDatabase | ?{$_.type -eq "Microsoft.Office.Server.Administration.ProfileDatabase"}).Provision()

    Visiting Central Admin > Upgrade and Migration > Review database status (_admin/DatabaseStatus.aspx) helped me see the other service application databases that needed an upgrade and were causing these problems for me. Before running those provision commands the corresponding databases had a status of "Database is in compatibility range and upgrade is recommended." The configwiz could not upgrade them for some reason I don't understand. (The account I was using had the sysadmin role in SQL and had permissions everywhere.)  After running the provision commands, the status became "No action required."  After upgrading/provisioning those four service application databases, I was able to run the following upgrade command on all the servers in the farm without any failure or exception:

    psconfig.exe -cmd helpcollections -installall -cmd secureresources -cmd services -install -cmd installfeatures -cmd applicationcontent -install -cmd upgrade -inplace b2b -force –wait

    Any thoughts about how this problem could have happened?

    Monday, May 7, 2018 4:03 PM
  • Hi,

    I’m glad that you have found the resolution.

    The cause could be the upgrade was not performed on these databases. We need to manually upgrade the database to match the version of the rest of the farm.

    Thanks for sharing.

    Best regards,

    Linda Zhang


    Please remember to mark the replies as answers if they helped. If you have feedback for TechNet Subscriber Support, contact tnsf@microsoft.com.


    Click here to learn more. Visit the dedicated forum to share, explore and talk to experts about Microsoft Teams.

    Wednesday, May 9, 2018 2:35 AM
    Moderator
  • I saw the same type of errors when running the SP Configuration Wizard. But this time it was for other databases--like the subscription database:

    Failed to upgrade SharePoint Products.

    This is a critical task. You have to fix the failures before you can continue.

    An exception of type Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException was thrown.  Additional exception information: 
    Error running SQL DDL Script:                 IF  EXISTS (SELECT TOP 1 1 FROM sys.database_principals WHERE name = N'db_owner' A.... System.Data.SqlClient.SqlException (0x80131904): Cannot alter the role 'db_owner', because it does not exist or you do not have permission.ClientConnectionId:dde5f504-a948-47c9-85f8-cbcf39647a10Error Number:15151,State:1,Class:16  (EventID:al2pi)
    Upgrade [SPSubscriptionSettingsDatabase Name=..._SubscriptionSetting...] failed.       (EventID:ajxnm)
    Exception: Cannot alter the role 'db_owner', because it does not exist or you do not have permission. (EventID:ajxnm)
              (EventID:ajxnm)
    Upgrade Timer job is exiting due to exception: System.Data.SqlClient.SqlException (0x80131904): Cannot alter the role 'db_owner', because it does not exist or you do not have permission.

    I did two things.

    First I made sure that the Social, Profile, Sync, BDC Service, and Subscription databases were all removed in from the Always-On Availability-Group sync in SQL.  Even though this looks like a permissions issue, it is actually not one. Not in my case.  The account I was signed in as had the SysAdmin role in SQL.  My *guess* is that the AO-AG sync can somehow make the databases unavailable for this particular upgrade timer job.

    Second, I ran the following command to upgrade the Subscriptions database.

    (Get-SPDatabase | ?{$_.type -eq "Microsoft SharePoint Foundation Subscription Settings Database"}).Provision()

     

    One of those two actions worked for that database. But then I started getting the same exception (Microsoft.SharePoint.PostSetupConfiguration.PostSetupConfigurationTaskException and System.Data.SqlClient.SqlException with details "Cannot alter the role 'db_owner', because it does not exist or you do not have permission") in ConfigWiz for content databases! That was odd.  I had never seen that before.  I didn't want to remove any of them from the AO-AG sync so I created a simple script to upgrade those databases. And that worked!

    Example script:

    upgrade-spcontentdatase [NameOfContentDatabase1GoesHere] -Confirm:$False

    upgrade-spcontentdatase [NameOfContentDatabase2GoesHere] -Confirm:$False

    upgrade-spcontentdatase [NameOfContentDatabase3GoesHere] -Confirm:$False

    upgrade-spcontentdatase [NameOfContentDatabase4GoesHere] -Confirm:$False

    upgrade-spcontentdatase [NameOfContentDatabase5GoesHere] -Confirm:$False

    Thursday, May 23, 2019 3:06 PM