In the afternoon, a colleague said that a Linux testing server was very slow and seriously affected the work.
Log on to the server and use the top command to check whether the Oracle process accounts for 100% of the CPU.
The following steps are used to find out the SQL statements that cause performance problems:
1. Use the TOP command to find that the PID of the Oracle process that occupies CPU 1234% is;
2. Open PL/SQL Dev and query the process information: Select * from V $ process where spid = 1234;
3. Find the session information of the process: Select Sid, program from V $ session s
Where exists (select 1 from V $ process where spid = 1234 and ADDR = S. paddr );
4. From the above, I already know which client is causing the program. Continue:
Find the sqlselect SQL _text of these sessions
From v $ session a left Outer Join v $ sqltext B on A. SQL _address = B. Address
Where exists (select 1 from V $ process where spid = 17518 and ADDR = A. paddr)
Order by A. Serial #, B. Piece
5. This statement is better. Select B. SQL _text is sorted according to CPU usage.
From v $ session a left Outer Join v $ sqlarea B on A. SQL _address = B. Address
Where exists (select 1 from V $ process where spid = 1234 and ADDR = A. paddr)
Order by B. cpu_time DESC