Linux platform, we generally through the top command to see the most performance-consuming process, if the see is Oracle, then we need to pass the process number, query the process currently executing SQL statements, Baidu Online has a lot of SQL, I generally find by the following way:find the SID of the corresponding SQL statement by using the PID on the operating system:
SELECT S.sid, p.spid from V$session S, v$process p WHERE s.paddr = p.addr and
It then finds the specific contents of the corresponding SQL statement through the SID:
SELECT S.sid, S.status, q.sql_text from V$session s, v$sqltext q WHERE s.sql_hash_value = q.hash_value and s.sql_address = Q.address and S.sid = <sid> ORDER by q.piece;
Merge One
Select /*+ ORDERED */ sql_text from v$sqltext a WHERE (A.hash_value, a.address) in ( Select DECODE ( Sql_hash_value, 0, Prev_hash_value, sql_hash_value ), DECODE (sql_hash_value, 0, PREV_SQL_ADDR, SQL _address) from v$session b where b.paddr = (SELECT addr from v$process c WHERE c.spid = ' &pid ')) OR DER by Piece asc/
Merge two:
Select S.sid, S.status, Q.sql_textfrom v$session s, v$sqltext qwhere s.sql_hash_value = q.hash_value and s.Sql_Address = q . Address and S.sid in (Select s.sid from v$session s, v$process p Where s.paddr = p.addr and p.spid = ' & ;p ID ') Order by q.piece;
Find the appropriate SQL statement by using the PID on the operating system