41.You have recently collected statistics on certain objects of a schema in your database. But you o
2016-07-21 16:54
781 查看
41.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.
答案:A
解析:题目说的是,优化器收集统计信息的周期为默认值,最近你在一个schema的object上收集了统计信息,但是发现
对于查询的执行计划不如之前的不太好,你应该怎么做
A:从统计信息历史记录中restore
B:减少统计信息的保留时间
C:设置OPTIMIZER_PENDING_STATISTICS为true
D:减少awr的保留时间
从这里可以看出应该选择A,那A是干啥的
SQL> select to_char(stats_update_time,'yyyy-mm-dd hh24:mi:ss') FROM DBA_TAB_STATS_HISTORY where owner = 'SCOTT' and table_name = 'SALES';
TO_CHAR(STATS_UPDAT
-------------------
2016-07-17 09:20:14
2016-07-15 22:00:20
SQL> select to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') from dba_tables where table_name = 'SALES' and owner = 'SCOTT';
TO_CHAR(LAST_ANALYZ
-------------------
2016-07-17 09:20:14
SQL> exec dbms_stats.restore_table_stats('SCOTT', 'SALES', TO_DATE('2016-07-15 22:00:20', 'yyyy-mm-dd hh24:mi:ss'));
PL/SQL procedure successfully completed.
SQL> select to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') from dba_tables where table_name = 'SALES' and owner = 'SCOTT';
TO_CHAR(LAST_ANALYZ
-------------------
--查看统计信息保存的时间
select DBMS_STATS.GET_STATS_HISTORY_RETENTION from dual;
--这里为啥没有恢复回去
SQL> exec dbms_stats.gather_table_stats('SCOTT', 'SALES', cascade=>true);
PL/SQL procedure successfully completed.
---收集一下信息我们在来一次
SQL> select to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') from dba_tables where table_name = 'SALES' and owner = 'SCOTT';
TO_CHAR(LAST_ANALYZ
-------------------
2016-07-17 21:20:59
SQL> select to_char(stats_update_time,'yyyy-mm-dd hh24:mi:ss') FROM DBA_TAB_STATS_HISTORY where owner = 'SCOTT' and table_name = 'SALES';
TO_CHAR(STATS_UPDAT
-------------------
2016-07-17 21:20:59 --这个是gather_table_stats
2016-07-17 09:20:14 --这个是restore_table_stats
2016-07-17 17:51:41
2016-07-15 22:00:20
--再来执行一次
SQL> exec dbms_stats.restore_table_stats('SCOTT', 'SALES', '15-JUL-16 10.00.20.846989 PM +08:00',force=>true);
PL/SQL procedure successfully completed.
SQL> select to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') from dba_tables where table_name = 'SALES' and owner = 'SCOTT';
TO_CHAR(LAST_ANALYZ
-------------------
2016-07-17 09:16:33
--但是这里为啥显示的是这个时间就不知道了
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.
答案:A
解析:题目说的是,优化器收集统计信息的周期为默认值,最近你在一个schema的object上收集了统计信息,但是发现
对于查询的执行计划不如之前的不太好,你应该怎么做
A:从统计信息历史记录中restore
B:减少统计信息的保留时间
C:设置OPTIMIZER_PENDING_STATISTICS为true
D:减少awr的保留时间
从这里可以看出应该选择A,那A是干啥的
SQL> select to_char(stats_update_time,'yyyy-mm-dd hh24:mi:ss') FROM DBA_TAB_STATS_HISTORY where owner = 'SCOTT' and table_name = 'SALES';
TO_CHAR(STATS_UPDAT
-------------------
2016-07-17 09:20:14
2016-07-15 22:00:20
SQL> select to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') from dba_tables where table_name = 'SALES' and owner = 'SCOTT';
TO_CHAR(LAST_ANALYZ
-------------------
2016-07-17 09:20:14
SQL> exec dbms_stats.restore_table_stats('SCOTT', 'SALES', TO_DATE('2016-07-15 22:00:20', 'yyyy-mm-dd hh24:mi:ss'));
PL/SQL procedure successfully completed.
SQL> select to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') from dba_tables where table_name = 'SALES' and owner = 'SCOTT';
TO_CHAR(LAST_ANALYZ
-------------------
--查看统计信息保存的时间
select DBMS_STATS.GET_STATS_HISTORY_RETENTION from dual;
--这里为啥没有恢复回去
SQL> exec dbms_stats.gather_table_stats('SCOTT', 'SALES', cascade=>true);
PL/SQL procedure successfully completed.
---收集一下信息我们在来一次
SQL> select to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') from dba_tables where table_name = 'SALES' and owner = 'SCOTT';
TO_CHAR(LAST_ANALYZ
-------------------
2016-07-17 21:20:59
SQL> select to_char(stats_update_time,'yyyy-mm-dd hh24:mi:ss') FROM DBA_TAB_STATS_HISTORY where owner = 'SCOTT' and table_name = 'SALES';
TO_CHAR(STATS_UPDAT
-------------------
2016-07-17 21:20:59 --这个是gather_table_stats
2016-07-17 09:20:14 --这个是restore_table_stats
2016-07-17 17:51:41
2016-07-15 22:00:20
--再来执行一次
SQL> exec dbms_stats.restore_table_stats('SCOTT', 'SALES', '15-JUL-16 10.00.20.846989 PM +08:00',force=>true);
PL/SQL procedure successfully completed.
SQL> select to_char(last_analyzed,'yyyy-mm-dd hh24:mi:ss') from dba_tables where table_name = 'SALES' and owner = 'SCOTT';
TO_CHAR(LAST_ANALYZ
-------------------
2016-07-17 09:16:33
--但是这里为啥显示的是这个时间就不知道了
相关文章推荐
- 2.Which two statements are true about the Automatic Workload Repository (AWR)
- 3.While observing the index statistics, you find that an index is highly fragmented, thereby resulti
- 4.Your test database is running in NOARCHIVELOG mode. Which statement is true regarding the type of
- 5.The database instance is currently using SPFILE. View the Exhibit and examine the error that you
- 6.Note the following points describing various utilities in Oracle Database 11g:
- 7.You have issued a SHUTDOWN ABORT command to bring down your database instance. Considerthe steps t
- 8.Observe the information in the columns:
- 9.View the Exhibit and examine the privileges granted to the SL_REP user.
- 10.Examine the following statement that is used to modify the constraint on the SALES table:
- 11.Identify the memory component from which memory may be allocated for:
- 12.Which is the correct description of a pinned buffer in the database buffer cache?
- 13.You have executed this command to change the size of the database buffer cache:
- 14.These are points that describe the contents of different memory components:
- 15.Which two statements are true about Shared SQL Area and Private SQL Area? (Choose two.)
- 16.Note the following functionalities of various background processes:
- 17.Note the functionalities of various background processes:
- 18.View the Exhibit and identify the component marked with a question mark.
- 19.Which two statements about the background process of the database writer are true? (Choose two.)
- 20.You have set Tablespace Full Metrics Threshold values for the USERS tablespace as follows:
- 21.Which three statements are true about logical structures of the Oracle database? (Choose three.)