Summary
Symptom
Workload, space requirements, and performance of the Oracle database Version 10g and higher should be analyzed.
Reason and Prerequisites
As of Oracle 10g, Oracle provides a multitude of new features that facilitate the analysis of workdload, space requirements and performance of the database:
Refer to Notes 618868, 619188 and 766349 for a general understanding of the Oracle performance analysis.
Data that is collected within the new functions that are described here is stored in the SYSAUX tablespace. To determine which components require most space in the SYSAUX tablespace, you can enter the following query:
SELECT * FROM
( SELECT
OCCUPANT_DESC,
SPACE_USAGE_KBYTES
FROM
V$SYSAUX_OCCUPANTS
ORDER BY
SPACE_USAGE_KBYTES DESC)
WHERE ROWNUM <=10;
For more information, see the Oracle documentation under:
Oracle 10g Database Performance Tuning Guide
-> 5 Automatic Performance Statistics
-> Automatic Workload Repository
Oracle 10g Database Performance Tuning Guide
-> 6 Automatic Performance Diagnostics
-> Automatic Database Diagnostic Monitor
Solution
Different DBA_HIST views, which allow you to analyze past periods, are available based on the AWR data. The names correspond to the standard performance views to a large extent, with the difference that "V$" is replaced by "DBA_HIST_". The following views are especially relevant from a performance point of view:
SELECT SNAP_ID, SUBSTR(BEGIN_INTERVAL_TIME, 1, 30),
SUBSTR(END_INTERVAL_TIME, 1, 30)
FROM DBA_HIST_SNAPSHOT
ORDER BY SNAP_ID;
ORA-20500: Could not find ASH Samples for the given dbid
Proceed as follows to create such a report:
EXEC DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT();
a manual snapshot (for example immediately before starting and after finishing the activity to be analyzed).
Proceed as follows to create such a report:
To create an AWR SQL report, proceed as follows:
SELECT
TO_CHAR(AT.EXECUTION_END, 'dd.mm.yyyy hh24:mi:ss') "DATE",
AF.MESSAGE FINDING,
AA.MESSAGE ACTION
FROM
DBA_ADVISOR_TASKS AT,
DBA_ADVISOR_FINDINGS AF,
DBA_ADVISOR_RECOMMENDATIONS AR,
DBA_ADVISOR_ACTIONS AA
WHERE
AT.OWNER = AF.OWNER AND
AT.TASK_ID = AF.TASK_ID AND
AF.OWNER = AR.OWNER (+) AND
AF.TASK_ID = AR.TASK_ID (+) AND
AF.FINDING_ID = AR.FINDING_ID (+) AND
AR.OWNER = AA.OWNER (+) AND
AR.TASK_ID = AA.TASK_ID (+) AND
AR.REC_ID = AA.REC_ID (+) AND
AT.EXECUTION_END > SYSDATE - 1 / 24
ORDER BY AT.EXECUTION_END DESC, AF.FINDING_ID, AR.REC_ID;
Workload, space requirements, and performance of the Oracle database Version 10g and higher should be analyzed.
Reason and Prerequisites
As of Oracle 10g, Oracle provides a multitude of new features that facilitate the analysis of workdload, space requirements and performance of the database:
- Active Session History (ASH): Analysis of historical wait events and CPU consumption of Oracle sessions
- Automatic Workload Repository (AWR): Collection of database performance data
- Automatic Database Diagnostic Monitor (ADDM): Tuning recommendations based on AWR
- Segment Advisor: Information about space requirements and fragmentation of segments
- SQL Tuning Advisor: Recommendations about optimizing SQL statements
- SQL Access Advisor: Recommendations about optimizing SQL statements
Refer to Notes 618868, 619188 and 766349 for a general understanding of the Oracle performance analysis.
Data that is collected within the new functions that are described here is stored in the SYSAUX tablespace. To determine which components require most space in the SYSAUX tablespace, you can enter the following query:
SELECT * FROM
( SELECT
OCCUPANT_DESC,
SPACE_USAGE_KBYTES
FROM
V$SYSAUX_OCCUPANTS
ORDER BY
SPACE_USAGE_KBYTES DESC)
WHERE ROWNUM <=10;
For more information, see the Oracle documentation under:
Oracle 10g Database Performance Tuning Guide
-> 5 Automatic Performance Statistics
-> Automatic Workload Repository
Oracle 10g Database Performance Tuning Guide
-> 6 Automatic Performance Diagnostics
-> Automatic Database Diagnostic Monitor
Solution
- 1. Access to historical monitoring data
Different DBA_HIST views, which allow you to analyze past periods, are available based on the AWR data. The names correspond to the standard performance views to a large extent, with the difference that "V$" is replaced by "DBA_HIST_". The following views are especially relevant from a performance point of view:
- DBA_HIST_FILESTATXS: Data file accesses
- DBA_HIST_TEMPSTATXS: Tempfile accesses
- DBA_HIST_SYSTEM_EVENT: Accumulated Wait Events
- DBA_HIST_WAITSTAT: Buffer Busy Waits
- DBA_HIST_ENQUEUE_STATS: Enqueue Waits
- DBA_HIST_LATCH: Latch Waits
- DBA_HIST_SYSSTAT: System-wide statistical information
- DBA_HIST_ACTIVE_SESS_HISTORY: Snapshots of the wait event and the CPU consumption of active sessions
- DBA_HIST_SQLBIND: bind variable content
- DBA_HIST_SQL_PLAN: Execution plans
- DBA_HIST_OSSTAT: CPU information and memory information
SELECT SNAP_ID, SUBSTR(BEGIN_INTERVAL_TIME, 1, 30),
SUBSTR(END_INTERVAL_TIME, 1, 30)
FROM DBA_HIST_SNAPSHOT
ORDER BY SNAP_ID;
- 2. Creation of an ASH overview report (Oracle 10.2 or higher)
- Top Wait Events (incl. P1- /P2- /P3-parameter)
- SQL statements for the top activities
- Objects for the top activities
- Top activities for sub-intervals in the selected period
- Change into the rdbms/admin directory below the Oracle home directory.
- Log on to the database with "sqlplus/as sysdba".
- Run the ASHRPT script to create the report by entering:@ashrpt
- Now enter "html" or "text", depending on the desired output format.
- Enter the start time of the period.
- Enter the end time of the period.
- If necessary, enter the name of the result report.
ORA-20500: Could not find ASH Samples for the given dbid
- 3. Creating an AWR overview report
Proceed as follows to create such a report:
- Change into the rdbms/admin directory below the Oracle home directory.
- Log on to the database with "sqlplus/as sysdba".
- Execute the AWRRPT script to create the report by entering: @awrrpt
- Now enter "html" or "text", depending on the desired output format.
- The system may then query you as to the number of days for which the available snapshots should be displayed. Here, enter the number of days to be displayed.
- Now enter the number of the original snapshot.
- Then select the number of the final snapshot.
- If requested, enter a name for the report. If you only select RETURN, a report is generated with the displayed name.
- Now an AWR report is generated in the current directory, which then can be displayed, depending on the format, with a Web browser or a text editor.
- Size of the memory areas
- Load values (for example, number of disk reads/seconds)
- Hit ratios
- Non-Idle-Wait events that have occurred
- Top SQL statements with respect to elapsed time, CPU time, buffer gets, disk reads, number of executions, parses and sharable memory
- Instance activities (V$SYSSTAT info)
- Tablespace and date file I/O information
- Buffer busy wait statistics
- Enqueue statistics
- Latch statistics
- Segment statistics
- Profile parameters
EXEC DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT();
a manual snapshot (for example immediately before starting and after finishing the activity to be analyzed).
- 4. Creating an AWR diff report
Proceed as follows to create such a report:
- Change into the rdbms/admin directory below the Oracle home directory.
- Log on to the database with "sqlplus/as sysdba".
- Execute the AWRDDRPT script to create the report by entering:
@awrddrpt
- Now enter "html" or "text", depending on the desired output format.
- The system may then query you as to the number of days for which the available snapshots should be displayed. Enter the number the number of days to be displayed for the selection of the first interval.
- Now enter the number of the original snapshot of the first interval.
- Then select the number of the final snapshot of the first interval.
- Repeat the last three steps for the second interval that is to be compared.
- If requested, enter a name for the report. If you only select RETURN, a report is generated with the displayed name.
- Now an AWR diff report is generated in the current directory, which then can be displayed, depending on the format, with a Web browser or a text editor.
- 5. Create an ADDM report
- Change into the rdbms/admin directory below the Oracle home directory.
- Log on to the database with "sqlplus/as sysdba".
- Execute the ADDMRPT script for creating a report by entering: @addmrpt
- Now enter the number of the original snapshot.
- Then select the number of the final snapshot.
- If requested, enter a name for the report. If you only select RETURN, a report is generated with the displayed name.
- Now an ADDM report is generated in the current directory which contains optimization options on the one hand, and an overview of non-critical areas on the other hand. This report represents a good starting-point for optimizing the database performance.
- 6. Analyzing the database using the Segment Advisor
- 7. Creating an AWR SQL report
To create an AWR SQL report, proceed as follows:
- Log on to the database with "sqlplus / as sysdba". Call the following to start the AWRSQRPT script:
@awrsqrpt
- Now enter "html" or "text", depending on the desired output format.
- The system may then query you as to the number of days for which the available snapshots should be displayed. Here, enter the number of days to be displayed.
- Now enter the number of the original snapshot of the first interval.
- Then select the number of the final snapshot of the first interval.
- Enter the SQL_ID of the SQL statement that is to be analyzed.
- If required, enter an alternative report name.
- Now an AWR SQL report is generated in the current directory, which then can be displayed, depending on the format, with a Web browser or a text editor.
- 8. Analyzing an SQL statement using the SWL Tuning Advisor
- Change into the rdbms/admin directory below the Oracle home directory.
- Log on to the database with "sqlplus / as sysdba".
- Execute the SQLTRPT script for creating a report by entering: @sqltrpt
- Enter the SQL_ID of the SQL statement to be analyzed.
- You now receive an output containing analysis details and recommendations.
- 9. Analyzing an SQL statement using the SQL Access Advisor
- 10. Manual display of Advisor results
- DBA_ADVISOR_FINDINGS: Results
- DBA_ADVISOR_RECOMMENDATIONS: Recommendations
- DBA_ADVISOR_OBJECTS: Affected objects
- DBA_ADVISOR_ACTIONS: Recommended actions
SELECT
TO_CHAR(AT.EXECUTION_END, 'dd.mm.yyyy hh24:mi:ss') "DATE",
AF.MESSAGE FINDING,
AA.MESSAGE ACTION
FROM
DBA_ADVISOR_TASKS AT,
DBA_ADVISOR_FINDINGS AF,
DBA_ADVISOR_RECOMMENDATIONS AR,
DBA_ADVISOR_ACTIONS AA
WHERE
AT.OWNER = AF.OWNER AND
AT.TASK_ID = AF.TASK_ID AND
AF.OWNER = AR.OWNER (+) AND
AF.TASK_ID = AR.TASK_ID (+) AND
AF.FINDING_ID = AR.FINDING_ID (+) AND
AR.OWNER = AA.OWNER (+) AND
AR.TASK_ID = AA.TASK_ID (+) AND
AR.REC_ID = AA.REC_ID (+) AND
AT.EXECUTION_END > SYSDATE - 1 / 24
ORDER BY AT.EXECUTION_END DESC, AF.FINDING_ID, AR.REC_ID;
Header Data
Release Status: | Released for Customer |
Released on: | 05.03.2009 08:19:34 |
Master Language: | German |
Priority: | Recommendations/additional info |
Category: | Performance |
Primary Component: | BC-DB-ORA Oracle |
Affected Releases
Release-Independent
Related Notes
1 comment:
Thanks for sharing valuable and informative content. Keep it up.
We also provide same services such as MySQL database and sql and oracle sql free download etc. if you want to take any related services please visit our official website tosska.com.
Post a Comment