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.
After clicking on the next, while creating the BACPAC file you may get the below error:
TITLE: Microsoft SQL Server Management Studio | |
------------------------------ | |
One or more unsupported elements were found in the schema used as part of a data package. | |
Error SQL71564: Error validating element [mh-dbuserstg]: The element [mh-dbuserstg] has been orphaned from its login and cannot be deployed. | |
Error SQL71564: Error validating element [newrelic]: The element [newrelic] has been orphaned from its login and cannot be deployed. | |
Error SQL71627: The element User: [MNC-GEN3\_DBComm] has property AuthenticationType set to a value that is not supported in Microsoft Azure SQL Database v12. | |
Error SQL71627: The element User: [IIS APPPOOL\uat.millenniumhotels.com] has property AuthenticationType set to a value that is not supported in Microsoft Azure SQL Database v12. | |
Error SQL71627: The element User: [MNC-GEN3\Shannon.li] has property AuthenticationType set to a value that is not supported in Microsoft Azure SQL Database v12. | |
Error SQL71627: The element User: [MNC-GEN3\Xiaobin.xiao] has property AuthenticationType set to a value that is not supported in Microsoft Azure SQL Database v12. | |
Error SQL71627: The element User: [MNC-GEN3\Smart.huang] has property AuthenticationType set to a value that is not supported in Microsoft Azure SQL Database v12. | |
Error SQL71627: The element User: [MNC-GEN3\Sam.lee] has property AuthenticationType set to a value that is not supported in Microsoft Azure SQL Database v12. | |
(Microsoft.SqlServer.Dac) | |
------------------------------ | |
BUTTONS: | |
OK |
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:
TITLE: Microsoft SQL Server Management Studio | |
------------------------------ | |
Drop failed for User 'IIS APPPOOL\username.com'. (Microsoft.SqlServer.Smo) | |
For help, click: https://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=16.100.44091.28+(SMO-master-A)&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+User&LinkId=20476 | |
------------------------------ | |
ADDITIONAL INFORMATION: | |
An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo) | |
------------------------------ | |
The database principal owns a schema in the database, and cannot be dropped. (Microsoft SQL Server, Error: 15138) | |
For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft%20SQL%20Server&ProdVer=15.00.2000&EvtSrc=MSSQLServer&EvtID=15138&LinkId=20476 | |
------------------------------ | |
BUTTONS: | |
OK |
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.
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.
After that delete, the user and start again to export the database as BACPAC
Happy Sitecoreing 😊
Comments
Post a Comment