SQL> drop user lisi;
drop user lisi
ORA-01940: 无法删除当前连接的用户
SQL> select username,sid,serial# from v$session where username is not null;
USERNAME SID SERIAL#
------------------------------ ---------- ----------
AAA 12 28
AAA 13 186
AAA 21 204
AAA 24 45
AAA 143 206
LISI 145 487
6 rows selected
SQL> select username,sid,serial# from v$session where username='LISI';
USERNAME SID SERIAL#
------------------------------ ---------- ----------
LISI 145 487
SQL> alter system kill session '145,487';
System altered
SQL> drop user lisi cascade;
SQL>
User dropped
SQL> select username,sid,serial# from v$session where username='LISI';
USERNAME SID SERIAL#
------------------------------ ---------- ----------
LISI 145 487
SQL> select username,sid,serial# from v$session where username is not null;
USERNAME SID SERIAL#
------------------------------ ---------- ----------
AAA 12 28
AAA 21 204
AAA 24 45
AAA 143 206
LISI 145 487
SQL> alter system kill session'145,487';
System altered
SQL> drop user lisi cascade;
drop user lisi cascade
ORA-01918: 用户 'LISI' 不存在
SQL> select username,sid,serial# from v$session where username is not null;
USERNAME SID SERIAL#
------------------------------ ---------- ----------
AAA 12 28
AAA 21 204
AAA 24 45
AAA 143 206
LISI 145 487
SQL> select username,sid,serial# from v$session where username is not null;
USERNAME SID SERIAL#
------------------------------ ---------- ----------
AAA 12 28
AAA 21 204
AAA 24 45
AAA 143 206
LISI 145 487