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 之间. 原因分析: ①没有正确初 ...
随机推荐
- 读懂SAP Leonardo物联网平台
读懂SAP Leonardo物联网平台 https://blog.csdn.net/weixin_42137700/article/details/81903290 本文比较系统.全面地介绍了SAP ...
- Salesforce小知识:累计汇总字段类型
累计汇总字段类型的定义 Salesforce中可以在两个对象之间建立关系.一个对象的某一条记录可以有若干条相关联的其他对象记录. 累计汇总字段可以将这些相关联的记录中的某些字段值汇总起来,显示给用户. ...
- python练习(-)
简单的爬虫示例: import urllib.request #python2.x版本为urllib2url = 'http://www.douban.com/'webPage=urllib.requ ...
- 跨站请求伪造(CSRF)
1. 什么是跨站请求伪造(CSRF) CSRF(Cross-site request forgery跨站请求伪造,也被称为“One Click Attack”或者session Riding,通常缩 ...
- Socks5 RFC1928协议中文版
除了这个意译版rfc1928外,其他人写的好像也有错误,都是一知半解. ☆ RFC 1928意译版(非直译版) http://www.ietf.org/rfc/rfc1928.txt http://w ...
- lvm管理卷之缩减卷大小
最近刚刚装好了一个系统,但是因为没有分好区,导致home分区过大,所以想把home分区的一大半移动到根分区里面. 1.先说一下我的环境. 安装的是centos6版本的系统,使用的默认文件系统是ext4 ...
- Python如何输出带颜色的文字方法
我们在使用python运维与开发的过程中,经常需要打印显示各种信息.海量的信息堆砌在控制台中,就会导致各种信息都显示在一起,降低了重要信息的可读性.这时候,如果能给重要的信息加上差异的字体颜色,那么就 ...
- Java设计模式之十三 ---- 观察者模式和空对象模式
前言 在上一篇中我们学习了行为型模式的备忘录模式(Memento Pattern)和状态模式(Memento Pattern).本篇则来学习下行为型模式的最后两个模式,观察者模式(Observer P ...
- [Eclipse+PyDev]ImportError: DLL load failed:找不到指定的模块 解决方案
1. 环境 Eclipse 4.4.2 Python 3.5 Window 8.1 2. 问题 在代码中import numpy时,提示 " ImportError: DLL load fa ...
- 记录线上一次线程hang住问题
线上发现执行某特定任务在某个特定时间点后不再work.该任务由线程池中线程执行定时周期性调度,根据日志查看无任何异常.从代码研判应该无关定时任务框架,因为对提交的定时任务做了wrap,会将异常都cat ...