Use the top command to isolate the highest CPU spid in a Linux system,
And then press the following
Select SID,
serial#,
Username
Osuser,
Machine
Program
Process
To_char (Logon_time, ' yyyy/mm/dd hh24:mi:ss ') logon
From V$session
where Paddr in (select addr from v$process where spid in (' 24566 '));
Select S.sid,
s.serial#,
S.username,
S.osuser,
S.machine,
S.program,
S.process,
To_char (S.logon_time, ' yyyy/mm/dd hh24:mi:ss ') logon,
P.spid
From V$session s,v$process p
where 1=1
and S.PADDR=P.ADDR
and s.sid= ' 1050 '
;
Select sql_text,a.sql_id
From V$sqltext A
where a.hash_value= (select Sql_hash_value
From V$session b
where b.sid= ' 634 ')
Order by piece ASC;
SELECT * FROM V$sqlarea q
where q.sql_id= ' Akf0uyy10kgn9 '
;
---------------------
SELECT *
From (select Q.sql_id,q.sql_text, q.sql_fulltext,s.sid,s.serial#
From V$sqlarea q,v$session s
where q.sql_id=s.sql_id
and Last_active_time>=to_date (' 2016-05-03 08:00:00 ', ' yyyy-mm-dd HH24:MI:SS ')
and INSTR (Parsing_schema_name, ' SYS ') <=0
ORDER BY cpu_time Desc)
where RowNum <= 15
ORDER BY rownum ASC;
Alter system kill session ' 634,40971 ';
Performance Optimization-Query CPU-consuming session and SQL