oracle强制删除用户
精选 转载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://ucenter.51cto.com/images/noavatar_middle.gif)
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章