oracle session会话

来源:互联网 发布:疯狂阅读软件 编辑:程序博客网 时间:2024/06/05 20:36

--查询session
select sid,serial#,sql_text,executions from v$sql join v$session on v$sql.sql_id=v$session.sql_id where upper(sql_text) like '%ISAP%' ;

--查询执行状态
SELECT  SID,  decode(totalwork, 0, 0, round(100 * sofar/totalwork, 2)) "Percent", message "Message", start_time,
elapsed_seconds, time_remaining , inst_id  from GV$Session_longops t where t.sid = '2529';


--查询执行状态
SELECT  SID,  decode(totalwork, 0, 0, round(100 * sofar/totalwork, 2)) "Percent", message "Message", start_time,
elapsed_seconds, time_remaining , inst_id  from GV$Session_longops t where upper(t.message) like  '%ISAP%';


--查询执行状态
SELECT  SID,  decode(totalwork, 0, 0, round(100 * sofar/totalwork, 2)) "Percent", message "Message", start_time,
elapsed_seconds, time_remaining , inst_id  from GV$Session_longops t where t.sid = '2425' and t.SERIAL#='5654';

 

 

 

--查询session执行的sqlid
select *
  from v$session b
 where b.SID in ('2316', '2318', '2322', '2352', '2372', '2406', '2454',
        '2482', '2483', '2493', '2493', '2515', '2534', '2556',
        '2564', '2621', '2624', '2629', '2636', '2656', '2659');
--and b.sql_id != 'fb05k0pjr7kz1'; -- sid=2346 serial#=6492
--这些session对应执行的sql都是b.sql_id != 'fb05k0pjr7kz1';
select * from v$sqlarea a where a.SQL_ID ='fb05k0pjr7kz1';--

--杀掉session
alter system kill session '2346,6492' immediate;

原创粉丝点击