oracle MTTR( FAST_START_MTTR_TARGET )

 

首先,什么是 FAST_START_MTTR_TARGET。参数 FAST_START_MTTR_TARGET是指允许 DBA指定数据库进行崩溃恢复需要的秒数。 MTTRmean time to restoration)指平均恢复时间。
         恢复时间取决于读取 log files的时间和处理需要恢复的数据块的时间。参数 log_checkpoint_interval设定了恢复过程中将要被读的重做记录的数目。 fast_start_io_target控制了需要被恢复的数据块数目。然而, DBA可以通过单独设置参数来设置基于秒级的恢复时间限制。 LOG_CHECKPOINT_TIMEOUT限制了上一检查点和最近的重做记录之间的秒数。但他对于设置恢复时间限制来说都是不够精确的!
         所以 Oracle10r2后有了 FAST_START_MTTR_TARGET,实际上这个参数被转化为设置参数 FAST_START_IO_TARGET,LOG_CHECKPOINT_INTERVAL两个参数。这个特性 大大简化了限定数据库恢复时间,并增加了准确性。 ast_start_mttr_target是一个动态参数,可以在线修改。例如: alter system set fast_start_mttr_target =60;
         数据库的恢复有两个步骤, Cache Recovery Transaction Recovery 。首先进行 Cache Recovery 相当于一个 Rolling Forward的过程。即 oracle会应用 redo log文件中所有已经提交或在当机时还未提交的变化 (因为所有变化在写入数据文件前都会先记录到 redo log文件中 )。然后进行 Transaction Recovery 相当于一个 Rolling Back的过程。即为了使数据库达到一致性要求, Oracle会回退 undo tablespaceOracle10g中取消了 rollback segments,因为回滚段管理起来太复杂)中的所有未提交事务。
         Oracle会周期性的记录检查点( checkpoint)。关于 checkpoint
        A checkpoint is the highest system change number (SCN) such that all data blocks less than or equal to that SCN are known to be written out to the data files. If a failure occurs, then only the redo records containing changes at SCNs higher than the checkpoint need to be applied during recovery. The duration of cache recovery processing is determined by two factors: the number of data blocks that have changes at SCNs higher than the SCN of the checkpoint, and the number of log blocks that need to be read to find those changes.
         因为 checkpoint会促使后台进程 DBWn将脏数据写入数据文件,所以频繁的 checkpointing writes有利于大大缩短数据库的恢复时间。但如此频繁的写入操作也会降低数据库的运行性能。如上面所说,这个频度由参数 FAST_START_MTTR_TARGET决定。当 FAST_START_MTTR_TARGET >0时,将会激活 Fast-Start Fault Recovery 功能。关于 Fast-Start Fault Recovery
                  The foundation of Fast-Start Fault Recovery is the Fast-Start checkpointing architecture. Instead of conventional event-driven (that is, log switching) checkpointing, which does bulk writes, fast-start checkpointing occurs incrementally. Each DBWn process periodically writes buffers to disk to advance the checkpoint position. The oldest modified blocks are written first to ensure that every write lets the checkpoint advance. Fast-Start checkpointing eliminates bulk writes and the resultant I/O spikes that occur with conventional checkpointing.
         一旦 FAST_START_MTTR_TARGET被设定成实际可行的值时,那么你的数据库的平均恢复时间会尽量达到该值设定的大小。但有几点需要注意:
1.        当你设定 FAST_START_MTTR_TARGET时必须禁用或者删除 FAST_START_IO_TARGET, LOG_CHECKPOINT_INTERVAL, LOG_CHECKPOINT_TIMEOUT这三个参数。因为这三个参数将会和 FAST_START_MTTR_TARGET互相干扰。
2.        FAST_START_MTTR_TARGET的最大值是 3600秒,当你设定的值超过 3600秒, Oracle会按照 3600秒来运行。
3.        请为 FAST_START_MTTR_TARGET设置一个实际可行的值。原则上 FAST_START_MTTR_TARGET的最小值是 1秒(先不讨论 0的情况),但是把数值设的很低并不意味着你可以达成这个目标,因为最低的 MTTR TARGET是有限制的,它依赖于你数据库的启动时间等因素。你数据库实际能达到的 MTTR TARGET称为 effective MTTR target。你可以通过查询 V$INSTANCE_RECOVERY视图的 TARGET_MTTR列来查看该值。所以假如你将 FAST_START_MTTR_TARGET设置过低不仅没有什么作用,反而还会因为频繁的 checkpointing writes操作降低了数据库的性能。同样假如你将 FAST_START_MTTR_TARGET设置过高,他也不会比在你数据库最遭情况下(整个缓存中都是脏数据)花的时间更长。(原文: If you set FAST_START_MTTR_TARGET to a time longer than the practical range, the MTTR target will be no better than the worst-case situation.

你可能感兴趣的:(oracle,职场,休闲)