CPU main functions: process instruction, an operation, an operation is required, the control time, process the data.
Combined with high CPU utilization database instance, it may be because the database to perform a large number of operations (full table queries, a lot of sorting).
As the company no DBA, a database problem encountered only their own investigation.
First, if there is a deadlock
- Viewing deadlocks ID
- View the table name
- Hand closed deadlock
Second, the aid PLSQL queries regular job and session
Third, wait for the event database query
SELECT P.PID,
S.SID,
S.SERIAL#,
S.USERNAME,
Q.SQL_ID,
Q.SQL_TEXT,
Q.SQL_FULLTEXT,
W.EVENT,
W.WAIT_TIME,
W.STATE,
CASE
WHEN W.STATE = 'WAITING' THEN
W.SECONDS_IN_WAIT
WHEN W.STATE = 'WAITING KNOWN TIME' THEN
W.WAIT_TIME
END AS SEC_IN_WAIT
FROM V$SESSION S, V$SESSION_WAIT W, V$SQLAREA Q, V$PROCESS P
WHERE S.SID = W.SID
AND S.SQL_ID = Q.SQL_ID
AND P.ADDR = S.PADDR
AND W.EVENT NOT LIKE 'SQL*Net%'
AND S.USERNAME IS NOT NULL
AND W.WAIT_TIME >= 0
ORDER BY W.WAIT_TIME DESC;
Found waiting for the event, SQL analysis to be performed discover the full amount there are multiple tables (millions data) associated with the query.
So the data was appropriate and SQL optimization, CPU usage higher problem to be solved.
Fourth, the process summary
There are many reasons for the surge CPU, there are many ideas, follow-up if they can refer to the above ideas, to issue precise positioning and optimized.