删除Oracle数据库中的已连接用户 [英] Dropping connected users in Oracle database
本文介绍了删除Oracle数据库中的已连接用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我想使用sqlplus在Oracle DB中删除一些用户,但出现错误:
I want to drop some users in Oracle DB using sqlplus but I am getting error:
SQL> DROP USER test CASCADE;
DROP USER test CASCADE
*
ERROR at line 1:
ORA-01940: cannot drop a user that is currently connected
I followed the link in SO to find out the sessions - Dropping a connected user from an Oracle 10g database schema
但是当我运行命令时,我没有得到任何结果:
But when I ran the command I am not getting any results:
SQL> select sid,serial# from v$session where username = 'test';
no rows selected
在这种情况下,请帮助我如何删除用户.
Please help me how to drop users in this case.
推荐答案
用户都是v$session
中的大写字母(和数据字典视图).如果您与大写字母匹配,则应该找到要杀死的会话.
Users are all capitals in v$session
(and data dictionary views). If you match with capitals you should find your session to kill.
SELECT s.sid, s.serial#, s.status, p.spid
FROM v$session s, v$process p
WHERE s.username = 'TEST' --<<<--
AND p.addr(+) = s.paddr
/
传递用户TEST的实际SID和SERIAL#值,然后删除用户...:
Pass actual SID and SERIAL# values for user TEST then drop user...:
ALTER SYSTEM KILL SESSION '<SID>, <SERIAL>'
/
这篇关于删除Oracle数据库中的已连接用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文