尝试删除数据库用户帐户架构时出错

发布于 2024-08-15 13:36:13 字数 1038 浏览 5 评论 0原文

我试图从数据库中删除用户的架构,但收到以下错误:

TITLE: Microsoft SQL Server Management Studio
------------------------------

Drop failed for Schema 'ext_owner'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.4035.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+Schema&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Cannot drop schema 'ext_owner' because it is being referenced by object 'getroles'. (Microsoft SQL Server, Error: 3729)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4035&EvtSrc=MSSQLServer&EvtID=3729&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

getroles 对象是什么?

如何删除引用以便删除旧用户帐户?

I'm trying to delete a user's schema from a database and I'm getting the following error:

TITLE: Microsoft SQL Server Management Studio
------------------------------

Drop failed for Schema 'ext_owner'.  (Microsoft.SqlServer.Smo)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=9.00.4035.00&EvtSrc=Microsoft.SqlServer.Management.Smo.ExceptionTemplates.FailedOperationExceptionText&EvtID=Drop+Schema&LinkId=20476

------------------------------
ADDITIONAL INFORMATION:

An exception occurred while executing a Transact-SQL statement or batch. (Microsoft.SqlServer.ConnectionInfo)

------------------------------

Cannot drop schema 'ext_owner' because it is being referenced by object 'getroles'. (Microsoft SQL Server, Error: 3729)

For help, click: http://go.microsoft.com/fwlink?ProdName=Microsoft+SQL+Server&ProdVer=09.00.4035&EvtSrc=MSSQLServer&EvtID=3729&LinkId=20476

------------------------------
BUTTONS:

OK
------------------------------

What is the getroles object?

How do I get rid of the reference so I can remove the old user account?

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(3

睫毛溺水了 2024-08-22 13:36:13
SELECT * FROM sys.objects 
WHERE name = 'getroles' 
AND schema_id = SCHEMA_ID('ext_owner');

然后执行:

DROP <object type> ext_owner.getroles;

--或者

ALTER SCHEMA <some other schema> TRANSFER ext_owner.getroles;

您可能需要重复此操作很多次。您无法删除不为空的架构。

SELECT * FROM sys.objects 
WHERE name = 'getroles' 
AND schema_id = SCHEMA_ID('ext_owner');

Then do:

DROP <object type> ext_owner.getroles;

--or

ALTER SCHEMA <some other schema> TRANSFER ext_owner.getroles;

You will likely have to repeat this a bunch of times. You can't drop a schema that is not empty.

遮云壑 2024-08-22 13:36:13

您可以查询系统表sys.objects 尝试查找有关 getrole 的更多信息。

尝试一下

SELECT * FROM sys.objects WHERE name LIKE '%getroles%'

,这应该会给您一些有关该对象是什么的信息。此时,您可以删除它或决定更改架构,以便不再引用它。

You can query the system table sys.objects to try to find more information on what getroles might be.

Try

SELECT * FROM sys.objects WHERE name LIKE '%getroles%'

This should give you some information on what the object is. At that point you can either drop it or decide to change the schema so that it's no longer being referenced.

深海夜未眠 2024-08-22 13:36:13

尝试使用:

SELECT * FROM sys.objects WHERE name = 'getroles'

我的猜测是,它是用户在自己的架构下创建的函数或存储过程(可能是无意的。删除它(如果未使用),您应该可以开始了。

Try using:

SELECT * FROM sys.objects WHERE name = 'getroles'

My guess is that it is a function or stored procedure which that user created under their own schema (possibly accidentally. Drop it (if it's not being used) and you should be good to go.

~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文