SYSDBA无法删除Oracle 12.1.0.2中的用户

时间:2017-02-06 16:06:19

标签: database oracle permissions

Oracle新手。我在CentOS 6.8上成功安装了Oracle DB。我创建了两个数据库:

  1. ORCL
  2. AVDB
  3. AVDB'有一些用户。数据库。我希望将用户放入AVDB数据库。但即使我作为SYS AS SYSDBA用户连接,我的权限错误也不足。我甚至无法使用sys用户创建用户。

    但是,当我连接到不同用户的同一个数据库(我试图删除的那个是avuser)时,我能够创建用户。

    [oracle@via7was ~]$ sqlplus sys as sysdba
    
    SQL*Plus: Release 12.1.0.2.0 Production on Thu Feb 2 14:13:16 2017
    
    Copyright (c) 1982, 2014, Oracle.  All rights reserved.
    
    Enter password:
    
    Connected to:
    Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics,
    Oracle Database Vault and Real Application Testing options
    
    SQL> drop user avuser cascade;
    drop user avuser cascade
    *
    ERROR at line 1:
    ORA-01031: insufficient privileges
    
    SQL> create user test1 identified by secret;
    create user test1 identified by secret
                                    *
    ERROR at line 1:
    ORA-01031: insufficient privileges
    
    SQL> disconnect
    Disconnected from Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
    With the Partitioning, Oracle Label Security, OLAP, Advanced Analytics,
    Oracle Database Vault and Real Application Testing options
    SQL> conn avuser
    Enter password:
    Connected.
    SQL> create user test1 identified by secret;
    
    User created.
    

1 个答案:

答案 0 :(得分:1)

  

首先,确定保管库是否处于活动状态:

 SQL> SELECT PARAMETER, VALUE FROM V$OPTION WHERE PARAMETER = 'Oracle Database Vault';

        PARAMETER
        ----------------------------------------------------------------
        VALUE
        ----------------------------------------------------------------
        Oracle Database Vault
        TRUE
  

然后以数据库所有者身份连接并禁用保管库:

SQL> conn avuser
        Enter password:
        Connected.
        SQL> EXEC DVSYS.DBMS_MACADM.DISABLE_DV;

        PL/SQL procedure successfully completed.
  

以SYSDBA身份连接并重新启动数据库:

SQL> conn sys as sysdba
Enter password:
Connected.
SQL> SHUTDOWN IMMEDIATE
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
  

通过以SYSDBA:

连接来删除用户
SQL> conn sys as sysdba
    Enter password:
    Connected.
    SQL> drop user avuser cascade;
    drop user avuser cascade
    *
    ERROR at line 1:
    ORA-01940: cannot drop a user that is currently connected
  

如果您收到上述错误,请找出该用户的活动会话   被摔掉并杀死他们:

SQL> SELECT s.sid, s.serial#, s.status, p.spid FROM v$session s, v$process p WHERE s.username = 'AVUSER' AND p.addr(+) = s.paddr;

               SID    SERIAL# STATUS   SPID
        ---------- ---------- -------- ------------------------
                17      48252 INACTIVE 45579

        SQL> ALTER SYSTEM KILL SESSION '17,48252';

        System altered.

        SQL> drop user avuser cascade;

        User dropped.
  

注意:始终建议重新启用保险库以确保安全性   活动结束后的原因。