首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 数据库 > 其他数据库 >

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

2012-11-10 
Msg 15138 The database principal owns a schema in the database, and cannot be dropped.删除用户报错:

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

 

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

 

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

 

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

 

3.删除用户test6

 

或者用下面的语句删除:

 

---查询用户test6拥有的Schema为db_owner

USE DBA;

 SELECT s.name

 FROM sys.schemas s

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

 

--将db_owner Schema的Owner改为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]

 

 

 

热点排行