Thursday, 5 March 2015

WRI$_OPTSTAT_HISTHEAD_HISTORY and WRI$_OPTSTAT_HISTGRM_HISTORY are not purged.

After dropping AWR by running catnoawr.sql,The size of WRI$_OPTSTAT_HISTHEAD_HISTORY and WRI$_OPTSTAT_HISTGRM_HISTORY are not reduced even after running dbms_stats.purge_stats(sysdate-i).

++ Purge all option giving below error.

SQL> exec DBMS_STATS.PURGE_STATS(DBMS_STATS.PURGE_ALL)
BEGIN DBMS_STATS.PURGE_STATS(DBMS_STATS.PURGE_ALL); END;

*
ERROR at line 1:
ORA-06550: line 1, column 41:
PLS-00302: component 'PURGE_ALL' must be declared
ORA-06550: line 1, column 7:
PL/SQL: Statement ignored 



Quick Solution:

Truncate the tables after droping AWR
sqlplus /nolog
connect / as sysdba
@?/rdbms/admin/catnoawr  --> Drop AWR
SQL> truncate table WRI$_OPTSTAT_HISTHEAD_HISTORY; --> truncate the table's
SQL> truncate table WRI$_OPTSTAT_HISTGRM_HISTORY;

@?/rdbms/admin/catawrtb --> Create AWR
startup force
exec dbms_workload_repository.create_snapshot;
wait for 5 min

exec dbms_workload_repository.create_snapshot; 

No comments: