oracle 11g ocp notes (24)--AWR and alarm system

1. Automatic load knowledge base

1. Collect information

   MMON process collection, located in the SYSAUX space.

    alter system set statistics_level=typical or all can be used. This parameter controls statistics collection.

2. Manage AWR.

   200-300MB, reserved for eight days.

3. Metrics, Information and Benchmarks

    WAR refines metrics and defines baselines.

4、dbms_workload_repository

     Use this package to manage WARs. The detailed case can be found in the appendix of this article.

        select * from v$sysaux_occupants where occupant_name='SM/AWR'; 查询大小

       The hand-generated script is located at $orace_home/rdbms/admin/awrrpt.sql

-------------------------------------------------------------------------------------------------------------------------

1. Modify the snapshot settings:

select * from dba_hist_wr_control;

exec dbms_workload_repository.modify_snapshot_settings(retention => 15*1440,interval => 30); 

--Interval : Set the frequency of snapshot collection, in minutes. The value that can be set is a minimum of 10 minutes and a maximum of 1 year. If this parameter is set to 0, it means that the AWR feature is disabled. Once every 30 minutes
exec dbms_workload_repository.modify_snapshot_settings(INTERVAL =>30);
--Set Retention: Set the time for saving snapshots, the unit is minutes. The minimum value that can be set is 1 day and the maximum is 100 years. Setting this parameter to 0 means that the collected snapshot information is permanently retained. Retention for 3 days each time.
exec dbms_workload_repository.modify_snapshot_settings(retention => 3 * 24 * 60);
--Topnsql : Specifies the number of SQLs that are collected and compared to occupy resources. The minimum value that can be set is 30, and the maximum value does not exceed 100000000.
To view the relevant settings of the current snapshot collection, you can view it through the DBA_HIST_WR_CONTROL view. Every 100
exec dbms_workload_repository.modify_snapshot_settings(TOPNSQL=>100);
-- Query the current settings:

2. Create and delete snapshots

 

exec dbms_workload_repository.create_snapshot();

exec dbms_workload_repository.drop_snapshot_range(low_snap_id => 10,high_snap_id => 12);

3. Create and manage baselines

exec dbms_workload_repository.create_baseline(start_snap_id => 630,end_snap_id => 635,baseline_name => 'base line'); 

4. Automatically create AWR baselines

alter session set NLS_DATE_FORMAT= 'yyyy-mm-dd hh24:mi:ss'; 

 

  1. sys@ORCL> exec DBMS_WORKLOAD_REPOSITORY.create_baseline_template( -  
  2. >     day_of_week          => 'WEDNESDAY', -  
  3. >     hour_in_day          => 0, -  
  4. >     duration             => 6, -  
  5. >     start_time           => '2013-11-01:00:00:00', -  
  6. >     end_time             => '2013-12-31:06:00:00', -  
  7. >     baseline_name_prefix => 'Batch Baseline ', -  
  8. >     template_name        => 'Batch Template', -  
  9. >     expiration           => 365);  
  10.   
  11. PL/SQL procedure completed successfully.  
  12.   
  13. sys@ORCL> select t.template_name,  
  14.   2         t.template_type,  
  15.   3         t.start_time,  
  16.   4         t.end_time,  
  17.   5         t.day_of_week,  
  18.   6         t.hour_in_day,  
  19.   7         t.duration  
  20.   8    from dba_hist_baseline_template t;  
  21.   
  22. TEMPLATE_NAME                  TEMPLATE_ START_TIME          END_TIME            DAY_OF_WE HOUR_IN_DAY   DURATION  
  23. ------------------------------ --------- ------------------- ------------------- --------- ----------- ----------  
  24. Batch Template                 REPEATING 2013-11-01 00:00:00 2013-12-31 06:00:00 WEDNESDAY           0          6 

 

day_of_week: The day or week at which the baseline repeats. Specify one of the following values:('SUNDAY', 'MONDAY', 'TUESDAY', 'WEDNESDAY','THURSDAY', 'FRIDAY', 'SATURDAY', 'ALL')
hour_in_day: 0-23, execute baseline at this hours start.
duration: Duration (hours).
start_time: The start time of creating the baseline.
end_time: The end time when the baseline was created.
expiration : The number of days after which the baseline expires.

For the template above, a fixed baseline will be created every Wednesday based on a time window of 0:00 to 6:00 am.

 

 

--------------------------------------------------------------------------------------------------------------------------

     

 

 

2. Database Consultant Framework

0.11G consultant system

    ADDM

   memory advisor

   SQL Access Advisor

    Automatically revoke segment advisors

    MTTR Consultants

    Data Recovery Consultant

 Duan Consultant

1、ADDM

  Once AWR is generated, ADDM will be automatically generated and retained for 30 days.

2. Other consultants

   memory advisor

   SQL Access Advisor

    Automatically revoke segment advisors

    MTTR Consultants

    Data Recovery Consultant

3. Automatic maintenance work

        There are three tasks that are automatically maintained: Gather Statistics, Segment Advisor, and SQL Advisor. These three run automatically but adjustments and recommendations must be accepted manually. 4 hours at 22:00 on weekdays. It runs 22 hours Saturday and Sunday at 6am.

-------------------------------------------------------------------------------
1: Enable and disable maintenance tasks:
Use the DBMS_AUTO_ADMIN pl/sql package to enable or disable tasks:
禁用任务:
BEGIN
dbms_auto_task_admin.disable(
    client_name => 'sql tuning advisor',
    operation   => NULL,
    window_name => NULL);
END;
启用任务:
BEGIN
dbms_auto_task_admin.enable(
    client_name => 'sql tuning advisor',
    operation   => NULL,
    window_name => NULL);
END;

------------------------------------------------------------

3. Generate an alert system

MMNON raises alarm

Find in DBA_ALERT_HISTORY

To be added

 

 

https://blog.csdn.net/zq9017197/article/details/12882227

http://czmmiao.iteye.com/blog/2061833

https://www.linuxidc.com/Linux/2015-01/111926.htm

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325623803&siteId=291194637