首頁 > 資料庫 > mysql教程 > 删除用户

删除用户

WBOY
發布: 2016-06-07 16:05:01
原創
1422 人瀏覽過

--批量删除 declare v_session_sid varchar2(100); v_session_serial varchar2(100); type ref_cursor_type is ref cursor; cursor_session ref_cursor_type; begin open cursor_session for 'select sid,serial# from v$session where status ''KILLED'' an

--批量删除

declare
v_session_sid varchar2(100);
v_session_serial varchar2(100);
type ref_cursor_type is ref cursor;
cursor_session ref_cursor_type;
begin
open cursor_session for 'select sid,serial# from v$session where status ''KILLED'' and lower(username) in (''lbi_sys_mk''') ';
loop
fetch cursor_session into v_session_sid,v_session_serial;
exit when cursor_session%notFound;
execute immediate 'alter system kill session '''||v_session_sid||','||v_session_serial||'''';
end Loop;
close cursor_session;
execute immediate 'drop user lbi_sys_mk cascade';
end;

---单个删

SELECT s.inst_id,
s.sid,
s.serial#,
p.spid,
s.username,
s.program,
s.paddr,
s.STATUS
FROM gv$session s
JOIN gv$process p ON p.addr = s.paddr AND p.inst_id = s.inst_id
WHERE s.type != 'BACKGROUND' and s.username='LBI_ODS_MK';


ALTER SYSTEM KILL SESSION '217,39645' immediate;

drop user lbi_ods_mk cascade;

來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板