SQL Server中删除用户时报错,提示:The database principal owns a schema in the database, and cannot be dropped(转载)
Description of the problem: When you tried to drop a user, you got this message:
Error: 15138 The database principal owns a schema in the database, and cannot be dropped.
Cause: That means, you are trying to drop a user owning a schema. In order to drop the user, you have to find the schema that’s assigned and then transfer the ownership to another user/role or to drop it.
Resolution:
You can fix the issue following two ways.
By script: You can find out which schema is owned by this user with the query below:
SELECT name FROM sys.schemas WHERE principal_id = USER_ID('myUser')
Then, use the names found from the above query below in place of the SchemaName below. And drop your user.
ALTER AUTHORIZATION ON SCHEMA::SchemaName TO dbo
GO
DROP USER myUser
By Management Studio:
- Object Explorer >> Expand the [databasename] >> Security.
- Click on Schemas.
- In summary window, determine which Schema(s) are owned by the user and either change the owner or remove the Scheme(s).
- If they are system schema(s), I suggest to change them to ‘dbo’.
- Drop your user.
More detail about schemas into the BOL:
SQL Server中删除用户时报错,提示:The database principal owns a schema in the database, and cannot be dropped(转载)的更多相关文章
- SQL Server中查询用户的对象权限和角色的方法
--SQL Server中查询用户的对象权限和角色的方法 -- 查询用户的object权限 exec sp_helprotect NULL, 'sa' -- 查询用户拥有的role exec sp_h ...
- SQL Server中授予用户查看对象定义的权限
SQL Server中授予用户查看对象定义的权限 在SQL Server中,有时候需要给一些登录名(用户)授予查看所有或部分对象(存储过程.函数.视图.表)的定义权限存.如果是部分存储过程.函数. ...
- 转 在SQL Server中创建用户角色及授权(使用SQL语句)
目录 要想成功访问 SQL Server 数据库中的数据 我们需要两个方面的授权 完整的代码示例 使用存储过程来完成用户创建 实例 要想成功访问 SQL Server 数据库中的数据, 我们需要两个 ...
- 在SQL Server中创建用户角色及授权
参考文献 http://database.51cto.com/art/201009/224075.htm 正文 要想成功访问 SQL Server 数据库中的数据, 我们需要两个方面的授权: 获得准许 ...
- 【转】在SQL Server中创建用户角色及授权(使用SQL语句)
1. 首先在 SQL Server 服务器级别,创建登陆帐户(create login) --创建登陆帐户(create login) create login dba with password=' ...
- 在SQL Server中创建用户角色及授权(使用SQL语句)
1. 首先在 SQL Server 服务器级别,创建登陆帐户(create login) --创建登陆帐户(create login) create login dba with password=' ...
- Linux 删除用户时报错:userdel: user zhoulijiang is currently used by process 1
一.发现问题: 有技术人员离职,需要删除系统帐号,但是进行删除操作的时候报:" userdel: user zhoulijiang is currently used by process ...
- 安装“Microsoft SQL Server 2014 Management Objects”时报错"Error Writing to file: Microsoft.SqlServer.XEvent.Linq.dll."
问题: 当安装的软件依赖Microsoft SQL Server 2014 Management Objects时,会把这个组件打进安装包里,但是在服务器上安装时却报如下错误: “Error Writ ...
- 在ERP中定义用户时报错:SqlDateTime 溢出。必须介于 1/1/1753 12:00:00 AM 和 12/31/9999 11:59:59 PM 之间
在ERP中定义用户时. 报错: SqlDateTime 溢出.必须介于 1/1/1753 12:00:00 AM 和 12/31/9999 11:59:59 PM 之间. 原因分析: ①没有正确初 ...
随机推荐
- 【机器学习】激活函数(ReLU, Swish, Maxout)
https://blog.csdn.net/ChenVast/article/details/81382939 神经网络中使用激活函数来加入非线性因素,提高模型的表达能力. ReLU(Rectifie ...
- C++知识回顾之__stdcall、__cdcel和__fastcall三者的区别
__stdcall.__cdecl和__fastcall是三种函数调用协议,函数调用协议会影响函数参数的入栈方式.栈内数据的清除方式.编译器函数名的修饰规则等. 调用协议常用场合 __stdcall: ...
- loadrunner 运行脚本-命令行运行脚本
Loadrunner 运行脚本-命令行运行脚本 by:授客 QQ:1033553122 脚本所在目录 Run-time Settings->Additional Attributes设置 ...
- Sublime Text3 安装 markdownediting插件 报错 Error loading syntax file "Packages/Markdown/Markdown.tmLanguage":
问题: Error loading syntax file "Packages/Markdown/Markdown.sublime-syntax": 解决方法: ./Data/Lo ...
- The packaging and installation process of Android programs
D:\android\adt-bundle-windows-x86-20131019\sdk\platform-tools工具的路径. 安卓工程经过eclipse编译然后通过aapt工具打包生成一个. ...
- 鸟哥的 Linux 私房菜Shell Scripts篇(三)
参考: http://linux.vbird.org/linux_basic/0340bashshell-scripts.php#script_be http://www.runoob.com/lin ...
- Oracle SQL: DDL DML DCL TCL
Data Definition Language 自带commit,与表结构有关(数据字典)(会等待对象锁) Data Manipulation Language (数据文件相关变化有关,会产生锁)不 ...
- 解决wordpress上传文件出现http错误问题
解决wordpress上传文件出现http错误问题 问题现象 今天上传约1.4m大小的gif文件到wordpress的媒体库时失败,提示http错误. 原因 由于之前一直上传图片都是可以的,所以推测最 ...
- OffsetDateTime工具类
java8时间API介绍及使用 java7及之前版本,推荐使用jodatimejava8提供的datetime api参考了jodatime 在新的时间API中, Instant表示一个精确的时间点, ...
- C++基础算法学习——汉洛塔问题
汉诺塔问题古代有一个梵塔,塔内有三个座A.B.C,A座上有64个盘子,盘子大小不等,大的在下,小的在上(如图).有一个和尚想把这64个盘子从A座移到C座,但每次只能允许移动一个盘子,并且在移动过程中, ...