当前位置:  数据库>oracle

Oracle 控制文件(CONTROL FILE)

    来源: 互联网  发布时间:2017-03-29

    本文导语: 一、Oracle 控制文件 为二进制文件,初始化大小由CREATE DATABASE指定,可以使用RMAN备份记录了当前数据库的结构信息,同时也包含数据文件及日志文件的信息以及相关的状态,归档信息等等在参数文件中描述其位置,个数等等。通常采...

一、Oracle 控制文件

为二进制文件,初始化大小由CREATE DATABASE指定,可以使用RMAN备份记录了当前数据库的结构信息,同时也包含数据文件及日志文件的信息以及相关的状态,归档信息等等在参数文件中描述其位置,个数等等。通常采用分散放开,多路复用的原则。在mount阶段被读取,open阶段一直被使用维护数据库一致性(数据库启动时会比较控制文件与联机日志文件中的ckpt,即起始scn号,如相等则正常启动,否则需要介质恢复)一个控制文件只能属于一个数据库控制文件的任意修改将写入到初始化参数中指定的所有控制文件中,读取时则仅读取第一个控制文件控制文件只能连接一个数据库,控制文件的大小一般不要超过MB,最多为个,最少一个,互为镜像控制文件中包含的内容数据库的名字、ID、创建的时间戳表空间的名字联机日志文件、数据文件的位置、个数、名字

联机日志的Sequence号码

检查点的信息

撤销段的开始或结束

归档信息

备份信息   

二、查看控制文件的相关信息

    1.使用相关视图来查看

        V$CONTROLFILE                   --列出实例中所有控制文件的名字及状态信息

        V$PARAMETER                     --列出所有参数的位置及状态信息

        V$CONTROLFILE_RECORD_SECTION    --列出控制文件中记录的部分信息

        SHOW PARAMETER CONTROL_FILES    --列出控制文件的名字、状态、位置等

        SQL> select * from v$controlfile;

        STATUS  NAME                                               IS_ BLOCK_SIZE FILE_SIZE_BLKS

        ------- -------------------------------------------------- --- ---------- --------------

                /u01/app/oracle/oradata/orcl/control01.ctl         NO       16384            430

                /u01/app/oracle/oradata/orcl/control02.ctl         NO       16384            430

                /u01/app/oracle/oradata/orcl/control03.ctl         NO       16384            430

       

        SQL> select name,type,value from  v$parameter where name like '%control%';

        NAME                                 TYPE VALUE

        ------------------------------ ---------- ------------------------------------------------------------

        control_files                           2 /u01/app/oracle/oradata/orcl/control01.ctl, /u01/app/oracle/

                                                  oradata/orcl/control02.ctl, /u01/app/oracle/oradata/orcl/con

                                                  trol03.ctl

        control_file_record_keep_time           3 7

       

        SQL> select * from v$controlfile_record_section;

        TYPE                         RECORD_SIZE RECORDS_TOTAL RECORDS_USED FIRST_INDEX LAST_INDEX LAST_RECID

        ---------------------------- ----------- ------------- ------------ ----------- ---------- ----------

        DATABASE                             316             1            1           0          0          0

        CKPT PROGRESS                       8180            11            0           0          0          0

        REDO THREAD                          256             8            1           0          0          0

        REDO LOG                              72            16            9           0          0         20

        DATAFILE                             428           100            8           0          0         28

        FILENAME                             524          2298           21           0          0          0

        TABLESPACE                            68           100            7           0          0          7

        TEMPORARY FILENAME                    56           100            1           0          0          1

        RMAN CONFIGURATION                  1108            50            0           0          0          0

        LOG HISTORY                           56           292           35           1         35         35

        OFFLINE RANGE                        200           163            0           0          0          0

        TYPE                         RECORD_SIZE RECORDS_TOTAL RECORDS_USED FIRST_INDEX LAST_INDEX LAST_RECID

        ---------------------------- ----------- ------------- ------------ ----------- ---------- ----------

        ARCHIVED LOG                         584            28           20           1         20         20

        BACKUP SET                            40           409            0           0          0          0

        BACKUP PIECE                         736           200            0           0          0          0

        BACKUP DATAFILE                      116           282            0           0          0          0

        BACKUP REDOLOG                        76           215            0           0          0          0

        DATAFILE COPY                        660           223            1           1          1          1

        BACKUP CORRUPTION                     44           371            0           0          0          0

        COPY CORRUPTION                       40           409            0           0          0          0

        DELETED OBJECT                        20           818            3           1          3          3

        PROXY COPY                           852           249            0           0          0          0

        BACKUP SPFILE                         36           454            0           0          0          0

        TYPE                         RECORD_SIZE RECORDS_TOTAL RECORDS_USED FIRST_INDEX LAST_INDEX LAST_RECID

        ---------------------------- ----------- ------------- ------------ ----------- ---------- ----------

        DATABASE INCARNATION                  56           292            2           1          2          2

        FLASHBACK LOG                         84          2048            0           0          0          0

        RECOVERY DESTINATION                 180             1            1           0          0          0

        INSTANCE SPACE RESERVATION            28          1055            1           0          0          0

        REMOVABLE RECOVERY FILES              32          1000            0           0          0          0

        RMAN STATUS                          116           141            0           0          0          0

        THREAD INSTANCE NAME MAPPING          80             8            8           0          0          0

        MTTR                                 100             8            1           0          0          0

        DATAFILE HISTORY                     568            57            0           0          0          0

        STANDBY DATABASE MATRIX              400            10           10           0          0          0

        GUARANTEED RESTORE POINT             212          2048            0           0          0          0

        TYPE                         RECORD_SIZE RECORDS_TOTAL RECORDS_USED FIRST_INDEX LAST_INDEX LAST_RECID

        ---------------------------- ----------- ------------- ------------ ----------- ---------- ----------

        RESTORE POINT                        212          2083            0           0          0          0

        SQL> show parameter control_files;

        NAME                                 TYPE        VALUE

        ------------------------------------ ----------- ------------------------------

        control_files                        string      /u01/app/oracle/oradata/orcl/c

                                                         ontrol01.ctl, /u01/app/oracle/

                                                         oradata/orcl/control02.ctl, /u

                                                         01/app/oracle/oradata/orcl/con

                                                         trol03.ctl

        SQL> select controlfile_sequence# from v$database;

        CONTROLFILE_SEQUENCE#

        ---------------------

                          985      

                     

    2.使用STRINGS命令来查看控制文件中的具体内容

        SQL> host strings /u01/app/oracle/oradata/orcl/control01.ctl | more

        }|{z

        JORCL

        L-+RG

        +ORCL

        +ORCL

        orcl

        orcl

        -+-='

        -+-='

        /u01/app/oracle/oradata/orcl/redo03.log

        /u01/app/oracle/oradata/orcl/redo3.log

        /u01/app/oracle/oradata/orcl/redo02.log

        /u01/app/oracle/oradata/orcl/redo2.log

        /u01/app/oracle/oradata/orcl/redo01.log

        /u01/app/oracle/oradata/orcl/tbs1_2.dbf

        /u01/app/oracle/oradata/orcl/tbs1_1.dbf

        /u01/app/oracle/oradata/orcl/example01.dbf

        /u01/app/oracle/oradata/orcl/users01.dbf

        /u01/app/oracle/oradata/orcl/sysaux01.dbf

        /u01/app/oracle/oradata/orcl/undotbs01.dbf

        /u01/app/oracle/oradata/orcl/system01.dbf

        u01/app/oracle/oradata/orcl/undotbs02.dbf

        /u01/app/oracle/oradata/orcl/redo03.log

        /u01/app/oracle/oradata/orcl/redo3.log

        /u01/app/oracle/oradata/orcl/redo02.log

        /u01/app/oracle/oradata/orcl/redo2.log

        /u01/app/oracle/oradata/orcl/redo01.log

        /u01/app/oracle/oradata/orcl/tbs1_2.dbf

        /u01/app/oracle/oradata/orcl/tbs1_1.dbf

        /u01/app/oracle/oradata/orcl/example01.dbf

        /u01/app/oracle/oradata/orcl/users01.dbf

        /u01/app/oracle/oradata/orcl/sysaux01.dbf

        /u01/app/oracle/oradata/orcl/undotbs01.dbf

        /u01/app/oracle/oradata/orcl/system01.dbf

        u01/app/oracle/oradata/orcl/undotbs02.dbf

        SYSTEM

        UNDOTBS1

        SYSAUX

        USERS

        EXAMPLE

        TBS1

        TEMP

       

    3.备份控制文件到平面文件(然后查看控制文件中的具体内容)

       

        SQL> alter database backup controlfile  to trace as '/u01/app/oracle/ctl.txt';

        Database altered.

       

        --或者使用

        SQL> host strings /u01/app/oracle/oradata/orcl/control01.ctl > /u01/app/oracle/ctl.txt

       

        SQL> host cat /u01/app/oracle/ctl.txt;  

        -- The following are current System-scope REDO Log Archival related

        -- parameters and can be included in the database initialization file.

        --

        -- LOG_ARCHIVE_DEST=''

        -- LOG_ARCHIVE_DUPLEX_DEST=''

        --

        -- LOG_ARCHIVE_FORMAT=%t_%s_%r.dbf

        --

        -- DB_UNIQUE_NAME="orcl"

        --

        -- LOG_ARCHIVE_CONFIG='SEND, RECEIVE, NODG_CONFIG'

        -- LOG_ARCHIVE_MAX_PROCESSES=2

        -- STANDBY_FILE_MANAGEMENT=MANUAL

        -- STANDBY_ARCHIVE_DEST=?/dbs/arch

        -- FAL_CLIENT=''

        -- FAL_SERVER=''

        --

        -- LOG_ARCHIVE_DEST_10='LOCATION=USE_DB_RECOVERY_FILE_DEST'

        -- LOG_ARCHIVE_DEST_10='OPTIONAL REOPEN=300 NODELAY'

        -- LOG_ARCHIVE_DEST_10='ARCH NOAFFIRM NOEXPEDITE NOVERIFY SYNC'

        -- LOG_ARCHIVE_DEST_10='REGISTER NOALTERNATE NODEPENDENCY'

        -- LOG_ARCHIVE_DEST_10='NOMAX_FAILURE NOQUOTA_SIZE NOQUOTA_USED NODB_UNIQUE_NAME'

        -- LOG_ARCHIVE_DEST_10='VALID_FOR=(PRIMARY_ROLE,ONLINE_LOGFILES)'

        -- LOG_ARCHIVE_DEST_STATE_10=ENABLE

        --

        -- Below are two sets of SQL statements, each of which creates a new

        -- control file and uses it to open the database. The first set opens

        -- the database with the NORESETLOGS option and should be used only if

        -- the current versions of all online logs are available. The second

        -- set opens the database with the RESETLOGS option and should be used

        -- if online logs are unavailable.

        -- The appropriate set of statements can be copied from the trace into

        -- a script file, edited as necessary, and executed when there is a

        -- need to re-create the control file.

        --

        --     Set #1. NORESETLOGS case

        --

        -- The following commands will create a new control file and use it

        -- to open the database.

        -- Data used by Recovery Manager will be lost.

        -- Additional logs may be required for media recovery of offline

        -- Use this only if the current versions of all online logs are

        -- available.

        -- After mounting the created controlfile, the following SQL

        -- statement will place the database in the appropriate

        -- protection mode:

        --  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

        STARTUP NOMOUNT

        CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS  NOARCHIVELOG

            MAXLOGFILES 16

            MAXLOGMEMBERS 3

            MAXDATAFILES 100

            MAXINSTANCES 8

            MAXLOGHISTORY 292

        LOGFILE

          GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log'  SIZE 50M,

          GROUP 2 (

            '/u01/app/oracle/oradata/orcl/redo02.log',

            '/u01/app/oracle/oradata/orcl/redo2.log'

          ) SIZE 50M,

          GROUP 3 (

            '/u01/app/oracle/oradata/orcl/redo03.log',

            '/u01/app/oracle/oradata/orcl/redo3.log'

          ) SIZE 100M,

          GROUP 4 '/u01/app/oracle/oradata/orcl/redo04.log '  SIZE 50M,

          GROUP 7 (

            '/u01/app/oracle/oradata/orcl/redo07.log ',

            '/u01/app/oracle/oradata/orcl/redo7.log '

          ) SIZE 50M,

          GROUP 8 (

            '/u01/app/oracle/oradata/orcl/redo08.log',

            '/u01/app/oracle/oradata/orcl/redo8.log'

          ) SIZE 50M

        -- STANDBY LOGFILE

        DATAFILE

          '/u01/app/oracle/oradata/orcl/system01.dbf',

          '/u01/app/oracle/oradata/orcl/undotbs01.dbf',

          '/u01/app/oracle/oradata/orcl/sysaux01.dbf',

          '/u01/app/oracle/oradata/orcl/users01.dbf',

          '/u01/app/oracle/oradata/orcl/example01.dbf',

          '/u01/app/oracle/oradata/orcl/tbs1_1.dbf',

          '/u01/app/oracle/oradata/orcl/tbs1_2.dbf'

        CHARACTER SET WE8ISO8859P1

        ;

        -- Commands to re-create incarnation table

        -- Below log names MUST be changed to existing filenames on

        -- disk. Any one log file from each branch can be used to

        -- re-create incarnation records.

        -- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area

        --                                   /ORCL/archivelog/2010_05_20/o1_mf_1_1_%u_.arc';

        -- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area

        --                                   /ORCL/archivelog/2010_05_20/o1_mf_1_1_%u_.arc';

        -- Recovery is required if any of the datafiles are restored backups,

        -- or if the last shutdown was not normal or immediate.

        RECOVER DATABASE

        -- Database can now be opened normally.

        ALTER DATABASE OPEN;

        -- Commands to add tempfiles to temporary tablespaces.

        -- Online tempfiles have complete space information.

        -- Other tempfiles may require adjustment.

        ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'

             SIZE 26214400  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

        -- End of tempfile additions.

        --

        --     Set #2. RESETLOGS case

        --

        -- The following commands will create a new control file and use it

        -- to open the database.

        -- Data used by Recovery Manager will be lost.

        -- The contents of online logs will be lost and all backups will

        -- be invalidated. Use this only if online logs are damaged.

        -- After mounting the created controlfile, the following SQL

        -- statement will place the database in the appropriate

        -- protection mode:

        --  ALTER DATABASE SET STANDBY DATABASE TO MAXIMIZE PERFORMANCE

        STARTUP NOMOUNT

        CREATE CONTROLFILE REUSE DATABASE "ORCL" RESETLOGS  NOARCHIVELOG

            MAXLOGFILES 16

            MAXLOGMEMBERS 3

            MAXDATAFILES 100

            MAXINSTANCES 8

            MAXLOGHISTORY 292

        LOGFILE

          GROUP 1 '/u01/app/oracle/oradata/orcl/redo01.log'  SIZE 50M,

          GROUP 2 (

            '/u01/app/oracle/oradata/orcl/redo02.log',

            '/u01/app/oracle/oradata/orcl/redo2.log'

          ) SIZE 50M,

          GROUP 3 (

            '/u01/app/oracle/oradata/orcl/redo03.log',

            '/u01/app/oracle/oradata/orcl/redo3.log'

          ) SIZE 100M,

          GROUP 4 '/u01/app/oracle/oradata/orcl/redo04.log '  SIZE 50M,

          GROUP 7 (

            '/u01/app/oracle/oradata/orcl/redo07.log ',

            '/u01/app/oracle/oradata/orcl/redo7.log '

          ) SIZE 50M,

          GROUP 8 (

            '/u01/app/oracle/oradata/orcl/redo08.log',

            '/u01/app/oracle/oradata/orcl/redo8.log'

          ) SIZE 50M

        -- STANDBY LOGFILE

        DATAFILE

          '/u01/app/oracle/oradata/orcl/system01.dbf',

          '/u01/app/oracle/oradata/orcl/undotbs01.dbf',

          '/u01/app/oracle/oradata/orcl/sysaux01.dbf',

          '/u01/app/oracle/oradata/orcl/users01.dbf',

          '/u01/app/oracle/oradata/orcl/example01.dbf',

          '/u01/app/oracle/oradata/orcl/tbs1_1.dbf',

          '/u01/app/oracle/oradata/orcl/tbs1_2.dbf'

        CHARACTER SET WE8ISO8859P1

        ;

        -- Commands to re-create incarnation table

        -- Below log names MUST be changed to existing filenames on

        -- disk. Any one log file from each branch can be used to

        -- re-create incarnation records.

        -- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area

        --                                   /ORCL/archivelog/2010_05_20/o1_mf_1_1_%u_.arc';

        -- ALTER DATABASE REGISTER LOGFILE '/u01/app/oracle/flash_recovery_area

        --                                    /ORCL/archivelog/2010_05_20/o1_mf_1_1_%u_.arc';

        -- Recovery is required if any of the datafiles are restored backups,

        -- or if the last shutdown was not normal or immediate.

        RECOVER DATABASE USING BACKUP CONTROLFILE

        -- Database can now be opened zeroing the online logs.

        ALTER DATABASE OPEN RESETLOGS;

        -- Commands to add tempfiles to temporary tablespaces.

        -- Online tempfiles have complete space information.

        -- Other tempfiles may require adjustment.

        ALTER TABLESPACE TEMP ADD TEMPFILE '/u01/app/oracle/oradata/orcl/temp01.dbf'

             SIZE 26214400  REUSE AUTOEXTEND ON NEXT 655360  MAXSIZE 32767M;

        -- End of tempfile additions.


    
 
 
 
本站(WWW.)旨在分享和传播互联网科技相关的资讯和技术,将尽最大努力为读者提供更好的信息聚合和浏览方式。
本站(WWW.)站内文章除注明原创外,均为转载、整理或搜集自网络。欢迎任何形式的转载,转载请注明出处。












  • 相关文章推荐
  • Linux平台下Oracle 密码文件重建
  • Oracle数据库访问参数文件的顺序
  • Oracle 对数据文件大小的限制
  • Oracle移动数据文件到新分区步骤分析
  • 在jsp文件中怎么设置oracle的路径:很简单的,只是因为我不会;
  • Oracle的spfile参数文件
  • linux下通过对文件读取方式查询oracle的版本信息
  • 求高手指点shell导入.dat文件到ORACLE数据库
  • jsp文件连接oracle失败
  • linux 安装 oracle 运行./runinstall 提示没有这个文件
  • oracle删除文件后数据库启动不了的处理方法
  • 请教:为什么删除不掉?我用超级用户删除某一文件夹rm -R oracle失败。
  • Oracle数据库逻辑备份的SH文件
  • 利用多个转储文件导出大量Oracle数据
  • 50分的题:如何给oracle减肥?在linux多目录的环境下查找体积最大的单个文件??
  • 用oracle pl/sql 从A unix机器,去读取B unix机器上的一个文件,怎么实现?
  • 读取oracle数据库表写文件慢
  • 如何向oracle中写入一个大文件?谢谢!
  • jsp文件上传smartupload到oracle数据库中没有longblob的数据类型如何处理的?
  • 用Jbuilder编译文件,提示找不到oracle驱动?
  • Oracle 12c发布简单介绍及官方下载地址
  • 在linux下安装oracle,如何设置让oracle自动启动!也就是让oracle那个服务自动启动,不是手动的
  • 编程技术其它 iis7站长之家
  • 请问su oracle 和su - oracle有什么不同?
  • Oracle 数据库(oracle Database)Select 多表关联查询方式
  • 虚拟机装Oracle R12与Oracle10g
  • Oracle数据库(Oracle Database)体系结构及基本组成介绍
  • Oracle 数据库开发工具 Oracle SQL Developer
  • 如何设置让Oracle SQL Developer显示的时间包含时分秒
  • Oracle EBS R12 支持 Oracle Database 11g
  • Oracle 10g和Oracle 11g网格技术介绍


  • 站内导航:


    特别声明:169IT网站部分信息来自互联网,如果侵犯您的权利,请及时告知,本站将立即删除!

    ©2012-2021,,E-mail:www_#163.com(请将#改为@)

    浙ICP备11055608号-3