Which action would help to use the previous set of statistics on the objects?

You have recently collected statistics on certain objects of a schema in your database. But you
observe suboptimal execution plans for the queries on these objects after two days of statistics
collection. The optimizer statistics retention period is set to its default value. Which action would
help to use the previous set of statistics on the objects?

You have recently collected statistics on certain objects of a schema in your database. But you
observe suboptimal execution plans for the queries on these objects after two days of statistics
collection. The optimizer statistics retention period is set to its default value. Which action would
help to use the previous set of statistics on the objects?

A.
Restore statistics from statistics history.

B.
Reduce the optimizer statistics retention period by 2 days.

C.
Set the OPTIMIZER_PENDING_STATISTICS parameter to TRUE.

D.
Reduce the Automatic Workload Repository (AWR) retention period by 2 days.



Leave a Reply 3

Your email address will not be published. Required fields are marked *


KUMAR

KUMAR

ANSWER IS: A Restore statistics from statistics history.

EXPLANATION

RESTORE_TABLE_STATS Procedure

This procedure restores statistics of a table as of a specified timestamp (as_of_timestamp). The procedure will restore statistics of associated indexes and columns as well. If the table statistics were locked at the specified timestamp the procedure will lock the statistics. The procedure will not restore user defined statistics.
Syntax
DBMS_STATS.RESTORE_TABLE_STATS (
ownname VARCHAR2,
tabname VARCHAR2,
as_of_timestamp TIMESTAMP WITH TIME ZONE,
restore_cluster_index BOOLEAN DEFAULT FALSE,
force BOOLEAN DEFAULT FALSE,
no_invalidate BOOLEAN DEFAULT to_no_invalidate_type
(GET_PARAM(‘NO_INVALIDATE’)));

SQL>
SQL> BEGIN
2 dbms_stats.gather_table_stats(ownname => USER, tabname => ‘EMP’);
3 END;
4 /
PL/SQL procedure successfully completed

SQL> /
PL/SQL procedure successfully completed

SQL> col table_name a10
SQL> SELECT OWNER,TABLE_NAME,STATS_UPDATE_TIME FROM Dba_Tab_Stats_History WHERE owner = ‘TEST’;
OWNER TABLE_NAME STATS_UPDATE_TIME
—— —————————— ——————————————————————————–
TEST EMP 11-JUN-14 05.54.56.234000 PM +08:00
TEST EMP 11-JUN-14 05.54.56.781000 PM +08:00
2 rows selected

jean

jean

OPTIMIZER_USE_PENDING_STATISTICS specifies whether or not the optimizer uses pending statistics when compiling SQL statements.

ALL_TAB_STATS_HISTORY provides a history of table statistics modifications for all tables accessible to the current user.