Oracle 根据SQL_ID查询并杀会话,清空执行计划缓冲池
2018年09月06日 10:31:40 小学生汤米 阅读数:473
1. 查询最近五分钟内最高频次SQL,查看event

select t.SQL_OPNAME,t.SQL_ID,count(*) from v$active_session_history t where t.SAMPLE_TIME>to_timestamp('20180906-09:55:00','YYYYMMDD-hh24:mi:ss') and t.SESSION_TYPE='FOREGROUND'
group by t.SQL_OPNAME,t.SQL_ID order by count(*) desc;

2、 根据SQL 查询到操作用户

select s.username from v$active_session_history t,dba_users s where t.USER_ID=s.user_id and t.SQL_ID='0nx7fbv1w5xg2';

 

3、查询并获取当前sql的杀会话语句

select 'alter system kill session '''|| t.SID||','||t.SERIAL#||''';' from v$session t where t.SQL_ID='0nx7fbv1w5xg2';

 

4、查询并获取当前会话的执行计划清空过程语句

select SQL_TEXT,sql_id, address, hash_value, executions, loads, parse_calls, invalidations
from v$sqlarea where sql_id='0nx7fbv1w5xg2';

call sys.dbms_shared_pool.purge('0000000816530A98,3284334050','c');

相关文章:

  • 2021-09-04
  • 2022-12-23
  • 2021-11-13
  • 2022-01-06
  • 2021-12-13
  • 2022-12-23
  • 2022-02-09
  • 2021-11-28
猜你喜欢
  • 2021-11-21
  • 2021-12-29
  • 2021-11-18
  • 2021-11-13
  • 2022-02-27
  • 2022-12-23
相关资源
相似解决方案