Database Statistics
Restore
-- View historic table stats for the problematic tables
SELECT table_name, stats_update_time FROM ALL_TAB_STATS_HISTORY
WHERE OWNER = 'SCANPRD1' AND TABLE_NAME in ('DM_SYSOBJECT_R','DM_SYSOBJECT_S')
ORDER BY TABLE_NAME, STATS_UPDATE_TIME;
-- Restore previous database stats for the 2 tables
BEGIN
dbms_stats.restore_table_stats('SCANPRD1','DM_SYSOBJECT_S',TO_DATE('01-MAY-2015 08:00','DD-MON-YYYY HH24:MI'));
dbms_stats.restore_table_stats('SCANPRD1','DM_SYSOBJECT_R',TO_DATE('01-MAY-2015 08:00','DD-MON-YYYY HH24:MI'));
END;
/
Pending
-- Using the Pending Statistics feature, change the settings
-- so that any new statistics do not get published automatically
BEGIN
dbms_stats.set_table_prefs('SCANPRD1','DM_SYSOBJECT_S','PUBLISH','false');
dbms_stats.set_table_prefs('SCANPRD1','DM_SYSOBJECT_R','PUBLISH','false');
END;
/
Export
BEGIN
dbms_stats.create_stat_table(ownname => 'SCANPRD1', stattab => 'STATISTICS_TABLE');
END;
/
BEGIN
dbms_stats.export_table_stats(ownname => 'SCANPRD1', stattab => 'STATISTICS_TABLE', tabname => 'DM_SYSOBJECT_S', statid => 'CURRENT_STATS');
dbms_stats.export_table_stats(ownname => 'SCANPRD1', stattab => 'STATISTICS_TABLE', tabname => 'DM_SYSOBJECT_R', statid => 'CURRENT_STATS');
END;
/