Msg 15138 The database principal owns a schema in the database, and cannot be dropped.

简介:

删除用户报错:

 

Msg 15138, Level16, State 1, Line 1

The database principal owns a schemain the database, and cannot be dropped.

 

解决办法(SSMS):

 

1.找到用户拥有的Schema

 

 

2.在Schema中找到db_owner将Schema Owner由test6改为dbo或者其他用户

 

 

3.删除用户test6

 

或者用下面的语句删除:

 

---查询用户test6拥有的Schemadb_owner

USE DBA;

SELECT s.name

FROM sys.schemas s

WHERE s.principal_id=USER_ID('test6');

 

--db_owner SchemaOwner改为dbo

ALTER AUTHORIZATIONONSCHEMA::db_ownerTO dbo;

 

---再次查询用户test6拥有的Schema为空

SELECT s.name

FROM sys.schemas s

WHERE s.principal_id=USER_ID('test6');

 

--删除用户test6

DROP USER [test6]

 


本文转自 lzf328 51CTO博客,原文链接:

http://blog.51cto.com/lzf328/1044837


相关文章
|
SQL 测试技术 数据库
Cannot execute as the database principal because the principal "guest" does not exist, this type of principal cannot be impersonated, or you do not ha
今天遇到这样一个问题:一个系统的作业需要给系统Support人员开放SQL Agent下作业的查看、执行权限。数据库版本为SQL Server 2014 SP2,给这个系统Support人员的NT账号授予msdb数据库下面权限后:     该系统Support人员反馈在双击查看该作业时报下面错误。
1210 0
|
SQL 数据库 Windows
Cannot execute as the database principal because the principal "guest" does not exist, this type of principal cannot be impersonated, or you do not ha
原文:Cannot execute as the database principal because the principal "guest" does not exist, this type of principal cannot be impersonated, or you do not have permission. 今天遇到这样一个问题:一个系统的作业需要给系统Support人员开放SQL Agent下作业的查看、执行权限。
1018 0
|
7月前
|
SQL Oracle 关系型数据库
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database
WARNING: Too Many Parse Errors With error=911 When Running a JDBC Application Connected to an Oracle 19c database (
97 2
|
7月前
|
Oracle 关系型数据库
19c 开启Oracle Database Vault
19c 开启Oracle Database Vault
170 1
|
7月前
|
SQL Oracle 关系型数据库
Connect to Autonomous Database Using Oracle Database Tools
Connect to Autonomous Database Using Oracle Database Tools
66 1
|
6月前
|
Oracle 关系型数据库 Linux
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
Requirements for Installing Oracle Database/Client 19c on OL8 or RHEL8 64-bit (x86-64) (Doc ID 2668780.1)
57 0
|
7月前
|
人工智能 Oracle 关系型数据库
一篇文章弄懂Oracle和PostgreSQL的Database Link
一篇文章弄懂Oracle和PostgreSQL的Database Link
|
7月前
|
SQL Oracle 安全
Oracle Database Vault Access Control Components
Oracle Database Vault Access Control Components
58 0
|
7月前
|
Oracle 安全 关系型数据库
What Is Oracle Database Vault?
The Oracle Database Vault security controls protect application data from unauthorized access, and helps you to comply with privacy and regulatory requirements. You can deploy controls to block privileged account access to application data and control sensitive operations inside the database using
43 0
|
7月前
|
Oracle 关系型数据库 Linux
服务器Centos7 静默安装Oracle Database 12.2
服务器Centos7 静默安装Oracle Database 12.2
293 0