1. 程式人生 > >修改AWR報告裡面的topnsql 引數

修改AWR報告裡面的topnsql 引數

檢視: dba_hist_wr_control 

修改awr相關引數 ,本次主要修改topnsql ,該值預設是30。

[email protected]>exec dbms_workload_repository.modify_snapshot_settings(topnsql => 100);

PL/SQL 過程已成功完成。

[email protected]>exec dbms_workload_repository.modify_snapshot_settings(topnsql => 10);
BEGIN dbms_workload_repository.modify_snapshot_settings(topnsql => 10); END;

*
第 1 行出現錯誤:
ORA-13530: TOPNSQL 10 無效, 必須在 (30, 50000) 範圍內
ORA-06512: 在 "SYS.DBMS_WORKLOAD_REPOSITORY", line 174
ORA-06512: 在 "SYS.DBMS_WORKLOAD_REPOSITORY", line 222
ORA-06512: 在 line 1


[email protected]
>exec dbms_workload_repository.modify_snapshot_settings(topnsql => 30); PL/SQL 過程已成功完成。 [email protected]>exec dbms_workload_repository.modify_snapshot_settings(topnsql => 'DEFAULT'); PL/SQL 過程已成功完成。 [email protected]>

參考文件:

https://docs.oracle.com/cd/E11882_01/appdev.112/e40758/d_workload_repos.htm#ARPLS69140

Table 162-29 MODIFY_SNAPSHOT_SETTINGS Procedure Parameters

Parameter Description

retention

New retention time (in minutes). The specified value must be in the range of MIN_RETENTION (1 day) to MAX_RETENTION (100 years).

If ZERO is specified, snapshots will be retained forever. A large system-defined value will be used as the retention setting.

If NULL is specified, the old value for retention is preserved.

NOTE: The retention setting must be greater than or equal to the window size of the 'SYSTEM_MOVING_WINDOW' baseline. If the retention needs to be less than the window size, the MODIFY_BASELINE_WINDOW_SIZE Procedure can be used to adjust the window size.

interval

New interval setting between each snapshot, in units of minutes. The specified value must be in the range MIN_INTERVAL (10 minutes) to MAX_INTERVAL (1 year).

If ZERO is specified, automatic and manual snapshots will be disabled. A large system-defined value will be used as the retention setting.

If NULL is specified, the current value is preserved.

topnsql

  • If NUMBER: Top N SQL size. The number of Top SQL to flush for each SQL criteria (Elapsed Time, CPU Time, Parse Calls, Shareable Memory, Version Count). The value for this setting will not be affected by the statistics/flush level and will override the system default behavior for the AWR SQL collection. The setting will have a minimum value of 30 and a maximum value of 50,000. Specifying NULL will keep the current setting.

  • If VARCHAR2: Users are allowed to specify the following values: (DEFAULT, MAXIMUM, N), where N is the number of Top SQL to flush for each SQL criteria. Specifying DEFAULT will revert the system back to the default behavior of Top 30 for statistics level TYPICAL and Top 100 for statistics level ALL. Specifying MAXIMUM will cause the system to capture the complete set of SQL in the cursor cache. Specifying the number N is equivalent to setting the Top N SQL with the NUMBER type. Specifying NULL for this argument will keep the current setting.

dbid

Database identifier in AWR for which to modify the snapshot settings. If NULL is specified, the local dbid will be used. Defaults to NULL.

 

Examples

This example changes the interval setting to one hour and the retention setting to two weeks for the local database:

EXECUTE DBMS_WORKLOAD_REPOSITORY.MODIFY_SNAPSHOT_SETTINGS(
  interval  =>  60,
  retention =>  20160);

If you query the DBA_HIST_WR_CONTROL table after this procedure is executed, you will see the changes to these settings.

 

 

END。