AG阅读总结8——控制文件管理 *

一、Oracle 控制文件

为二进制文件,初始化大小由CREATE DATABASE指定,可以使用RMAN备份

        记录了当前数据库的结构信息,同时也包含数据文件及日志文件的信息以及相关的状态,归档信息等等

        在参数文件中描述其位置,个数等等。通常采用分散放开,多路复用的原则。在mount阶段被读取(没有控制文件数据库,mount不上),open阶段一直被使用

        维护数据库一致性(数据库启动时会比较控制文件与联机日志文件中的ckpt,即起始scn号,如相等则正常启动,否则需要介质恢复)

        一个控制文件只能属于一个数据库

        控制文件的任意修改将写入到初始化参数中指定的所有控制文件中,读取时则仅读取第一个控制文件

        控制文件只能连接一个数据库,控制文件的大小一般不要超过MB,最多为个,最少一个,互为镜像

               

        控制文件中包含的内容:

            数据库的名字、ID、创建的时间戳

            表空间的名字

            联机日志文件、数据文件的位置、个数、名字

            联机日志的Sequence号码

            检查点的信息

            撤销段的开始或结束

            归档信息

            备份信息

 创建一个控制文件:

  1、列出各个文件的地址:如果你控制文件的备份做的好的话,一般就直接从已经备份好的控制文件中找到了对应的各个数据文件,redolog文件等路径。没有的话只能挨着查出来啦:

select menber from v$logfile; ——显示三个redolog的路径。

select name from v$datafile; ——显示system表空间内system01.dbf ;undo表空间undotbs01.dbf文件,sysaux 表空间内sysaux01.dbf数据文件;普通数据表看空间 tbs_1.dbf文件的路径。

select value from v$parameter where name='control_file';——查出控制文件的路径。

2、关闭数据库:如果数据库没有出现意外,那就可以用immediate或者abort关闭数据库(我怎么觉得说的不对)。

3、备份所有数据文件和redo日志文件。

4、重新启动一个实例但是不mount不open:STARTUP NOMOUNT.

5、创建一个新的控制文件:

CREATE CONTROLFILE

SET DATABASE mynewdb

LOGFILE GROUP 1 ('/u01/oracle/prod/redo01_01.log',

'/u01/oracle/prod/redo01_02.log'),

GROUP 2 ('/u01/oracle/prod/redo02_01.log',

'/u01/oracle/prod/redo02_02.log'),

GROUP 3 ('/u01/oracle/prod/redo03_01.log',

'/u01/oracle/prod/redo03_02.log')

RESETLOGS

DATAFILE '/u01/oracle/prod/system01.dbf' SIZE 3M,

'/u01/oracle/prod/rbs01.dbs' SIZE 5M,

'/u01/oracle/prod/users01.dbs' SIZE 5M,

'/u01/oracle/prod/temp01.dbs' SIZE 5M

MAXLOGFILES 50

MAXLOGMEMBERS 3

MAXLOGHISTORY 400

MAXDATAFILES 200

MAXINSTANCES 6

ARCHIVELOG;

6、备份一个新创建的控制文件到一个脱机的设备上。

7、修改初始参数信息,如数据库名DB_NAME等,改成和控制文件一致。

8、打开数据库:

如果没有执行恢复,或者执行恢复正常完成,然后正常关闭了,可以用下面的语句:ALTER DATABASE OPEN;

如果当创建一个控制文件时指明用了RESETLOGS那就用下面语句打开:ALTER DATABASE OPEN RESETLOGS;

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

    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_SIZERECORDS_TOTALRECORDS_USEDFIRST_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.

    4.转储控制文件内容(查看控制文件中的具体内容)

        alter session set events 'immediate trace name CONTROLF level 12'; level表示级别

        或                     --level1  块头的内容 --level2 数据文件内容 --levle 10 |12 所有内容

        oradebug setmypid

        oradebug dump controlf 12

   

        SQL> alter system set events 'immediate trace name controlf level 10';

 

        System altered.

 

        SQL> show parameter user_dump;

 

        NAME                                 TYPE        VALUE

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

        user_dump_dest                       string      /u01/app/oracle/admin/orcl/udu

                                                         mp

       

        --查看路径中最新的文件

        [root@robinson ~]# vim /u01/app/oracle/admin/orcl/udump/orcl_ora_5110.trc

       

        --以下仅列出部分信息

        Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production

        With the Partitioning, OLAP and Data Mining options

        ORACLE_HOME = /u01/app/oracle/10g

        System name:    Linux

        Node name:      robinson.com

        Release:        2.6.18-164.el5xen

        Version:        #1 SMP Tue Aug 18 16:06:30 EDT 2009

        Machine:        i686

        Instance name: orcl

        Redo thread mounted by this instance: 1

        Oracle process number: 19

        Unix process pid: 5110, image: oracle@robinson.com (TNS
V1-V3)

 

        *** 2010-05-20 18:52:30.104

        *** SERVICE NAME:(SYS$USERS) 2010-05-20
18:52:30.084

        *** SESSION ID:(159.10) 2010-05-20 18:52:30.084

        DUMP OF CONTROL FILES, Seq # 985 = 0x3d9

         V10 STYLE FILE HEADER:

                Compatibility Vsn = 169869568=0xa200100

                Db ID=1242732291=0x4a129703, Db Name='ORCL'

                Activation ID=0=0x0

                Control Seq=985=0x3d9, File size=430=0x1ae

                File Number=0, Blksiz=16384, File Type=1
CONTROL

         Logical block number 1 (header block)

        Dump of memory from 0xB7EF7E00 to 0xB7EFBE00

           

        --使用oradebug setmypid

        SQL> oradebug setmypid  --标记当前进程

        Statement processed.

        --获得当前的spid

        SQL> select spid from v$process where addr =

          2      (select paddr from v$session where sid =

          3          (select sid from v$mystat where rownum = 1));

 

        SPID

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

        5110

       

        SQL> oradebug dump controlf 3;--3表示包含头文件和数据文件内容

        Statement processed.

       

        --查看user_dump_dest  路径

        SQL> show parameter user_d  

 

        NAME                                 TYPE        VALUE

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

        user_dump_dest                       string      /u01/app/oracle/admin/orcl/udu

                                                         mp

       

        --找到当前spid的trc文件                                            

        SQL>  ! ls /u01/app/oracle/admin/orcl/udump/*5110.*              --  */

        /u01/app/oracle/admin/orcl/udump/orcl_ora_5110.trc 

        SQL>  ! cat /u01/app/oracle/admin/orcl/udump/orcl_ora_5110.trc

       

        --下面列出的为部分内容

        ***************************************************************************

        RMAN CONFIGURATION RECORDS

        ***************************************************************************

         (size = 1108, compat size = 1108, section max = 50, section in-use = 0,

          last-recid= 0, old-recno = 0, last-recno = 0)

         (extent = 1, blkno = 90, numrecs = 50)

         ***************************************************************************

        FLASHBACK LOGFILE RECORDS

        ***************************************************************************

         (size = 84, compat size = 84, section max = 2048, section in-use = 0,

          last-recid= 0, old-recno = 0, last-recno = 0)

         (extent = 1, blkno = 139, numrecs = 2048)

                 

        ***************************************************************************

        THREAD INSTANCE MAPPING RECORDS

        ***************************************************************************

         (size = 80, compat size = 80, section max = 8, section in-use = 8,

          last-recid= 0, old-recno = 0, last-recno = 0)

         (extent = 1, blkno = 156, numrecs = 8)

        orcl recno=1

        UNNAMED_INSTANCE_2 recno=2

        UNNAMED_INSTANCE_3 recno=3

        UNNAMED_INSTANCE_4 recno=4

        UNNAMED_INSTANCE_5 recno=5

        UNNAMED_INSTANCE_6 recno=6

        UNNAMED_INSTANCE_7 recno=7

        UNNAMED_INSTANCE_8 recno=8

          

        ***************************************************************************

        MTTR RECORDS

        ***************************************************************************

         (size = 100, compat size = 100, section max = 8, section in-use = 1,

          last-recid= 0, old-recno = 0, last-recno = 0)

         (extent = 1, blkno = 157, numrecs = 8)

        MTTR record for thread 1

        MTTR statistics status: 3

        Init time: Avg: 47090974 us, Times measured: 4

        File open time: Avg: 11225 us, Times
measured: 21

        Log block read time: Avg: 20 us, Times
measured: 65536

        Data block read/claim time: Avg: 170 us, Times
measured: 1000

        Data block write time: Avg: 390 us

        1000 change vector apply time: Avg: 112435 us, Times
measured: 37

        Ratio Information:

        # of log blocks measured: 207891

        # of data blocks measured: 12536

        # of change vectors measured: 564444

                 

        ***************************************************************************

        STANDBY DATABASE MAP RECORDS

        ***************************************************************************

         (size = 400, compat size = 400, section max = 10, section in-use = 10,

          last-recid= 0, old-recno = 0, last-recno = 0)

         (extent = 1, blkno = 160, numrecs = 10)

                 

        ***************************************************************************

        RESTORE POINT RECORDS

        ***************************************************************************

         (size = 212, compat size = 212, section max = 2048, section in-use = 0,

          last-recid= 0, old-recno = 0, last-recno = 0)

         (extent = 1, blkno = 161, numrecs = 2048)

三、控制文件的管理 :

    规划原则:多路复用,建议存放到不同的磁盘或同一磁盘不同的分区

    个数与位置及状态管理:

        查看控制文件的状态是否与参数定义中的相吻合,当数据库发生结构修改时,将修改内容同时写入控制文件

    备份管理

    恢复管理

    新建控制文件语句

   

    spfile或pfile都可以实现对控制文件的个数及位置管理

    spfile步骤

        修改spfile参数中的control_files   -- alter system ... scope = spfile | both |memory

        一致性关闭数据库

        增加或减少控制文件(cp or mv)

        启动数据库使用spfile

        验证结果

       

    pfile步骤

        一致性关闭数据库

        修改pfile参数(vi或vim)   修改*.control_files=......这一段

        增加或减少控制文件(cp or mv)

        启动数据库使用pfile

        验证结果

       

    --演示spfile修改控制文件

        SQL> show parameter control_file

 

        NAME                                 TYPE        VALUE

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

        control_file_record_keep_time        integer     7

        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> alter system set control_files = '/u01/app/oracle/oradata/orcl/control01.ctl' scope = spfile;

 

        System altered.

 

        SQL> shutdown immediate;

        Database closed.

        Database dismounted.

        ORACLE instance shut down.

        SQL> startup mount

        ORACLE instance started.

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              88082196 bytes

        Database Buffers          159383552 bytes

        Redo Buffers                2973696 bytes

        Database mounted.

       

        --再次查看参数文件,已显示为一个

        SQL> show parameter control_file

 

        NAME                                 TYPE        VALUE

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

        control_file_record_keep_time        integer     7

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

                                                         ontrol01.ctl

       

        --增加控制文件(在nomount状态下即可修改)

        SQL> alter system set control_files = '/u01/app/oracle/oradata/orcl/control01.ctl',

          2  '/u01/app/oracle/oradata/orcl/control02.ctl',

          3  '/u01/app/oracle/oradata/orcl/control03.ctl'

          4  scope = spfile;

 

        System altered.

       

        --启动时可以看到在实例阶段出现了版本号不一致的问题

        SQL> startup force

        ORACLE instance started.

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              88082196 bytes

        Database Buffers          159383552 bytes

        Redo Buffers                2973696 bytes

        ORA-00214: control file '/u01/app/oracle/oradata/orcl/control01.ctl' version

        1051 inconsistent with file '/u01/app/oracle/oradata/orcl/control02.ctl'

        version 1049

       

        --处理办法,用版本号高的控制文件覆盖版本号低的控制文件

        SQL> host cp /u01/app/oracle/oradata/orcl/control01.ctl /u01/app/oracle/oradata/orcl/control02.ctl;

 

        SQL> host cp /u01/app/oracle/oradata/orcl/control01.ctl /u01/app/oracle/oradata/orcl/control03.ctl;

 

        SQL> alter database mount;

 

        Database altered.

 

        SQL> alter database open;

 

        Database altered.  

       

    对于控制文件丢失的情况下,通过查看参数文件中设置,使用操作系统命令逐个查看这些文件是否存在

   

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

        /u01/app/oracle/oradata/orcl/control01.ctl

 

        SQL> host ls /u01/app/oracle/oradata/orcl/control02.ctl

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

   

    查看控制文件所在的目录可用空间及控制文件的大小,建议不要超过100MB

        SQL> host ls /u01/app/oracle/oradata/orcl/c*.ctl -lh

        -rw-r----- 1 oracle oinstall 6.8M May 23 10:55 /u01/app/oracle/oradata/orcl/control01.ctl

        -rw-r----- 1 oracle oinstall 6.8M May 23 10:55 /u01/app/oracle/oradata/orcl/control02.ctl

        -rw-r----- 1 oracle oinstall 6.8M May 23 10:55 /u01/app/oracle/oradata/orcl/control03.ctl

 

        SQL> ! df -h

        Filesystem            Size  Used Avail Use% Mounted on

        /dev/sda2             6.4G  3.9G  2.2G  64% /

        /dev/sdd1             6.8G  3.7G  2.8G  58% /u01

        /dev/sdc2             1.2G   34M  1.1G   3% /home

        /dev/sdc1             760M   17M  704M   3% /tmp

        /dev/sda1             456M   18M  415M   5% /boot

        tmpfs                 450M     0  450M   0% /dev/shm

        none                  450M  104K  450M   1% /var/lib/xenstored

       

    控制文件的备份

        热备:

            alter database backup controlfile to '<dir>';  --热备份控制文件

            alter database backup controlfile to trace as '<dir>' ;--得到建立控制文件的脚本

        RMAN:

            backup current controlfile;

            backup database include current controlfile;

            -- 或者设置RMAN 为自动备份

            RMAN > configure controlfile autobackup on;

           

        --演示备份

        --用于归档模式下的恢复,直接覆盖到控制文件

        SQL> alter database backup controlfile to '/u01/app/oracle/control.bak';

 

        Database altered.

       

        --用于重建控制文件

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

 

        Database altered.

      

        --使用RMAN备份

        RMAN> connect target /;

 

        connected to target database: ORCL (DBID=1242732291)

 

        RMAN> backup current controlfile;   --handle为备份文件的路径

 

        Starting backup at 23-MAY-10

        using target database control file instead of recovery catalog

        allocated channel: ORA_DISK_1

        channel ORA_DISK_1: sid=148 devtype=DISK

        channel ORA_DISK_1: starting full datafile backupset

        channel ORA_DISK_1: specifying datafile(s) in backupset

        including current control file in backupset

        channel ORA_DISK_1: starting piece 1 at 23-MAY-10

        channel ORA_DISK_1: finished piece 1 at 23-MAY-10

        piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/

              2010_05_23/o1_mf_ncnnf_TAG20100523T131841_5zkgon2l_.bkp tag=TAG20100523T131841 comment=NONE

        channel ORA_DISK_1: backup set complete, elapsed time: 00:00:05

        Finished backup at 23-MAY-10

       

        RMAN> backup database include current controlfile;

 

        Starting backup at 23-MAY-10

        using target database control file instead of recovery catalog

        allocated channel: ORA_DISK_1

        channel ORA_DISK_1: sid=141 devtype=DISK

        channel ORA_DISK_1: starting full datafile backupset

        channel ORA_DISK_1: specifying datafile(s) in backupset

        input datafile fno=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf

        input datafile fno=00003 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf

        input datafile fno=00005 name=/u01/app/oracle/oradata/orcl/example01.dbf

        input datafile fno=00006 name=/u01/app/oracle/oradata/orcl/tbs1_1.dbf

        input datafile fno=00007 name=/u01/app/oracle/oradata/orcl/tbs1_2.dbf

        input datafile fno=00002 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf

        input datafile fno=00004 name=/u01/app/oracle/oradata/orcl/users01.dbf

        channel ORA_DISK_1: starting piece 1 at 23-MAY-10

        channel ORA_DISK_1: finished piece 1 at 23-MAY-10

        piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/

              2010_05_23/o1_mf_nnndf_TAG20100523T132647_5zkh4sk2_.bkp tag=TAG20100523T132647 comment=NONE

        channel ORA_DISK_1: backup set complete, elapsed time: 00:05:25

        channel ORA_DISK_1: starting full datafile backupset

        channel ORA_DISK_1: specifying datafile(s) in backupset

        including current control file in backupset

        including current SPFILE in backupset

        channel ORA_DISK_1: starting piece 1 at 23-MAY-10

        channel ORA_DISK_1: finished piece 1 at 23-MAY-10

        piece handle=/u01/app/oracle/flash_recovery_area/ORCL/backupset/

              2010_05_23/o1_mf_ncsnf_TAG20100523T132647_5zkhh5st_.bkp tag=TAG20100523T132647 comment=NONE

        channel ORA_DISK_1: backup set complete, elapsed time: 00:00:14

        Finished backup at 23-MAY-10

       

        RMAN> show all; 

 

        RMAN configuration parameters are:

        CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default

        CONFIGURE BACKUP OPTIMIZATION OFF; # default

        CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default

        CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default

        CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default

        CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default

        CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

        CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default

        CONFIGURE MAXSETSIZE TO UNLIMITED; # default

        CONFIGURE ENCRYPTION FOR DATABASE OFF; # default

        CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default

        CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default

        CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/10g/dbs/snapcf_orcl.f'; # default

 

        RMAN> configure controlfile autobackup on;   --将控制文件自动备份功能置为on;

 

        new RMAN configuration parameters:

        CONFIGURE CONTROLFILE AUTOBACKUP ON;

        new RMAN configuration parameters are successfully stored

       

    控制文件的恢复管理

        控制文件版本不一致的问题

            用较新版本的控制文件覆盖旧版本的控制文件

            直接修改参数control_file

        丢失问题

            归档模式下

                当归档日志全的时候,先做全备,然后使用备份的控制文件恢复即可

                当归档日志不全的时候,先做全备,然后建立新的控制文件即可

            非归档模式下

                先做全备,然后建立新的控制文件即可

        新建控制文件语句

            数据库处于mount及open状态

            执行alter database backup controlfile to trace as '<dir>';得到建立语句

            注意[no]archievelog [no]resetlogs 两个参数的区别

           

    版本不一致演示 

        SQL> startup

        ORACLE instance started.

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              88082196 bytes

        Database Buffers          159383552 bytes

        Redo Buffers                2973696 bytes

        ORA-00214: control file '/u01/app/oracle/oradata/orcl/control01.ctl' version

        1051 inconsistent with file '/u01/app/oracle/oradata/orcl/control02.ctl'

        version 1049

       

        --处理办法,用版本号高的控制文件覆盖版本号低的控制文件

        SQL> host cp /u01/app/oracle/oradata/orcl/control01.ctl /u01/app/oracle/oradata/orcl/control02.ctl;

 

        SQL> host cp /u01/app/oracle/oradata/orcl/control01.ctl /u01/app/oracle/oradata/orcl/control03.ctl;

 

        SQL> alter database mount;

 

        Database altered.

 

        SQL> alter database open;

 

        Database altered.  

       

        --控制文件部分丢失的演示,原本有两个控制文件,丢失一个

        --处理办法:

            1.将存在的控制文件复制到目的路径并更改控制文件名字为正确的控制文件名称

            2.修改控控文件参数将丢失的控制文件去掉(一般不建议使用)

        SQL> alter system set control_files = ' /u01/app/oracle/oradata/orcl/c ontrol01.ctl',

          2  '/u01/app/oracle/oradata/orcl/control02.ctl' scope = spfile;

 

        System altered.

 

        SQL> shutdown immediate;

        Database closed.

        Database dismounted.

        ORACLE instance shut down.

        SQL> startup

        ORACLE instance started.

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              75499284 bytes

        Database Buffers          171966464 bytes

        Redo Buffers                2973696 bytes

        ORA-00205: error in identifying control file, check alert log for more
info

               

        [oracle@robinson ~]$ tail -n 100 /u01/app/oracle/admin/orcl/bdump/alert_orcl.log

        ..........................     

        Tue Jun  8 19:03:42 2010

        starting up 1 shared server(s) ...

        MMON started with pid=11, OS id=4557

        CJQ0 started with pid=10, OS id=4555

        Tue Jun  8 19:03:44 2010

        ALTER DATABASE   MOUNT

        Tue Jun  8 19:03:44 2010

        ORA-00202: control file: '/u01/app/oracle/10g/dbs/ /u01/app/oracle/oradata/orcl/c
ontrol01.ctl'

        ORA-27037: unable to obtain file status

        Linux Error: 2: No such file or directory

        Additional information: 3

        Tue Jun  8 19:03:47 2010

        ORA-205 signalled during: ALTER DATABASE   MOUNT...

 

        --从警告日志中得知,文件名为c ontrol01.ctl的文件不存在,故将其改为正确的文件名

                                                         

        SQL> alter system set control_files='/u01/app/oracle/oradata/orcl/control01.ctl',

          2  '/u01/app/oracle/oradata/orcl/control02.ctl' scope = spfile;

 

        System altered.

 

        SQL> startup force

        ORACLE instance started.

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              83887892 bytes

        Database Buffers          163577856 bytes

        Redo Buffers                2973696 bytes

        Database mounted.

        Database opened.

 

    非归档模式下,当所有的控制文件都丢失,只能重建控制文件来解决

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              79693588 bytes

        Database Buffers          167772160 bytes

        Redo Buffers                2973696 bytes

        ORA-00205: error in identifying control file, check alert log for more
info

       

        [oracle@robinson ~]$tail -n 100 /u01/app/oracle/admin/orcl/bdump/alert_orcl.log

        ALTER DATABASE   MOUNT

        Thu Jul 15 12:13:15 2010

        ORA-00202: control file: '/u01/app/oracle/oradata/orcl/control01.ctl'

        ORA-27037: unable to obtain file status

        Linux Error: 2: No such file or directory

 

        --重建控制文件主要有三个需要考虑的是

        --搞清各个日志文件的大小及位置

        --搞清各个数据文件的位置

        --设置正确的字符集     

 

        SQL> CREATE CONTROLFILE REUSE DATABASE "orcl" NOARCHIVELOG NORESTLOGS

          2  MAXLOGFILES 16

          3  MAXLOGMEMBER 3

          4  MAXDATAFILES 20

          5  MAXINSTANCES 8

          6  MAXLOGHISTORY 3

          7  LOGFILE

          8    GROUP 1(

          9      'u01/app/oracle/oradata/orcl/redo1.log',

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

         11       ) SIZE 50M,

         12    GROUP 2(

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

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

         15       ) SIZE 50M,

         16    GROUP 3(

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

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

         19       ) SIZE 100M 

         20  DATAFILE

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

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

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

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

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

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

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

         28  CHARACTER SET WE8ISO8859P1;

        CREATE CONTROLFILE REUSE DATABASE "orcl" NOARCHIVELOG NORESTLOGS

                                                              *

        ERROR at line 1:

        ORA-01967: invalid option for CREATE CONTROLFILE

 

        SQL> save /u01/app/oracle/oradata/rectl.sql;

        Created file /u01/app/oracle/oradata/rectl.sql

        SQL> ho vim /u01/app/oracle/oradata/rectl.sql

 

        SQL> @/u01/app/oracle/oradata/rectl.sql

 

        Control file created.

 

        --下面给出正确执行后的语句内容

        SQL> host cat /u01/app/oracle/oradata/rectl.sql

        CREATE CONTROLFILE REUSE DATABASE "orcl" NOARCHIVELOG NORESETLOGS

        MAXLOGFILES 16

        MAXLOGMEMBERS 3

        MAXDATAFILES 20

        MAXINSTANCES 8

        MAXLOGHISTORY 3

        LOGFILE

          GROUP 1(

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

             ) SIZE 50M,

          GROUP 2(

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

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

             ) SIZE 50M,

          GROUP 3(

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

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

             ) SIZE 100M

        DATAFILE

          '/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/system01.dbf',

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

        CHARACTER SET WE8ISO8859P1

        /

       

        --将数据库切换到open 状态

        SQL> alter database open;

 

        Database altered.

 

        SQL> select * from dual;

 

        D

        -

        X

       

        --查看已经新产生了控制文件

        SQL> host ls $ORACLE_BASE/oradata/orcl/control* -l  --可以看到新增了控制文件control01.ctl和control02.ctl

        -rw-r----- 1 oracle oinstall 6012928 Jul 15 12:58 /u01/app/oracle/oradata/orcl/control01.ctl

        -rw------- 1 oracle oinstall 7389184 Jul 15 12:04 /u01/app/oracle/oradata/orcl/control01.ctl.bak

        -rw-r----- 1 oracle oinstall 6012928 Jul 15 12:58 /u01/app/oracle/oradata/orcl/control02.ctl

 

    归档模式下控制文件全部丢失的处理

        --首先将数据库切换到归档模式

        SQL> shutdown immediate;

        Database closed.

        Database dismounted.

        ORACLE instance shut down.

        SQL> startup mount;

        ORACLE instance started.

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              79693588 bytes

        Database Buffers          167772160 bytes

        Redo Buffers                2973696 bytes

        Database mounted.

        SQL> alter database archivelog;

        Database altered.

 

        SQL> alter database open  ;

        Database altered.

 

        --查看归档的状态

        SQL> archive log list;

        Database log mode              Archive Mode

        Automatic archival             Enabled

        Archive destination            USE_DB_RECOVERY_FILE_DEST

        Oldest online log sequence     1

        Next log sequence to archive   3

        Current log sequence           3

 

        --备份控制文件

        SQL> alter database backup controlfile to '/u01/app/oracle/oradata/orcl/rectl.bak';

 

        Database altered.

 

        SQL> create table tb_temp(id int,col1 varchar2(20));

 

        Table created.

 

        SQL> insert into tb_temp select 1,'Robinson' from dual;

 

        1 row created.

 

        SQL> commit;

 

        Commit complete.

 

        SQL> alter system switch logfile;   --切换日志

 

        System altered.

 

        SQL> archive log list; --日志切换后sequence由变成

        Database log mode              Archive Mode

        Automatic archival             Enabled

        Archive destination            USE_DB_RECOVERY_FILE_DEST

        Oldest online log sequence     2

        Next log sequence to archive   4

        Current log sequence           4

 

        --模拟控制文件全部丢失

        SQL> startup

        ORACLE instance started.

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              79693588 bytes

        Database Buffers          167772160 bytes

        Redo Buffers                2973696 bytes

        ORA-00205: error in identifying control file, check alert log for more
info

 

        SQL> show parameter control

 

        NAME                                 TYPE        VALUE

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

        control_file_record_keep_time        integer     7

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

                                                         ontrol01.ctl, /u01/app/oracle/

                                                         oradata/orcl/control02.ctl

 

        --查看物理控制文件是否存在                                             

        SQL> ho ls /u01/app/oracle/oradata/orcl/contr*

        ls: /u01/app/oracle/oradata/orcl/contr*: No such file or directory

 

        --建议先对数据库作备份再将备份的控制文件复制到参数文件中指定的位置

 

        SQL> ho cp /u01/app/oracle/oradata/orcl/rectl.bak /u01/app/oracle/oradata/orcl/control01.ctl

 

        SQL> ho cp /u01/app/oracle/oradata/orcl/rectl.bak /u01/app/oracle/oradata/orcl/control02.ctl

 

        SQL> alter database mount;

 

        Database altered.

 

        SQL> alter database open;

        alter database open

        *

        ERROR at line 1:

        ORA-01589: must use RESETLOGS or NORESETLOGS option for database open

 

        SQL> shutdown immediate;

        ORA-01109: database not open

        Database dismounted.

        ORACLE instance shut down.

       

        SQL> startup mount;

        ORACLE instance started.

 

        Total System Global Area  251658240 bytes

        Fixed Size                  1218796 bytes

        Variable Size              79693588 bytes

        Database Buffers          167772160 bytes

        Redo Buffers                2973696 bytes

        Database mounted.

 

        SQL> alter database open resetlogs;

 

        Database altered.

 

        SQL> select * from dual;

 

        D

        -

        X

 

        SQL> select * from tb_temp;  --表成功被恢复

 

                ID COL1

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

                 1 Robinson

 

        SQL> drop table tb_temp purge;

 

        Table dropped.

 

        SQL> archive log list;   --日志的sequence号被置为

        Database log mode              Archive Mode

        Automatic archival             Enabled

        Archive destination            USE_DB_RECOVERY_FILE_DEST

        Oldest online log sequence     1

        Next log sequence to archive   1

        Current log sequence           1

   

    关于从RMAN备份中恢复控制文件,请关注后续Oracle备份与恢复的文章

  http://blog.csdn.net/robinson_0612/article/details/5737527    

时间: 2024-09-07 02:33:36

AG阅读总结8——控制文件管理 *的相关文章

AG阅读总结10.4.2——参数文件管理

参数文件(10g中的参数文件)     主要用来记录数据库的配置文件,在数据库启动时,Oracle读取参数文件,并根据参数文件中的参数设置来配置数据库.     如内存池的分配,允许打开的进程数和会话数等.   两类参数文件:     pfile:文本文件的参数文件,可以使用vi,vim等编辑器修改,文件名通常为init<sid>.ora     spfile:二进制的参数文件,不能直接修改,只能存放在Oracle服务器端,可以使用EM或指令来修改     (alter system|sess

AG阅读总结10.3——密码文件管理*

一.密码文件     作用:主要进行DBA权限的身份认证     DBA用户:具有sysdba,sysoper权限的用户被称为dba用户.默认情况下sysdba角色中存在sys用户,sysoper角色中存在system用户     二.Oracle的两种认证方式:     1.使用与操作系统集成的身份验证     2.使用Oracle数据库的密码文件进行身份认证   三.密码文件的位置     Linux下的存放位置:$ORACLE_HOME/dbs/orapw$ORACLE_SID      

AG阅读总结10.2——数据文件管理

五.数据文件     数据文件是数据库中最重要的一个要求,是所有的数据库内容存放的地方     datafile是按照表空间为组织单位,表空间的构成是按照段区块为层次---数据文件的逻辑结构     datafile就是表空间的物理文件.     datafile中的内容是通过dbwr把data buffer cache中的dirty buffer data 写入的     dbwr触发:         ckpt触发,dirty buffer 到一定量的时候,data buffer caceh

AG阅读总结10.1.1——表空间管理*

原文转自一沙弥的世界:http://blog.csdn.net/robinson_0612/article/details/5611738 一.概念     表空间:是一个或多个数据文件的逻辑集合     表空间逻辑存储对象:永久段-->如表与索引                         临时段-->如临时表数据与排序段                         回滚段-->用于事物回滚或闪回内存的撤销数据     表空间分类:系统表空间(system.sysaux),非系

AG阅读总结5.1——实例启动与关闭

1.启动数据库: 1,.数据库启动的方式:一般有三种方式可以启动数据库,sqlplus,recovery  manager(传说中的RMAN),enterprise manager(传说中的EM). 2.理解初始化参数:初始化参数是干嘛的?其实,就是数据库实例的配置参数,当你运行statup命令的时候,数据库就会去找指定路径下的spfile(首先找spfile$oracle_sid.ora),如果没有找到再去找spfile.ora,这样的话对于rac来说,所有的是例都是根据同一个参数文件启动的,

AG阅读总结5.2——实例启动与关闭

转自一沙弥的世界的博文:原文地址:http://blog.csdn.net/robinson_0612/article/details/5542983     Oracle数据库实例的启动,严格来说应该是实例的启动,数据库仅仅是在实例启动后进行装载.Oracle数据启动的过程被划分为 几个不同的步骤,在不同的启动过程中,我们可以对其实现不同的操作,系统修复等等工作,因此了解Oracle数据启动.关闭是非常 有必要的.下面详细了Oracle Database 10g 数据库启动及关闭的过程.  

AG阅读总结7——跟踪文件总结

一.Oracle跟踪文件     Oracle跟踪文件分为三种类型,一种是后台报警日志文件,记录数据库在启动.关闭和运行期间后台进程的活动情况,如表空间创建.回滚段创建.某些alter命令.日志切换.错误消息等.在数据库出现故障时,应首先查看该文件,但文件中的信息与任何错误状态没有必然的联系. 后台报警日志文件保存BACKGROUND_DUMP_DEST参数指定的目录中,文件格式为 SIDALRT.LOG. 另一种类型是DBWR.LGWR.SMON等后台进程创建的后台跟踪文件.后台跟踪文件根据后

AG阅读总结9.1——日志管理

一.Oracle中的几类日志文件:     Redo log files      -->联机重做日志     Archive log files   -->归档日志     Alert log files     -->告警日志     Trace files         -->跟踪日志     user_dump_dest          -->用户跟踪日志     backupground_dump_dest  -->进程跟踪日志         --查看后

Oracle数据库中的控制文件管理以及常用参数设置_oracle

一.控制文件 作用:         二进制文件         记录了数据库当前实例的结构和行为,数据文件日志文件的信息,维护数据库一致性         参数文件中定义了控制文件的位置和大小         很小的二进制文件,一般不超过100m         mount阶段open以后,一直在用         一套控制文件只能连接一个database         分散放置,至少一份,至多八份 相关视图:         v$controlfile ---- 列出实例的所有控制文件的名