Sitecore : The database principal owns a schema in the database, and cannot be dropped message

While upgradation to Sitecore 10.2, I was to restore the database on the Managed Cloud Service Azure SQL Server.

I have connected the Azure SQL server on my local SSMS and started to import the Database using the option Import Data-tier Application.

While importing the database using the above option you need a BACPAC file instead of a .bak file.

So I was to create a BACPAC file of the database from my local. Go to the database, right-click and select the Export Data-tier Application option under the Task menu.

database-principal-sitecore-1

After clicking on the next, while creating the BACPAC file you may get the below error:

database-principal-sitecore-2

Solution: Go to the Users in that Database. Your Database => Security => Users

Find the user, right click and delete it.

If you are unable to delete the user and encountered a new error as below:

database-principal-sitecore-3

It means the user you are going to delete owns a schema in the database and owners.

First, you need to search which schemas own by the user. Go to your database -> Security -> Users

Check the properties of the user by right click on the user and going to the owned schema.

database-principal-sitecore-4

Now change the owner of the schema. Go to your database -> Security -> Schemas

Right-click select properties and search the schema owner. If you don’t know then change the schema owner to DBO.

database-principal-sitecore-5

After that delete, the user and start again to export the database as BACPAC

Happy Sitecoreing ðŸ˜Š

Comments

Popular posts from this blog

Sitecore Installation Error: Failed to Start Service 'Sitecore Marketing Automation Engine'

Import CSV Data in Sitecore Using PowerShell: Part-3