关于fast_start_mttr_target设置对v$Log的影响

SQL> select target_mttr,estimated_mttr from v$instance_recovery;

TARGET_MTTR ESTIMATED_MTTR
----------- --------------
          0             58

SQL> select mttr_target_for_estimate,dirty_limit,estd_cache_writes,estd_cache_write_factor,estd_total_writes,estd_total_write_factor from v$mttr_target_advice;

no rows selected

SQL> show parameter level;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
audit_syslog_level                   string
plsql_optimize_level                 integer     2
statistics_level                     string      TYPICAL
SQL> select recovery_estimated_ios,actual_redo_blks,target_redo_blks,target_mttr,estimated_mttr from v$instance_recovery;

RECOVERY_ESTIMATED_IOS ACTUAL_REDO_BLKS TARGET_REDO_BLKS TARGET_MTTR
---------------------- ---------------- ---------------- -----------
ESTIMATED_MTTR
--------------
                 17760            45967           282896           0
            58


SQL> set line 180
SQL> r
  1* select recovery_estimated_ios,actual_redo_blks,target_redo_blks,target_mttr,estimated_mttr from v$instance_recovery

RECOVERY_ESTIMATED_IOS ACTUAL_REDO_BLKS TARGET_REDO_BLKS TARGET_MTTR ESTIMATED_MTTR
---------------------- ---------------- ---------------- ----------- --------------
                 17809            46161           283124           0             58

SQL> select mttr_target_for_estimate,dirty_limit,estd_cache_writes,estd_cache_write_factor,estd_total_writes,estd_total_write_factor from v$mttr_target_advice;

no rows selected

SQL> alter system set fast_start_mttr_target=60;
  2  ^C

SQL> alter system set fast_start_mttr_target=60;

System altered.

SQL> select mttr_target_for_estimate,dirty_limit,estd_cache_writes,estd_cache_write_factor,estd_total_writes,estd_total_write_factor from v$mttr_target_advice;

no rows selected

SQL> set linesize 160
SQL> column "Low RBA" format a20
SQL> column "On disk RBA" format a20
SQL> select CPDRT,
  2         CPLRBA_SEQ || '.' || CPLRBA_BNO || '.' || CPLRBA_BOF "Low RBA",
  3         CPODR_SEQ || '.' || CPODR_BNO || '.' || CPODR_BOF "On disk RBA",
  4         CPODS, CPODT, CPHBT
  5    from x$kcccp;

     CPDRT Low RBA              On disk RBA          CPODS            CPODT                     CPHBT
---------- -------------------- -------------------- ---------------- -------------------- ----------
     17391 13822.448221.0       13822.493556.0       6641450382       04/17/2024 16:45:21  1166056735
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0

8 rows selected.

SQL> /

     CPDRT Low RBA              On disk RBA          CPODS            CPODT                     CPHBT
---------- -------------------- -------------------- ---------------- -------------------- ----------
     17494 13822.452750.0       13822.498426.0       6641458957       04/17/2024 16:45:51  1166056745
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0

8 rows selected.

SQL> set time on
16:46:05 SQL> /

     CPDRT Low RBA              On disk RBA          CPODS            CPODT                     CPHBT
---------- -------------------- -------------------- ---------------- -------------------- ----------
     17506 13822.455119.0       13822.500813.0       6641463151       04/17/2024 16:46:06  1166056750
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0

8 rows selected.

16:46:07 SQL> select * from v$Log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME          NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------------- ------------ -------------------
         1          1      13817 2147483648        512          1 NO  INACTIVE            6620805996 2024-04-16 17:23:38   6621004563 2024-04-16 17:42:00
         2          1      13819 2147483648        512          1 NO  INACTIVE            6622554195 2024-04-16 19:31:38   6628323059 2024-04-17 01:08:49
         3          1      13815 2147483648        512          1 NO  INACTIVE            6610822347 2024-04-16 15:20:51   6616302901 2024-04-16 16:25:58
         4          1      13818 2147483648        512          1 NO  INACTIVE            6621004563 2024-04-16 17:42:00   6622554195 2024-04-16 19:31:38
         5          1      13822 2147483648        512          1 NO  CURRENT             6640621360 2024-04-17 15:46:24   2.8147E+14
         6          1      13814 2147483648        512          1 NO  INACTIVE            6605322584 2024-04-16 14:15:25   6610822347 2024-04-16 15:20:51
         7          1      13816 2147483648        512          1 NO  INACTIVE            6616302901 2024-04-16 16:25:58   6620805996 2024-04-16 17:23:38
         8          1      13820 2147483648        512          1 NO  INACTIVE            6628323059 2024-04-17 01:08:49   6634473315 2024-04-17 08:55:29
         9          1      13821 2147483648        512          1 NO  INACTIVE            6634473315 2024-04-17 08:55:29   6640621360 2024-04-17 15:46:24

9 rows selected.

16:46:15 SQL> set linesize 160
16:46:33 SQL> column "Low RBA" format a20
16:46:33 SQL> column "On disk RBA" format a20
16:46:33 SQL> select CPDRT,
16:46:33   2         CPLRBA_SEQ || '.' || CPLRBA_BNO || '.' || CPLRBA_BOF "Low RBA",
16:46:33   3         CPODR_SEQ || '.' || CPODR_BNO || '.' || CPODR_BOF "On disk RBA",
16:46:33   4         CPODS, CPODT, CPHBT
16:46:33   5    from x$kcccp;

     CPDRT Low RBA              On disk RBA          CPODS            CPODT                     CPHBT
---------- -------------------- -------------------- ---------------- -------------------- ----------
     17503 13822.459175.0       13822.505009.0       6641470547       04/17/2024 16:46:34  1166056759
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0

8 rows selected.

16:46:34 SQL> /

     CPDRT Low RBA              On disk RBA          CPODS            CPODT                     CPHBT
---------- -------------------- -------------------- ---------------- -------------------- ----------
     17547 13822.462361.0       13822.508213.0       6641476157       04/17/2024 16:46:55  1166056766
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0

8 rows selected.

16:46:55 SQL> select mttr_target_for_estimate,dirty_limit,estd_cache_writes,estd_cache_write_factor,estd_total_writes,estd_total_write_factor from v$mttr_target_advice;

MTTR_TARGET_FOR_ESTIMATE DIRTY_LIMIT ESTD_CACHE_WRITES ESTD_CACHE_WRITE_FACTOR ESTD_TOTAL_WRITES ESTD_TOTAL_WRITE_FACTOR
------------------------ ----------- ----------------- ----------------------- ----------------- -----------------------
                      91       30944              9397                       1              9397                       1
                      61       18040              9397                       1              9397                       1
                      22        1266             10008                   1.065             10008                   1.065
                      41        9438              9452                  1.0059              9452                  1.0059
                     150       56750              9397                       1              9397                       1

16:47:09 SQL> select target_mttr,estimated_mttr from v$instance_recovery;

TARGET_MTTR ESTIMATED_MTTR
----------- --------------
         61             58

16:47:30 SQL> /

TARGET_MTTR ESTIMATED_MTTR
----------- --------------
         61             58

16:48:09 SQL> select mttr_target_for_estimate,dirty_limit,estd_cache_writes,estd_cache_write_factor,estd_total_writes,estd_total_write_factor from v$mttr_target_advice;

MTTR_TARGET_FOR_ESTIMATE DIRTY_LIMIT ESTD_CACHE_WRITES ESTD_CACHE_WRITE_FACTOR ESTD_TOTAL_WRITES ESTD_TOTAL_WRITE_FACTOR
------------------------ ----------- ----------------- ----------------------- ----------------- -----------------------
                      91       30944             13122                       1             13122                       1
                      22        1266             14157                  1.0789             14157                  1.0789
                     150       56750             13122                       1             13122                       1
                      61       18040             13122                       1             13122                       1
                      41        9438             13467                  1.0263             13467                  1.0263

16:48:14 SQL> /

MTTR_TARGET_FOR_ESTIMATE DIRTY_LIMIT ESTD_CACHE_WRITES ESTD_CACHE_WRITE_FACTOR ESTD_TOTAL_WRITES ESTD_TOTAL_WRITE_FACTOR
------------------------ ----------- ----------------- ----------------------- ----------------- -----------------------
                      61       18040             15292                       1             15292                       1
                      22        1266             16639                  1.0881             16639                  1.0881
                      41        9438             15819                  1.0345             15819                  1.0345
                      91       30944             15292                       1             15292                       1
                     150       56750             15292                       1             15292                       1

16:48:52 SQL> select recovery_estimated_ios,actual_redo_blks,target_redo_blks,target_mttr,estimated_mttr from v$instance_recovery;

RECOVERY_ESTIMATED_IOS ACTUAL_REDO_BLKS TARGET_REDO_BLKS TARGET_MTTR ESTIMATED_MTTR
---------------------- ---------------- ---------------- ----------- --------------
                 17614            47357           288733          61             58

16:49:29 SQL> /

RECOVERY_ESTIMATED_IOS ACTUAL_REDO_BLKS TARGET_REDO_BLKS TARGET_MTTR ESTIMATED_MTTR
---------------------- ---------------- ---------------- ----------- --------------
                 17441            46288           289350          61             58

16:50:39 SQL> select target_mttr,estimated_mttr from v$instance_recovery;

TARGET_MTTR ESTIMATED_MTTR
----------- --------------
         61             58

16:51:06 SQL> select RECOVERY_ESTIMATED_IOS REIOS,TARGET_MTTR TMTTR,
16:51:54   2        ESTIMATED_MTTR EMTTR,WRITES_MTTR WMTTR,WRITES_OTHER_SETTINGS WOSET,
16:51:54   3        CKPT_BLOCK_WRITES CKPTBW,WRITES_AUTOTUNE WAUTO,WRITES_FULL_THREAD_CKPT WFTCKPT
16:51:54   4       from v$instance_recovery;
 
     REIOS      TMTTR      EMTTR      WMTTR      WOSET     CKPTBW      WAUTO    WFTCKPT
---------- ---------- ---------- ---------- ---------- ---------- ---------- ----------
     17452         61         58       6391          0    1752848   26672376          0

16:51:54 SQL> set linesize 160
16:52:15 SQL> column "Low RBA" format a20
16:52:15 SQL> column "On disk RBA" format a20
16:52:15 SQL> select CPDRT,
16:52:15   2         CPLRBA_SEQ || '.' || CPLRBA_BNO || '.' || CPLRBA_BOF "Low RBA",
16:52:15   3         CPODR_SEQ || '.' || CPODR_BNO || '.' || CPODR_BOF "On disk RBA",
16:52:15   4         CPODS, CPODT, CPHBT
16:52:15   5    from x$kcccp;

     CPDRT Low RBA              On disk RBA          CPODS            CPODT                     CPHBT
---------- -------------------- -------------------- ---------------- -------------------- ----------
     17488 13822.510193.0       13822.559979.0       6641558588       04/17/2024 16:52:16  1166056872
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0
         0 0.0.0                0.0.0                0                                              0

8 rows selected.

16:52:16 SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES  BLOCKSIZE    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME          NEXT_CHANGE# NEXT_TIME
---------- ---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ------------------- ------------ -------------------
         1          1      13817 2147483648        512          1 NO  INACTIVE            6620805996 2024-04-16 17:23:38   6621004563 2024-04-16 17:42:00
         2          1      13819 2147483648        512          1 NO  INACTIVE            6622554195 2024-04-16 19:31:38   6628323059 2024-04-17 01:08:49
         3          1      13815 2147483648        512          1 NO  INACTIVE            6610822347 2024-04-16 15:20:51   6616302901 2024-04-16 16:25:58
         4          1      13818 2147483648        512          1 NO  INACTIVE            6621004563 2024-04-16 17:42:00   6622554195 2024-04-16 19:31:38
         5          1      13822 2147483648        512          1 NO  CURRENT             6640621360 2024-04-17 15:46:24   2.8147E+14
         6          1      13814 2147483648        512          1 NO  INACTIVE            6605322584 2024-04-16 14:15:25   6610822347 2024-04-16 15:20:51
         7          1      13816 2147483648        512          1 NO  INACTIVE            6616302901 2024-04-16 16:25:58   6620805996 2024-04-16 17:23:38
         8          1      13820 2147483648        512          1 NO  INACTIVE            6628323059 2024-04-17 01:08:49   6634473315 2024-04-17 08:55:29
         9          1      13821 2147483648        512          1 NO  INACTIVE            6634473315 2024-04-17 08:55:29   6640621360 2024-04-17 15:46:24

9 rows selected.

16:52:28 SQL> 

相关参考:

重做日志全部ACTIVE故障诊断处理

Oracle FAST_START_MTTR_TARGET参数的理解-CSDN博客

|---------------------------------------------------------------------------------------|
| Initialization Parameter FAST_START_MTTR_TARGET and Related Issues (Doc ID 2673186.1) |

|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| Purpose |

|---|-------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | Questions and Answers |

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | 1. FAST_START_MTTR_TARGET Initialization Parameter- Explanation |

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | 2. Impact of FAST_START_MTTR_TARGET parameter |

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | 3. How to find the optimal value for FAST_START_MTTR_TARGET parameter |

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | 4. FAST_START_MTTR_TARGET parameter and MTTR Advisory |

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | 5. FAST_START_MTTR_TARGET <x> is set too low, using minimum achievable MTTR <n> instead |

|---|----------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | 6. ORA-02097 and ORA-00439 reported while setting FAST_START_MTTR_TARGET parameter. |

|---|------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------|
| | 7. ORA-02097 and ORA-25530 reported while setting STATISTICS_LEVEL to ALL or TYPICAL |


APPLIES TO:

Oracle Database - Enterprise Edition - Version 9.2.0.8 and later

Information in this document applies to any platform.

PURPOSE

This document is a one-stop solution for all queries related to FAST_START_MTTR_TARGET initialization parameter. The details such as the impact of the parameter, how to set it and related issues are all discussed here.

QUESTIONS AND ANSWERS

1. FAST_START_MTTR_TARGET Initialization Parameter- Explanation

FAST_START_MTTR_TARGET initialization parameter enables Fast-Start Fault Recovery feature, which reduces the time required for cache recovery. Fast-Start Fault Recovery is implemented through Fast-Start checkpointing architecture (incremental checkpointing instead of the conventional event-driven ie, log switching checkpointing). In other words, FAST_START_MTTR_TARGET specifies a target for the expected mean time to recover (MTTR), that is, the time (in seconds) that it should take to start up the instance and perform cache recovery.

After FAST_START_MTTR_TARGET is set, the database manages incremental checkpoint writes in an attempt to meet that target. If you have chosen a practical value for FAST_START_MTTR_TARGET, you can expect your database to recover, on average, in approximately the number of seconds you have chosen.

You can set the parameter as follows:

SQL> ALTER SYSTEM SET FAST_START_MTTR_TARGET=<x> SCOPE=BOTH;

V$INSTANCE_RECOVERY.ESTIMATED_MTTR shows the current estimated mean time to recover (MTTR) in seconds. This value is shown even if FAST_START_MTTR_TARGET is not specified.

V$INSTANCE_RECOVERY.TARGET_MTTR shows the effective MTTR target in seconds enforced by the system.

You must disable or remove the initialization parameters FAST_START_IO_TARGET, LOG_CHECKPOINT_INTERVAL, and LOG_CHECKPOINT_TIMEOUT when using FAST_START_MTTR_TARGET. Setting these parameters interferes with the mechanisms used to manage cache recovery time to meet FAST_START_MTTR_TARGET.

2. Impact of FAST_START_MTTR_TARGET parameter

Frequent checkointing is requied to minimize the duration of cache recovery. However, in a high-update system, frequent checkpointing increases the overhead for normal database operations. Hence, it is important to find the optimal value for FAST_START_MTTR_TARGET parameter to tune the cache recovery time without compromising the performance.

If daily operational efficiency is more important than minimizing recovery time, then decrease the frequency of writes to data files due to checkpoints. This should improve operational efficiency, but also increase cache recovery time. In such cases, you can

  1. Set FAST_START_MTTR_TARGET to 3600. This enables Fast-Start checkpointing , but minimizes its effect on run-time performance.
  2. Increase the size your online redo log files such that the log switching happens only once in every twenty minutes. Having your log files too small can increase checkpoint activity and reduce performance. Ensure to have same size for all redo log file members.

3. How to find the optimal value for FAST_START_MTTR_TARGET parameter

To find the optimal value for FAST_START_MTTR_TARGET, first you need to identify the possible range of values for your database. For that, you can set FAST_START_MTTR_TARGET to 1 and ntoe down the V$INSTANCE_RECOVERY.TARGET_MTTR value. This will be the lower boundary.

SQL> SELECT TARGET_MTTR, ESTIMATED_MTTR FROM V$INSTANCE_RECOVERY;

Repeat this steps by setting FAST_START_MTTR_TARGET to 3600 to get the upper boundary. Ensure to run a sample workload before restarting the database.

Once you get the lower and upper boundaries for your database (which depends on the database workload), you can choose the value within this range. You might have to test multiple values to find the optimal one.

4. FAST_START_MTTR_TARGET parameter and MTTR Advisory

Setting FAST_START_MTTR_TARGET parameter to a non-zero value and STATISTICS_LEVEL to TYPICAL or ALL will enable the MTTR Advisory. You can query V$MTTR_TARGET_ADVICE view to check the statistics or advisories collected by MTTR Advisor.

5. FAST_START_MTTR_TARGET <x> is set too low, using minimum achievable MTTR <n> instead

You might observe the following messages being reported in the alert.log:

复制代码
...
复制代码
Sat Mar 02 16:39:30 2019
复制代码
fast_start_mttr_target 300 is set too low, using minimum achievable MTTR 1973 instead.
复制代码
..

This is reported when the value set for FAST_START_MTTR_TARGET parameter is too low, below the lowest possible value. Please refer the steps mentioned in the above section (3. How to find the optimal value for FAST_START_MTTR_TARGET parameter) to determine the optimal value for the parameter.

6. ORA-02097 and ORA-00439 reported while setting FAST_START_MTTR_TARGET parameter.

复制代码
ORA-02097&nbsp;parameter cannot be modified because specified value is invalid.
复制代码
ORA-439&nbsp;feature not enabled: %s

Fast-start fault recovery is only available in Enterprise Edition Database version. The above errors will be reported if FAST_START_MTTR_TARGET parameter is set in Standard Edition.

7. ORA-02097 and ORA-25530 reported while setting STATISTICS_LEVEL to ALL or TYPICAL

Following error is reported in the alert log file while setting STATISTICS_LEVEL = 'ALL' or STATISTICS_LEVEL = 'TYPICAL'

复制代码
..
Could not change the status of MTTR Advice because of error 2097
复制代码
ORA-02097: parameter cannot be modified because specified value is invalid
复制代码
ORA-25530: FAST_START_MTTR_TARGET is not specified
复制代码
ALTER SYSTEM SET statistics_level='ALL' SCOPE=BOTH;
..

This is expected behavior when FAST_START_MTTR_TARGET is not set or set to 0.

When changing the STATISTICS_LEVEL parameter at system level, all the advisors that are affected by this parameter are restarted. As the MTTR Advisor is not started/enabled the errors are raised because its statistics level cannot be changed.

You can ignore the errors if you do not intend to enable MTTR advisory. If you want to enable MTTR advisory, set FAST_START_MTTR_TARGET to a non-zero value. Please refer the steps mentioned in the above section (3. How to find the optimal value for FAST_START_MTTR_TARGET parameter) to determine the optimal value for the parameter.

相关推荐
bug菌¹2 小时前
滚雪球学Oracle[4.2讲]:PL/SQL基础语法
数据库·oracle
逸巽散人2 小时前
SQL基础教程
数据库·sql·oracle
月空MoonSky3 小时前
Oracle中TRUNC()函数详解
数据库·sql·oracle
全栈师5 小时前
SQL Server中关于个性化需求批量删除表的做法
数据库·oracle
bug菌¹6 小时前
滚雪球学Oracle[6.2讲]:Data Guard与灾难恢复
数据库·oracle·data·灾难恢复·guard
bug菌¹8 小时前
滚雪球学Oracle[2.5讲]:数据库初始化配置
数据库·oracle·数据库初始化·初始化配置
OLDERHARD17 小时前
Java - MyBatis(上)
java·oracle·mybatis
bug菌¹1 天前
滚雪球学Oracle[1.3讲]:Oracle数据库架构基础
数据库·oracle·数据库架构
bug菌¹2 天前
滚雪球学Oracle[2.1讲]:Oracle数据库安装与配置
数据库·oracle
wdxylb2 天前
MySQL数据库用户权限控制的实现方法
数据库·mysql·oracle