OEM s SQL Monitoring Feature Ken Gottry 5-May-2014
SQL Monitoring Feature of Oracle Enterprise Manager (OEM) Oracle Enterprise Manager (OEM) presents many administrative and investigatory services to the DBA. When looking at performance issues, DBA s usually go to the Performance tab, look at the overall behavioral graphs, and then click on Top Activity link to begin their investigation This presentation talks about another approach, one using the SQL Monitoring feature of OEM. I don t know how long it s been around, but I just stumbled upon it this past weekend. It helped me find a performance issue in production that I had been struggling with for 2 days. I ll still use the Top Activity display but I ve definitely added OEM s SQL Monitoring feature to my database bag-of-tricks I m an old-timer who pooh-pooh s GUI s, relying instead on my tried-n-true sqlplus queries into V$ and DBA_HIST. But SQL Monitoring may be the OEM feature that changes that
ACCESSING SQL MONITORING
When you click on the Performance tab in OEM, you have to login to the database instance. Then you see the current activity screen We normally click on the Top Activity link to begin our investigation
The Top Activity screen shows the currently executing SQL plus a brief history of top activity We normally click on the top SQL in the list to see the SQL Details screen
From the SQL Details screen, we typically look at the Statistics tab to see how the SQL has been behaving. Sometimes we look at the Plan tab to see how Oracle estimates it will execute this SQL However, this presentation shows what s on the SQL Monitoring tab
It shows recent executions of the SQL, including a breakdown of DB Time and I/O time Mouse-over any colored section of a graph to see the wait event and the percent of time The left-hand column indicates if the SQL ended, aborted, or is still running Click on the icon in the left-hand column of the execution you want to investigate
Magic! This screen shows the Explain Plan, both the original estimates and the actual execution values The 3 right-hand columns show I/O, CPU, an waits associated with each step of the Explain Plan. It s like AutoTrace without the work or forethought The Timeline column shows in what order Oracle executed the steps in the plan The next slide shows a more interesting section of the execution of this SQL
The HASH JOIN line shows Oracle estimated 419K rows but actually ended up processing 806M Mousing-over the orange/brown sections of the I/O Requests column shows Direct Path Read Temp and Direct Path Write Temp waits The TEMP column shows this excessive number of actual rows exceeded memory so Oracle used 37GB of TEMP. AWR shows these Direct Path Read/Write Temp waits averaged 23ms. Very slow
The Activity and Metrics buttons at the top of the display provide other views of the execution
ALTERNATE PATH
Here s an alternate path to the same information From the initial Performance display, from which most of us click Top Activity, scroll to the bottom. On the right-hand column is a link for SQL Monitoring
The SQL Monitoring display shows all executing and recently completed SQL This is similar to, but different than, the Top Activity display The icon in the left-hand column indicates if the SQL is executing, completed, or aborted
SQL MONITORING REPORT
Find something interesting? Want to share it with the developers? Want to save it for future reference? Click the View Report button The graphical data is presented as text data within a web page. Use your browser s File SaveAs WebPage or if your OEM is so configured, click on the Email button
HISTORICAL DATA
They never call when the problem is happening. They always call and say Yesterday at 3pm things were slow No problem. On the Top Activity display, drag the shadowed box to the left to the appropriate timeframe. The SQL list at the bottom changes. Click on the offending SQL and proceed as before. I haven t figured out yet how long SQL Monitoring data is stored