问题描述
在删除用户时,报错提示用户当前正在连接,且无法查到SID号。
SQL> drop user aaa10 cascade;
drop user aaa10 cascade
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
查询正在连接的Sid时,无显示结果:
SQL> select username,sid,serial# from v$session where username = ‘aaa10’;
no rows selected
解决方案:
1、当把用户名改为大写后,就可以正常查出Sid号:
SQL> SELECT SID,SERIAL# FROM V$SESSION WHERE USERNAME=‘AAA10’;
SID SERIAL#
1143 46057
2、kill进程
SQL> ALTER SYSTEM KILL SESSION ‘1143,46057’;
System altered.
3、用户删除成功
SQL> drop user aaa10 cascade;
原因分析:
在查询语句中,用户名最好用大写。