Oracle 中删除已经连接的用户

SQL> drop user dzjc cascade;
drop user dzjc cascade
*
第 1 行出现错误:
ORA-01940: 无法删除当前已连接的用户

SQL> desc v$session;
 名称                                      是否为空? 类型


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

 SADDR                                              RAW(4)
 SID                                                NUMBER
 SERIAL#                                            NUMBER
 AUDSID                                             NUMBER
 PADDR                                              RAW(4)
 USER#                                              NUMBER
 USERNAME                                           VARCHAR2(30)
 COMMAND                                            NUMBER
 OWNERID                                            NUMBER
 TADDR                                              VARCHAR2(8)
 LOCKWAIT                                           VARCHAR2(8)
 STATUS                                             VARCHAR2(8)
 SERVER                                             VARCHAR2(9)
 SCHEMA#                                            NUMBER
 SCHEMANAME                                         VARCHAR2(30)

SQL> select username,sid,serial# from v$session;

USERNAME                              SID    SERIAL#
------------------------------ ---------- ----------
SYS                                   143         59
                                      147          1
                                      148          1
                                      149          1
SYS                                   154         58
                                      155          3
                                      156          3
DZJC                                  158          7
                                      160          1
                                      161          1
                                      162          1

SQL> alter system kill session'158,7';

系统已更改。

SQL> drop user dzjc cascade;

用户已删除。

SQL>

你可能感兴趣的:(oracle)