The note describes how to dump ASH to trace to do online or offline analysis.
The ASH infrastructure will provide a single V$ view (V$ACTIVE_SESSION_HISTORY), to view the in-memory
contents of ASH. The ASH infrastructure will also provide a way to dump the in-memory contents of its circular
buffer onto an external file in a human readable format. The ASH dump file can be transported to another system,
imported onto a user table, and analyzed using the ADDM in that system.
The intended audience is for database DBA's
Performance tuning and problem diagnosis are the two most challenging and important management tasks
that any database administrator performs. In line with the primary drive of the server manageability effort,
the Autometic Database Diagnostic Monitor (ADDM) attempts to make, performing these two tasks, a
lot simpler and easier. ADDM employs an iterative top-down approach and drives a rule-based expert system,
to identify bottlenecks in a system and suggest relevant recommendations to tackle them.
ASH acquires the information it requires to sample the active session’s activity from the database kernel’s
session state objects. The quantity of information sampled by ASH could be quite voluminous, and
therefore, ASH maintains a fixed sized circular buffer in the database System Global Area (SGA). The fixed
sized circular buffer will be allocated during database start-up time. Since the information collected by the
ASH infrastructure compliments the information present in SWRF snapshots, and can be used for drilldown
purposes during problem diagnosis or performance tuning, the ASH data is also periodically flushed to disk.
The flushing and purging policies of ASH, including the way ASH respects SWRF baselines, are
completely tied with SWRF policies. Still, flushing the entire content of ASH on to disk could be too
populous to be feasible, and therefore, only one out of every ten active session samples will be flushed to
disk. In addition to ADDM using the ASH to achieve its objectives, the ASH contents will also be displayed in the
Oracle Enterprise Manager (EM) / Mozart [OEM-SWRF] performance screen. The graph that summarizes
the ASH contents in the EM performance screen will be a stacked graph showing the distribution of the
elapsed database time onto various wait times and CPU time, during every minute.
Ash Memory Size
Size of ASH Circular Buffer = Max [Min [ #CPUs * 2 MB, 5% of Shared Pool Size, 30MB ], 1MB ]
Categorising the Active Session
So will not see any information if a process is waitting for "SQL*Net message from client".
Online Analysis of ASH ==================================
SQL> delete test where rowid='AAAKB9AAEAAAAAiAAA';
From second session (SID 15) run the same DML, and it is obvious that second
session will wait for first session to commit.
Lets check the info in V$ACTIVE_SESSION_HISTORY.
Run the following script.
SQL> select SESSION_ID,NAME,P1,P2,P3,WAIT_TIME,CURRENT_OBJ#,CURRENT_FILE#,CURRENT_BLOCK#
from v$active_session_history ash, v$event_name enm
and SESSION_ID=&SID and SAMPLE_TIME>=(sysdate-&minute/(24*60));
Enter value for sid: 15
Enter value for minute: 1 /* How many minutes activity you want to see */
output is 59 lines as it is wiatting more than 1 minute more than 1 minute
So you have object details with problem info.
OFFLINE Analysis of ASH
So if your are not able to find the problem online, you can dump the ASH to a trace.
Command would be like below where level means minute, and dump is for 10 minutes history:
So you will get the trace file in udump.
Output of trace would be like following:
Oracle has provide a utility under $ORACLE_HOME/rdbms/demo (Location may change), by which you can
upload the ASH trace dump to a database table and do the analysis.
Please see the following note for the scripts:
You must use the same oracle version to compare the OFFLINE trace with the other view.
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/17252115/viewspace-1135363/，如需转载，请注明出处，否则将追究法律责任。