1.下载Process Explorer
2.打开Process Explorer,查看CPU使用情况最高的进程
3.双击该进程,查看详情
4. 获取cpu使用最好的线程tid
5. 查询sql_id
- select sql_id from v$session
- where paddr in(
- select addr from v$process
- where spid in('16796','11972','9812','11652','5484')
- )
6.根据5中的sql_id查询具体执行占用CPU过高的sql语句
- select * from v$sqlarea where sql_id in(sql_id1,sql_id2,sql_id3...);
7.查询sid和serial#
- SELECT sid,serial#,sql_id from v$session where sql_id in(sql_id1,sql_id2,sql_id3...)
8.杀掉进程
- alter system kill session 'sid,serial#';
或批量杀进程
- SELECT 'alter system kill session '''||sid||','||serial#||''';' from v$session where sql_id in(sql_id);