• Oracle-实例启动是如何判断是否需要进行实例恢复?


    疑问?

       Oracle关闭DB有两种类型:一致性关库、非一致性关库;

      Oracle宣传的是说Oracle数据库永远不会丢失数据! 这句话的意思是当DB主机由于断电等异常原因造成实例崩溃,已经commit提交的数据不会丢失!

       Oracle是如何保证数据不丢失的,是基于日志先行策略! 回到问题! 非一致性关库,Oracle如何判断需要实例恢复???

    一、Oracle通过v$datafile last_change# 可以判断是否是一致性关库,可以判断是否需要进行实例恢复

     

    SQL> shutdown immediate;
    SQL> startup mount;
    SQL> select file#,CHECKPOINT_CHANGE#, LAST_CHANGE#,status from v$datafile;                     
    
         FILE# CHECKPOINT_CHANGE# LAST_CHANGE# STATUS
    ---------- ------------------ ------------ -------
             1           35628021     35628021 SYSTEM
             2           35628021     35628021 ONLINE
             3           35628021     35628021 ONLINE
             4           35628021     35628021 ONLINE
             5           35628021     35628021 ONLINE
             6           35628021     35628021 ONLINE
             7           35628021     35628021 ONLINE
             8           35628021     35628021 ONLINE
             9           35628021     35628021 ONLINE
    
    9 rows selected.
    SQL> select NAME,CHECKPOINT_CHANGE# from v$database;
    
    NAME      CHECKPOINT_CHANGE#
    --------- ------------------
    TT11204             35628021
    SQL> alter database open;

    SQL> shutdown abort;
    SQL> startup mount;

    SQL> select file#,CHECKPOINT_CHANGE#, LAST_CHANGE#,status from v$datafile;

    
    

    FILE# CHECKPOINT_CHANGE# LAST_CHANGE# STATUS
    ---------- ------------------ ------------ -------
    1 35628024 SYSTEM
    2 35628024 ONLINE
    3 35628024 ONLINE
    4 35628024 ONLINE
    5 35628024 ONLINE
    6 35628024 ONLINE
    7 35628024 ONLINE
    8 35628024 ONLINE
    9 35628024 ONLINE

    
    

    9 rows selected.

    
    

    SQL> select NAME,CHECKPOINT_CHANGE# from v$database;

    
    

    NAME CHECKPOINT_CHANGE#
    --------- ------------------
    TT11204 35628024

    SQL> alter database open;

    观察DB alert.log

    二、实例恢复日志DB Alert.log截取

     

    Thu Dec 31 15:41:15 2020
    alter database open
    Beginning crash recovery of 1 threads
    parallel recovery started with 2 processes
    Started redo scan
    Completed redo scan
    read 76 KB redo, 40 data blocks need recovery
    Started redo application at
    Thread 1: logseq 2945, block 14845
    Recovery of Online Redo Log: Thread 1 Group 3 Seq 2945 Reading mem 0
    Mem# 0: /11.2.0.4/app/oracle/tt/redo03.log
    Completed redo application of 0.04MB
    Completed crash recovery at
    Thread 1: logseq 2945, block 14998, scn 35648364
    40 data blocks read, 40 data blocks written, 76 redo k-bytes read

  • 相关阅读:
    unity 3d 之合并网格和贴图(combine mesh and texture)
    哈希表(散列表)原理详解
    二叉树-你必须要懂!(二叉树相关算法实现-iOS)
    浅谈数据结构-二叉树
    python中的日志操作和发送邮件
    python实现自定义接口
    python 操作excel
    两个redis之间迁移的python实现
    python对redis的连接和操作
    python3导入自定义模块
  • 原文地址:https://www.cnblogs.com/lvcha001/p/14343932.html
Copyright © 2020-2023  润新知