本文主要是介绍Restoring Table Statistics (Doc ID 452011.1),希望对大家解决编程问题提供一定的参考价值,需要的开发者们随着小编来一起学习吧!
In this Document
Purpose |
Scope |
Details |
How long does Oracle retain the statistics for ? |
How do I know how many days the statistics are available for ? |
How do I find the statistics history for a given table ? |
How do I restore the statistics ? |
APPLIES TO:
Oracle Database - Enterprise Edition - Version 10.1.0.2 and laterOracle Database - Standard Edition - Version 10.1.0.2 and later
Oracle Database - Personal Edition - Version 10.1.0.2 and later
Information in this document applies to any platform.
PURPOSE
This document outlines the facility by which statistics may be restored following their removal. This facility is available from Orale 10g onwards.
SCOPE
Assist with restoring statistics in the event that they are overwritten.
DETAILS
Beginning with Oracle10G, when statistics are gathered for a table, the old statistics are retained so should
there be any problem with performance of queries dependent on those statistics, the old ones can be restored.
How long does Oracle retain the statistics for ?
The default period for which statistics are retained is 31 days but this can be altered with:-
- where xx is the number of days to retain them
How do I know how many days the statistics are available for ?
- will return the number of days stats are currently retained for.
- will return the date statistics have been purged up to (so only dates newer then this can possibly be restored to). Any request to restore stats from this date or older will fail with: "ORA-20006: Unable to restore statistics , statistics history not available"
How do I find the statistics history for a given table ?
Will show the times statistics were regathered for a given table.
How do I restore the statistics ?
Having decided what date you know the statistics were good for, you can use:-
execute DBMS_STATS.RESTORE_DATABASE_STATS(date)
execute DBMS_STATS.RESTORE_DICTIONARY_STATS(date)
execute DBMS_STATS.RESTORE_FIXED_OBJECTS_STATS(date)
execute DBMS_STATS.RESTORE_SCHEMA_STATS('owner',date)
execute DBMS_STATS.RESTORE_SYSTEM_STATS(date)
ie
这篇关于Restoring Table Statistics (Doc ID 452011.1)的文章就介绍到这儿,希望我们推荐的文章对编程师们有所帮助!