Small knowledge, big challenge! This article is participating in the creation activity of “Essential Tips for Programmers”.

This article has participated in the “Digitalstar Project” and won a creative gift package to challenge the creative incentive money.

Oracle database is a used database, about the performance of Oracle database. After Oracle 10G, Oracle provides a performance monitoring tool called Automatic Workload Repository (AWR).

The principle of who runs AWR

After the Oracle database is started, a background process collects system snapshot information every hour. The information is collected from the V$active_Session_History view. This view displays a history of recent active sessions. The collected information is stored for 8 days. (select * from dba_hist_wr_control;) , sampling frequency and storage time can be configured.

The MMON and MMNL processes automatically take snapshots at fixed intervals. MMON is responsible for performing a variety of management-related background tasks, while MMNL is responsible for performing lightweight and high-frequency management-related background tasks.

Who runs AWR report

Oracle can store awR snapshot data for 8 days. You can generate AWR reports for any two points in time (the corresponding time period and snapshot time are returned after entering a date) in Oracle. The specific generation method can be multiple, generally requires sys permission.

Procedure 1 Log in to the server where the Oracle program is installed and locate the awrrpt. SQL file

D: \ oracle \ product \ 10.2.0 \ \ ADMIN \ awrrpt db_1 \ an RDBMS SQLCopy the code

2 Log in to the Oracle database as user sysdba

3 Running Commands

@ D: \ oracle \ product \ 10.2.0 \ \ ADMIN \ awrrpt db_1 \ an RDBMS SQLCopy the code

4 Enter report_type. HTML is recommended

5 Select how many days ago the report to be generated was recorded

Input 1, it means that you want to generate the report of a certain period between 0 o ‘clock today and now; input 2, it means that you are satisfied with the report of a certain period between 0 o ‘clock yesterday and now. And so on. By default, the AWR saves the image information for one month. By default, the latest seven days are recorded

6 Enter the SNAP ID of the start point and the Snap ID of the end point when the report is generated

After days are entered, a table of time periods is displayed. Each time point has a snapId, and the interval is 1 hour by default. Next, enter the SNAP ID of the start point and the SNAP ID of the end point

7 Enter a name for generating the report

The system will automatically generate an input name and display it in the prompt message. If the input name is used. You don’t have to type anything. Enter (for easy search, it is recommended to write absolute path here)

8 Open the generated HTML report in a browser