Oracle AWR quick query

Source: Internet
Author: User

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.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.