Doug Burns
Doug Burns
Doug Burns
Introduction
Architecture
Command Line Approach
GUI Approach
Conclusions and References
03/04/2013
Real Time SQL Monitoring is the killer performance analysis
feature of Oracle 11g
Majority of database performance problems turn out to be SQL
performance problems
Easily understandable view of SQL performance
Shows actual SQL statement processing steps, unlike EXPLAIN PLAN
▪ Or that damn ambulance button in TOAD, prior to version 11.5!
▪ See http://tinyurl.com/c66hubl and http://tinyurl.com/bq7agq7
03/04/2013
An RDBMS instrumentation feature
You do not have to use OEM or any other specific tool
Built on existing instrumentation – e.g. Plan execution stats and ASH
03/04/2013
(G)V$SQL_MONITOR & (G)V$SQL_PLAN_MONITOR
Up-front warning – “Use the GUI, don’t use V$SQL_MONITOR”
If you don’t have the GUI … be careful about your queries and results
03/04/2013
Useful for identifying statements of interest, but as long as
you have enough information to clearly identify statement
you’re interested in, that’s all you really need for the next
part.
03/04/2013
Introduction
Architecture
Command Line Approach
GUI Approach
Conclusions and References
03/04/2013
This approach is great if you have no OEM access
Implemented by the DBMS_SQLTUNE package
Example of a DBMS_XPLAN.DISPLAY_CURSOR equivalent
Will generate a plain text version of the report for the last SQL statement
executed if monitored. (Add a MONITOR hint if you need to)
set trimspool on
set trim on
set pages 0
set linesize 1000
set long 1000000
set longchunksize 1000000
select dbms_sqltune.report_sql_monitor(type=>'TEXT') from dual
spool example_1.txt
/
spool off
03/04/2013
If you’ve identified the SQL_ID you’re interested in you have
several options
set trimspool on
set trim on
set pages 0
set linesize 1000
set long 1000000
set longchunksize 1000000
select dbms_sqltune.report_sql_monitor(
sql_id=>'51cmd19nphmm7', type=>'HTML') from dual
spool example_2.html
/
spool off
03/04/2013
This one rocks
set trimspool on
set trim on
set pages 0
set linesize 1000
set long 1000000
set longchunksize 1000000
select dbms_sqltune.report_sql_monitor(sql_id=>'51cmd19nphmm7',
type=>'ACTIVE')
from dual
spool example_3.htm
/
spool off
03/04/2013
Flash!
Connects to OTN to pull components
Or can be stored locally and referenced via base_path parameter
03/04/2013
Introduction
Architecture
Command Line Approach
GUI Approach
Conclusions and References
03/04/2013
The best way to investigate statements running currently
Available in OEM DB Control 11g, OEM Grid Control 10.2.0.5 and OEM
Cloud Control 12c for 11g targets
Various access paths – look for SQL Monitoring
03/04/2013
03/04/2013
03/04/2013
03/04/2013
03/04/2013
03/04/2013
Refresh Issues
Stop Refresh button!
Information Retention
You'll be so excited and come to depend on RTSM
Look at performance of a statement that ran yesterday
Select 'Active in last' to 24 hours or ALL
Statement still doesn't appear
03/04/2013
Name Description Default
03/04/2013
Bug Number 14117966
If any of the slaves in a Parallel Query is Idle for a long period of time
(30 minutes)
Even if others are Active
Statement is marked as errored
03/04/2013
ACTIVE report in OEM Grid Control 10.2.0.5 is limited
compared to Command-Line report
No Plan or Metrics tabs
03/04/2013
Introduction
Architecture
Command Line Approach
GUI Approach
Conclusions and References
03/04/2013
EXPLAIN PLAN
03/04/2013
... once you use it, there's no going back
03/04/2013
REPORT_SQL_MONITOR function specification
http://tinyurl.com/a9l7p5e
03/04/2013
OTN page about ACTIVE reports
Several examples you can play around with
More technical details not covered in this presentation
FAQ section
http://tinyurl.com/9wwtncz
Thanks
Benoit Dageville (Formerly Oracle Corp.)
John Beresniewicz (Oracle Corp)
Lisa Dobson
03/04/2013
Doug Burns