• 控制文件oracle controlfile structure


    首先声明,我是一个菜鸟。一下文章中出现技术误导情况盖不负责

        绍介下oracle控制文件,控制文件是一个小的二进制文件,只与一个oracle数据库关联,控制文件的份备和恢复这里就先不绍介了,控制文件由很多件组成组,体具可以看查V$CONTROLFILE_RECORD_SECTION

        

        每日一道理
    古人云:“海纳百川,有容乃大。”人世间,不可能没有矛盾和争吵,我们要以磊落的胸怀和宽容的微笑去面对它 。哈伯德也曾说过:“宽恕和受宽恕的难以言喻的快乐,是连神明会都为之羡慕的极大乐事。”让我们从宽容中享受快乐,从谅解中体会幸福吧!

        

    控制和文件
    SQL> select sum(record_size*records_total) from v$controlfile_record_section;

               7007244
    可以看到件组总计为7007244bytes
    SQL> ! du -sh /database/oradata/skyread/control01.ctl
    14M     /database/oradata/skyread/control01.ctl            ------现实控制文件巨细
    oracle@readerlogdb-> dbfsize /database/oradata/skyread/control01.ctl

    Database file: /database/oradata/skyread/control01.ctl
    Database file type: file system
    Database file size: 886 16384 byte blocks     --这里控制文件块是16K

    SQL> ! dbfsize /database/oradata/skyread/system01.dbf

    Database file: /database/oradata/skyread/system01.dbf
    Database file type: file system
    Database file size: 153600 8192 byte blocks      --数据文件块为8K

    可以看出控制文件块是数据文件块的2倍巨细,是实其控制文件块用两个同相的块成组了一个逻辑块
    这里还要注意到并非全部件组会都有镜像,所以控制文件的巨细并非件组所占间空的2倍巨细
    看一下精确法算:
    SQL> select (8*1024)*(1+2*sum(ceil(record_size*records_total/(8*1024)))) bytes from v$controlfile_record_section;

      14180352      ---这个就是现实的控制文件巨细
    控制文件含包的内容:
    数据库名                
    创立数据库时的时间戳    
    表间空名                
    物理结构,包含志日文件,
    前当志日的序列号        
    检查点信息              
    回滚段的信息            
    志日归档的历史          
    份备与恢复的信息

    控制文件出了块级的镜像,还有文件级的镜像,所以每一个控制文件时一样的
    参阅:http://www.ixora.com.au/notes/controlfile_structure.htm
    The first block of the controlfile is a header block that records just the controlfile block size and the number of blocks in the controlfile. The controlfile block size is the same as the database block size. When mounting a database, Oracle checks that the controlfile block size and the file size recorded in the controlfile header block match the   db_block_size  parameter and the file size reported by the operating system (if available). Otherwise an error is raised to indicate that the controlfile might have been corrupted or truncated.

    After the header block, all controlfile blocks occur in pairs. Each logical block is represented by two physical blocks. This is necessary for the controlfile transaction mechanism.

    It is theoretically possible that a hot backup of a controlfile could contain a split block. Therefore all controlfile blocks other than the file header have a cache header and tail that can be compared when mounting a database and whenever a controlfile block is read. The block type is 0 for virgin controlfile blocks and 21 otherwise. The physical controlfile block number is used in place of an RDBA in the cache header, and a controlfile sequence number is used in place of an SCN to record when the block was last changed. An ORA-00227 error is returned if the header and tail do not match, or if the block checksum does not match the checksum recorded in the cache header (if any).

    The controlfile contains several different types of records, each in its own record section of one or more logical blocks. Records may span block boundaries within their section. The fixed view V$CONTROLFILE_RECORD_SECTION lists the types of records stored in each record section, together with the size of the record type, and the number of record slots available and in use within that section. The underlying X$KCCRS structure includes the starting logical block number (RSLBN) for each section.

    文章结束给大家分享下程序员的一些笑话语录: 问路
    有一个驾驶热气球的人发现他迷路了。他降低了飞行的高度,并认出了地面 上的一个人。他继续下降高度并对着那个人大叫,“打扰一下,你能告诉我我 在哪吗?”
    下面那个人说:“是的。你在热气球里啊,盘旋在 30 英尺的空中”。
    热气球上的人说:“你一定是在 IT 部门做技术工作”。
    “没错”,地面上的人说到,“你是怎么知道的?”
    “呵呵”,热气球上的人说,“你告诉我的每件事在技术上都是对的,但对都没 有用”。
    地面上的人说,“你一定是管理层的人”。
    “没错”,热气球上的人说,“可是你是怎么知道的?”
    “呵呵”,地面上的那人说到,“你不知道你在哪里,你也不知道你要去哪,你 总希望我能帮你。你现在和我们刚见面时还在原来那个地方,但现在却是我 错了”。

  • 相关阅读:
    centos svn的配置使用
    bind 的使用
    我 && yii2 (二)
    我 && yii2 (一)
    vue handsontable 插件 如何验证该行内的某项内容是否填写 !
    sass穿透 scoped 的情况下 去修改ui组件的样式
    vue 3.0 编译巨慢 结局方法
    element-ui tree树形节点 自定义图标
    element
    treeselect 表单验证解决方法
  • 原文地址:https://www.cnblogs.com/jiangu66/p/3069660.html
Copyright © 2020-2023  润新知