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
Oracleawr quick query
1.View the currentAWRSave Policy
Select * From dba_hist_wr_control;
Dbid, snap_interval, retention, topnsql
860524039, + 00 01:00:00. 000000, + 07 00:00:00. 000000, default
The above result indicates that a snapshot is generated every hour and is retained for 7 days.
2.AdjustmentAWRConfiguration
AWR configurations are all configured through the dbms_workload_repository package.
2.1AdjustmentAWRGenerateSnapshotFrequency and retention policyFor example, change the collection interval to 30 minutes. And keep the time for 5 days (note: the unit is minutes ):
Exec dbms_workload_repository.modify_snapshot_settings (interval => 30, retention => 5*24*60 );
2.2CloseAWR,SetIntervalSet0Disable Automatic snapshot capture
Exec dbms_workload_repository.modify_snapshot_settings (interval => 0, retention => 5*24*60 );
2.3Create a snapshot manually
Exec dbms_workload_repository.create_snapshot ();
2.4View snapshots
Select * From SYS. wrh $ _ active_session_history
2.5Manually delete snapshots of a specified range
Exec workload_repository.drop_snapshot_range (low_snap_id => 22, high_snap_id => 32, dbid => 3310949047 );
2.6CreateBaseline
Exec dbms_workload_repository.create_baseline (56,59, 'apply _ interest_1 ')
2.7DeleteBaseline
Exec dbms_workload_repository.drop_baseline (baseline_name => 'apply_interest_1 ', cascade => false );
3.ProductionAWRReport
@ $ ORACLE_HOME/rdbms/admin/awrrpt. SQL
Follow the script prompts to select the report type, report statistics days, start statistics, and end statistics snapshot numbers.
As follows:
The directory where the exported file is located when sqlplus is executed.