【问题标题】:ORA-01031: insufficient privileges in OracleORA-01031: Oracle 中的权限不足
【发布时间】:2021-03-24 11:20:58
【问题描述】:

我在 Windows 服务器中使用 Oracle,并且我已被授予 DBA 角色,现在我正在尝试使用以下方式解锁用户帐户:

ALTER USER user_account ACCOUNT UNLOCK;

我得到这个错误:

SQL Error: ORA-01031: insufficient privileges
01031. 00000 -  "insufficient privileges"
*Cause:    An attempt was made to change the current username or password
           without the appropriate privilege. This error also occurs if
           attempting to install a database without the necessary operating
           system privileges.
           When Trusted Oracle is configure in DBMS MAC, this error may occur
           if the user was granted the necessary privilege at a higher label
           than the current login.

我不知道为什么!知道 DBA 角色可以改变用户!

那么,是什么导致了这个错误?

【问题讨论】:

    标签: oracle oracle-sqldeveloper database-administration


    【解决方案1】:

    DBA - 默认情况下 - 有权更改其他用户。我怎么知道?

    SQL> select * from dba_sys_privs where grantee = 'DBA' order by privilege;
    
    GRANTEE                        PRIVILEGE                                ADM
    ------------------------------ ---------------------------------------- ---
    DBA                            ADMINISTER ANY SQL TUNING SET            YES
    DBA                            ADMINISTER DATABASE TRIGGER              YES
    DBA                            ADMINISTER RESOURCE MANAGER              YES
    <snip>
    DBA                            ALTER USER                               YES    --> this
    DBA                            ANALYZE ANY                              YES
    DBA                            ANALYZE ANY DICTIONARY                   YES
    <snip>
    

    因此,您的用户没有被授予DBA 角色,或者有人从中删除了ALTER USER。

    【讨论】:

    • 当我执行 select * from dba_role_privs where granted_role = 'DBA' 我的用户在输出中显示并授予 DBA
    • 我猜这个角色不是会话的默认角色
    • 我执行了SET ROLE ALL; 并设置了所有角色,但仍然出现相同的错误
    猜你喜欢
    • 1970-01-01
    • 2021-12-30
    • 2017-09-04
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2014-10-24
    • 2020-12-10
    • 2019-05-29
    相关资源
    最近更新 更多