oracle强制删除用户
DECLAREu_sid varchar2(50);u_serialnumber varchar2(50);u_name varchar2(50);CURSOR c1 IS select trim(s.sid),trim(s.serial#)from v$session ...
·
DECLARE
u_sid varchar2(50);
u_serialnumber varchar2(50);
u_name varchar2(50);
CURSOR c1 IS select trim(s.sid),trim(s.serial#)
from v$session s,v$process p
where s.paddr = p.addr and (s.username=u_name);
BEGIN
-- 替换用户名,必须大写
u_name:='CARMOT_DEMO2';
OPEN c1;
LOOP
FETCH c1 INTO u_sid,u_serialnumber;
EXIT WHEN c1%NOTFOUND;
EXECUTE IMMEDIATE 'alter system kill session '||''''||trim(u_sid)||','||trim(u_serialnumber)||'''';
END LOOP;
END;
/
删除用户
SQL> drop user carmot_demo2 cascade;
转载于:https://blog.51cto.com/tetop/1177713
更多推荐
已为社区贡献249条内容
所有评论(0)