• oracle 第11章 重做日志文件


    2015-10-21

    目录

    一、概述

    二、数据字典

      1.v$log视图:重做日志组

      2.v$logfile视图:重做日志组成员

      3.归档模式

    三、重做日志组

      1.添加重做日志组

      2.查看重做日志组

      3.删除重做日志组

    四、重做日志成员

      1.添加重做日志成员

      2.查看重做日志成员

      3.删除重做日志成员

     五、日志切换、检查点事件

    一、概述

      Oracle引入重做日志的原因:数据恢复。为了提高I/O效率,Oracle引入了重做日志结构,典型重做日志结构由3个重做日志组组成,每个重做日志组中有2个重做日志成员(重做日志文件)。数据库系统会先使用重做日志组1,该组写满后切换到重做日志组2,再写满后切换到重做日志组3,然后循环使用重做日志组。Oracle规定每个数据库实例至少有2个重做日志组,每个重做日志组至少有1个重做日志文件。如果没有启动归档日志,一个循环结束,再次使用先前的重做日志组时会以覆盖的方式写入数据。

    二、数据字典

      1.v$log视图

    SQL> desc v$log;

    SQL> select group#,thread#,bytes,members,archived,status from v$log;

      2.v$logfile视图

    SQL> desc v$logfile;

    SQL> col member for a50;
    SQL> select group#,status,type,member from v$logfile;

      3.归档模式

        查看归档模式

    SQL> archive log list;

        启用归档模式

    //关闭数据库
    SQL> shutdown immediate;
    //启动数据库到mount状态
    SQL> startup nomount;
    SQL> alter database mount;
    //设置归档模式
    SQL> alter database archivelog;
    //查看归档模式
    SQL> archive log list;

    //查看归档目录
    SQL> show parameter db_recovery_file_dest;

    三、重做日志组

      1.添加重做日志组

    ALTER DATABASE [database_name]

    ADD LOGFILE [GROUP number] filename SIZE n

    [,ADD LOGFILE [GROUP number] filename SIZE n......]

    SQL> alter database add logfile group 4
      2  ('/u01/app/oracle/oradata/orcl/redo04a.log',
      3  '/u01/app/oracle/oradata/orcl/redo04b.log')
      4  size 11m;

      2.查看重做日志组

    SQL> select group#,thread#,sequence#,bytes,members,archived,status from v$log;

    SQL> col member for a50;
    SQL> select group#,status,type,member from v$logfile;

      3.删除重做日志组

    ALTER DATABASE [database_name]

    DROP LOGFILE {GROUP n| ('filename' [,'filename']...)}

            {GROUP n| ('filename' [,'filename']...)}...

    SQL> alter database drop logfile group 4;

      验证

    SQL> col member for a50;
    SQL> select group#,status,type,member from v$logfile;

    四、重做日志成员

      1.添加重做日志成员

    ALTER DATABASE [database_name]

    ADD LOGFILE MEMBER

        ['filename' [REUSE] [,'filename' [REUSE]] ...

    TO {GROUP n | ('filename' [,'filename'])......}

    ]...

    SQL> alter database add logfile member
      2  '/u01/app/oracle/oradata/orcl/redo01a.log' to group 1,
      3  '/u01/app/oracle/oradata/orcl/redo02a.log' to group 2,
      4  '/u01/app/oracle/oradata/orcl/redo03a.log' to group 3;

      2.查看重做日志成员

    SQL> col member for a50;
    SQL> select group#,status,type,member from v$logfile;

      3.删除重做日志成员

    ALTER DATABASE [database_name]

    DROP LOGFILE MEMBER 'filename' [,'filename'] ....

    SQL> alter database drop logfile member
      2  '/u01/app/oracle/oradata/orcl/redo02a.log',
      3  '/u01/app/oracle/oradata/orcl/redo03a.log';

      验证

    SQL> col member for a50;
    SQL> select group#,status,type,member from v$logfile;

      五、日志切换、检查点事件

        1.日志切换

    SQL> alter system switch logfile;

          验证

    SQL> select group#,thread#,sequence#,bytes,members,archived,status from v$log;

        2.检查点事件

    SQL> alter system checkpoint;

    参考资料

    [1] 林树泽.Oracle 11g R2 DBA操作指南[M].北京:清华大学出版社,2013

    [2] ORACLE——重做日志文件管理

    [3] Oracle的重做日志

    [4] Oracle重做日志文件

    [5] Oracle的重做日志和归档日志

    [6] Oracle重做日志

    [7] Oracle重做日志官方文档

    [8] Oracle Redo Log 机制 小结

    [9] Oracle在线重做日志文件详解

    [10] Oracle 联机重做日志文件(ONLINE LOG FILE)

    [11] Oracle的重做日志和归档日志

  • 相关阅读:
    flash 搜索算法
    小波分析
    Generalised Policy Iteration With Monte-Carlo Evaluation
    Learning an Optimal Policy: Model-free Methods
    To discount or not to discount in reinforcement learning: A case study comparing R learning and Q learning
    adaptive heuristic critic 自适应启发评价 强化学习
    Q-learning
    On Using Very Large Target Vocabulary for Neural Machine Translation Candidate Sampling Sampled Softmax
    Brotli
    数据到达etl系统的时间晚于事务发生的时间
  • 原文地址:https://www.cnblogs.com/cenliang/p/4898162.html
Copyright © 2020-2023  润新知