【问题标题】:Failed To Revoke Role From A User撤销用户角色失败
【发布时间】:2014-06-10 06:56:47
【问题描述】:

在 Oracle Sql Developer 中,我运行 GRANT MyRole TO MyUser; 命令将 MyRole 授予 MyUser,然后运行 ​​REVOKE MyRole FROM MyUser; 命令从 MyUser 撤消 MyRole,但出现错误:

Error starting at line 50 in command:
REVOKE MyRole FROM MyUser
Error report:
SQL Error: ORA-01932: ADMIN option not granted for role 'MyRole'
01932. 00000 -  "ADMIN option not granted for role '%s'"
*Cause:    The operation requires the admin option on the role.
*Action:   Obtain the grant option and re-try.

请告诉我应该怎么做才能从 MyUser 撤消 MyRole。

【问题讨论】:

  • 只有数据库所有者才能撤销角色。见这里:docs.oracle.com/javadb/10.6.1.0/ref/rrefsqljrevoke.html
  • @DavidBrabant - 不正确。这只是拥有适当级别的特权的问题。请重新阅读您链接的文档。或者甚至更好地阅读 SQL 参考而不是 Java 文档(见我的回答)

标签: sql oracle privileges


【解决方案1】:

documentation 和错误信息一样清晰:

“要撤消角色,您必须已被授予具有 ADMIN OPTION 的角色。”

这意味着您的用户必须被授予这样的角色:

grant myrole to you WITH ADMIN OPTION ;

当然,您还需要它来授予角色...

SQL> conn db_admin/db_admin
Connected.
SQL> create role myrole;

Role created.

SQL> grant myrole to a; 

Grant succeeded.

SQL> conn a/a
Connected.
SQL> grant myrole to b;
grant myrole to b
*
ERROR at line 1:
ORA-01932: ADMIN option not granted for role 'MYROLE'

SQL> conn db_admin/db_admin
Connected.
SQL> grant myrole to a with admin option;

Grant succeeded.

SQL> conn a/a
Connected.
SQL> grant myrole to b;

Grant succeeded.

SQL> revoke myrole from b;

Revoke succeeded.

SQL> 

【讨论】:

  • 我应该怎么做才能从a 撤销myrole。当我使用a 用户登录并重新运行GRANT myrole TO a with admin option;(替换为我的真实角色和用户)时,发生了同样的错误。
  • 已解决。以 sys 身份登录并运行 REVOKE MyRole FROM MyUser;
猜你喜欢
  • 2018-06-25
  • 2021-07-10
  • 2018-09-29
  • 2020-08-08
  • 1970-01-01
  • 1970-01-01
  • 2016-10-14
  • 1970-01-01
  • 1970-01-01
相关资源
最近更新 更多