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';
- sys@ORCL> exec DBMS_WORKLOAD_REPOSITORY.create_baseline_template( -
- > day_of_week => 'WEDNESDAY', -
- > hour_in_day => 0, -
- > duration => 6, -
- > start_time => '2013-11-01:00:00:00', -
- > end_time => '2013-12-31:06:00:00', -
- > baseline_name_prefix => 'Batch Baseline ', -
- > template_name => 'Batch Template', -
- > expiration => 365);
- PL/SQL procedure completed successfully.
- sys@ORCL> select t.template_name,
- 2 t.template_type,
- 3 t.start_time,
- 4 t.end_time,
- 5 t.day_of_week,
- 6 t.hour_in_day,
- 7 t.duration
- 8 from dba_hist_baseline_template t;
- TEMPLATE_NAME TEMPLATE_ START_TIME END_TIME DAY_OF_WE HOUR_IN_DAY DURATION
- ------------------------------ --------- ------------------- ------------------- --------- ----------- ----------
- 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.
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