Addm via SQL

2
Run an ADDM report via PLSQL Contributed by Martin Wednesday, 15 November 2006 Last Updated Monday, 27 November 2006 With the advent of Oracle 10g came a new set of monitoring tools that may rush to the aid of the DBA. They are collectively called ADDM, or "Automatic Database Diagnostic Monitor". ADDM is designed to be the first place for the DBA to look at should problems arise. Benefits ADDM provides the following benefits: - CPU bottlenecks - Is the system CPU bound by Oracle or some other application? - Undersized Memory Structures - Are the Oracle memory structures, such as the SGA, PGA, and buffer cache, adequately sized? - I/O capacity issues - Is the I/O subsystem performing as expected? - High load SQL statements - Are there any SQL statements which are consuming excessive system resources? - igh load PL/SQL execution and compilation, as well as high load Java usage - RAC specific issues - What are the global cache hot blocks and objects; are there any interconnect latency issues? - Sub-optimal use of Oracle by the application - Are there problems with poor connection management, excessive parsing, or application level lock contention? - Database configuration issues - Is there evidence of incorrect sizing of log files, archiving issues, excessive checkpoints, or sub-optimal parameter settings? - Concurrency issues - Are there buffer busy problems? - Hot objects and top SQL for various problem areas The primary interface to ADDM is Enterprise Manager but you can also invoke it using its PL/SQL interface. Preparation Before a report can be run, some preparations have to be made. First, you need to define a set of snapshots as a starting and ending point for the analysis. You can either take two snapshots via the dbms_workload_repository.create_snapshot method or use one of the hourly snapshots provided by ADDM itself. Either way, note the snap_ids you need. Run ADDM If told so, ADDM will create a report and store it in the AWR (Automatic Workload Repository). To do so, you need to create a task, set its parameters and execute the task. Consider the example: set serveroutput on declare tname varchar2(50) := ''; -- will be set by ADDM tid number; -- will be set by ADDM begin dbms_advisor.create_task('ADDM',tid,tname,'run_addm(4711,4712)'); dbms_advisor.set_task_parameter(tname,'START_SNAPSHOT',4711); dbms_advisor.set_task_parameter(tname,'END_SNAPSHOT',4712); dbms_advisor.execute_task(tname); dbms_output.put_line('Task#' || tid || ' (' || tname || ')'); end; Task# 4906 (TASK_4906) PL/SQL Procedure completed successfully the playground.de http://www.the-playground.de/joomla/ Powered by Joomla! Generated: 4 September, 2011, 18:41

Transcript of Addm via SQL

Page 1: Addm via SQL

Run an ADDM report via PLSQL Contributed by MartinWednesday, 15 November 2006Last Updated Monday, 27 November 2006

With the advent of Oracle 10g came a new set of monitoring tools that may rush to the aid of the DBA. They arecollectively called ADDM, or "Automatic Database Diagnostic Monitor". ADDM is designed to be the first place for theDBA to look at should problems arise.

Benefits

ADDM provides the following benefits: - CPU bottlenecks - Is the system CPU bound by Oracle or some other application? - Undersized Memory Structures - Are the Oracle memory structures, such as the SGA, PGA, and buffer cache,adequately sized? - I/O capacity issues - Is the I/O subsystem performing as expected? - High load SQL statements - Are there any SQL statements which are consuming excessive system resources? - igh load PL/SQL execution and compilation, as well as high load Java usage - RAC specific issues - What are the global cache hot blocks and objects; are there any interconnect latency issues? - Sub-optimal use of Oracle by the application - Are there problems with poor connection management, excessiveparsing, or application level lock contention? - Database configuration issues - Is there evidence of incorrect sizing of log files, archiving issues, excessivecheckpoints, or sub-optimal parameter settings? - Concurrency issues - Are there buffer busy problems? - Hot objects and top SQL for various problem areas

The primary interface to ADDM is Enterprise Manager but you can also invoke it using its PL/SQL interface.

 

Preparation Before a report can be run, some preparations have to be made. First, you need to define a set of snapshots as astarting and ending point for the analysis. You can either take two snapshots via thedbms_workload_repository.create_snapshot method or use one of the hourly snapshots provided by ADDM itself. Eitherway, note the snap_ids you need.

Run ADDM If told so, ADDM will create a report and store it in the AWR (Automatic Workload Repository). To do so, you need tocreate a task, set its parameters and execute the task. Consider the example: set serveroutput on declare   tname varchar2(50) := '';    -- will be set by ADDM   tid   number;                -- will be set by ADDM begin   dbms_advisor.create_task('ADDM',tid,tname,'run_addm(4711,4712)');   dbms_advisor.set_task_parameter(tname,'START_SNAPSHOT',4711);   dbms_advisor.set_task_parameter(tname,'END_SNAPSHOT',4712);   dbms_advisor.execute_task(tname);   dbms_output.put_line('Task#' || tid || ' (' || tname || ')'); end; Task# 4906 (TASK_4906) PL/SQL Procedure completed successfully

the playground.de

http://www.the-playground.de/joomla/ Powered by Joomla! Generated: 4 September, 2011, 18:41

Page 2: Addm via SQL

Generate a report Once Oracle reported the task_name, you may generate the report. It may be beneficial to spool it to some file forfurther reading. SYS@db10> set long 1000000 SYS@db10> set pages 50000000 SP2-0267: pagesize option 50000000 out of range (0 through 50000) SYS@db10> set pages 50000 SYS@db10> column get_clob format a80 SYS@db10> l   1  select dbms_advisor.get_task_report('TASK_4906','TEXT','ALL') as addm_rep   2* from dba_advisor_tasks where task_id = 4906 SYS@db10> spool /tmp/rep.txt SYS@db10> r   1  select dbms_advisor.get_task_report('TASK_4906','TEXT','ALL') as addm_rep   2* from dba_advisor_tasks where task_id = 4906

spool off

Here you have your report in /tmp/rep.txt

the playground.de

http://www.the-playground.de/joomla/ Powered by Joomla! Generated: 4 September, 2011, 18:41