日期:2014-05-16  浏览次数:20473 次

删除ORACL连接用户

1.查询用户的连接状态
Select username,sid,serial# from v$session where username='XY1027';

USERNAME                              SID    SERIAL#
------------------------------ ---------- ----------
XY1027                                 22          1
XY1027                                142          1

 

2.逐个删除
Alter system kill session'22,1';

 

3.删除用户
drop user xy1027 cascade;

 

4.检查状态

如果在drop 后还提示ORA-01940:无法删除当前已链接的用户,说明还有连接的session,可以通过查看session的状态来确定该session是否被kill 了,

用如下语句查看:
-------------------------------------
select saddr,sid,serial#,paddr,username,status from v$session where username is not null

结果如下(以我的库为例):

 saddr                     sid           serial#            paddr              username              status

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

564A1E28              513           22974            569638F4        NETBNEW             ACTIVE
564A30DC  &nbs