oracle 10g awr安装
SQL> SQLPLUS / AS SYSDBA
SQL> exec dbms_workload_repository.create_snapshot
SQL> exec:snap_id:=dbms_workload_repository.create_snapshot
SQL> var snap_id number
SQL> print snap_id
SQL> @?/rdbms/admin/awrrpt.sql
Oracle AWR速查
1.查看当前的AWR保存策略
select * from dba_hist_wr_control;
DBID,SNAP_INTERVAL,RETENTION,TOPNSQL
860524039,+00 01:00:00.000000,+07 00:00:00.000000,DEFAULT
以上结果表示,每小时产生一个SNAPSHOT,保留7天
2.调整AWR配置
AWR配置都是通过dbms_workload_repository包进行配置
2.1调整AWR产生snapshot的频率和保留策略,如:如将收集间隔时间改为30 分钟一次。并且保留5天时间(注:单位都是为分钟):
exec dbms_workload_repository.modify_snapshot_settings(interval=>30, retention=>5*24*60);
2.2关闭AWR,把interval设为0则关闭自动捕捉快照
2.3手工创建一个快照
exec DBMS_WORKLOAD_REPOSITORY.CREATE_SNAPSHOT ();
2.4 查看快照
select * from sys.wrh$_active_session_history
2.5手工删除指定范围的快照
exec WORKLOAD_REPOSITORY.DROP_SNAPSHOT_RANGE(low_snap_id => 22, high_snap_id => 32, dbid => 3310949047);
2.6创建baseline
exec dbms_workload_repository.create_baseline (56,59,'apply_interest_1')
2.7删除baseline
exec DBMS_WORKLOAD_REPOSITORY.DROP_BASELINE(baseline_name => ' apply_interest_1', cascade => FALSE);
3.生产AWR报告
$ORACLE_HOME/rdbms/admin/awrrpt.sql