zoukankan      html  css  js  c++  java
  • RMAN(2)--- 基本配置

    1. RMAN的默认配置

     1 RMAN> show all;
     2 
     3 using target database control file instead of recovery catalog
     4 RMAN configuration parameters for database with db_unique_name OCP12C are:
     5 CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
     6 CONFIGURE BACKUP OPTIMIZATION OFF; # default
     7 CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
     8 CONFIGURE CONTROLFILE AUTOBACKUP ON; # default
     9 CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
    10 CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
    11 CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    12 CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
    13 CONFIGURE MAXSETSIZE TO UNLIMITED; # default
    14 CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
    15 CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
    16 CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
    17 CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default    ---- 所有的操作和结果都保存在 v$rman_output视图中,且保留七天
    18 CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
    19 CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.2.0.1/db_1/dbs/snapcf_OCP12C.f'; # default
    20 
    21 RMAN>

     2.  含义

      1. 保留策略

        RMAN> CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default --- 冗余策略,规定至少有几个冗余的备份(默认为1),RMAN会从最新的备份开始保留N个数据备份,其他的会被打标成obsolete(废弃)对于同一个文件,如果备份了两次,则第一次的备份文件会被打标成废弃,RMAN只会寻找最新的备份文件进行恢复,在report obsolete 时,会看到第一次的备份文件,如果把最新的备份文件删除,则rman会寻找第一次备份的文件,此时report obsolete是看不到任何文件的

     1 冗余策略为1,第一次备份15号数据文件
     2 RMAN> backup datafile 15 format '/u01/app/oracle/backup/%U.15bak';
     3 
     4 Starting backup at 2021-01-21 16:39:30
     5 using channel ORA_DISK_1
     6 channel ORA_DISK_1: starting full datafile backup set
     7 channel ORA_DISK_1: specifying datafile(s) in backup set
     8 input datafile file number=00015 name=/u01/app/oracle/oradata/OCP12C/ERP/test01.dbf
     9 channel ORA_DISK_1: starting piece 1 at 2021-01-21 16:39:30
    10 channel ORA_DISK_1: finished piece 1 at 2021-01-21 16:39:31
    11 piece handle=/u01/app/oracle/backup/0jvl6ti2_1_1.15bak tag=TAG20210121T163930 comment=NONE
    12 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
    13 Finished backup at 2021-01-21 16:39:31
    14 
    15 Starting Control File and SPFILE Autobackup at 2021-01-21 16:39:31
    16 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-02 comment=NONE
    17 Finished Control File and SPFILE Autobackup at 2021-01-21 16:39:35
    18 
    19 RMAN> list backup;
    20 
    21 
    22 List of Backup Sets
    23 ===================
    24 
    25 
    26 BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    27 ------- ---- -- ---------- ----------- ------------ -------------------
    28 17      Full    1.04M      DISK        00:00:00     2021-01-21 16:39:30
    29         BP Key: 17   Status: AVAILABLE  Compressed: NO  Tag: TAG20210121T163930
    30         Piece Name: /u01/app/oracle/backup/0jvl6ti2_1_1.15bak
    31   List of Datafiles in backup set 17
    32   Container ID: 3, PDB Name: ERP
    33   File LV Type Ckp SCN    Ckp Time            Abs Fuz SCN Sparse Name
    34   ---- -- ---- ---------- ------------------- ----------- ------ ----
    35   15      Full 5982209    2021-01-21 16:39:30              NO    /u01/app/oracle/oradata/OCP12C/ERP/test01.dbf
    36 
    37 BS Key  Type LV Size       Device Type Elapsed Time Completion Time
    38 ------- ---- -- ---------- ----------- ------------ -------------------
    39 18      Full    18.25M     DISK        00:00:02     2021-01-21 16:39:34
    40         BP Key: 18   Status: AVAILABLE  Compressed: NO  Tag: TAG20210121T163932
    41         Piece Name: /u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-02
    42   SPFILE Included: Modification time: 2021-01-21 11:00:59
    43   SPFILE db_unique_name: OCP12C
    44   Control File Included: Ckp SCN: 5982219      Ckp time: 2021-01-21 16:39:32
    45 
    46 RMAN> report obsolete;
    47 
    48 RMAN retention policy will be applied to the command
    49 RMAN retention policy is set to redundancy 1
    50 Report of obsolete backups and copies
    51 Type                 Key    Completion Time    Filename/Handle
    52 -------------------- ------ ------------------ --------------------
    53 Control File Copy     1      2021-01-17 12:45:29 /u01/app/oracle/backup/cdb/bak.ctl ----之前废弃的文件
    54 
    55 第二次备份15号文件
    56 RMAN> backup datafile 15 format '/u01/app/oracle/backup/%U.15bak';
    57 
    58 Starting backup at 2021-01-21 16:40:31
    59 using channel ORA_DISK_1
    60 channel ORA_DISK_1: starting full datafile backup set
    61 channel ORA_DISK_1: specifying datafile(s) in backup set
    62 input datafile file number=00015 name=/u01/app/oracle/oradata/OCP12C/ERP/test01.dbf
    63 channel ORA_DISK_1: starting piece 1 at 2021-01-21 16:40:32
    64 channel ORA_DISK_1: finished piece 1 at 2021-01-21 16:40:33
    65 piece handle=/u01/app/oracle/backup/0lvl6tk0_1_1.15bak tag=TAG20210121T164031 comment=NONE
    66 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
    67 Finished backup at 2021-01-21 16:40:33
    68 
    69 Starting Control File and SPFILE Autobackup at 2021-01-21 16:40:33
    70 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-03 comment=NONE
    71 Finished Control File and SPFILE Autobackup at 2021-01-21 16:40:34
    72 
    73 RMAN> report obsolete;
    74 
    75 RMAN retention policy will be applied to the command
    76 RMAN retention policy is set to redundancy 1
    77 Report of obsolete backups and copies
    78 Type                 Key    Completion Time    Filename/Handle
    79 -------------------- ------ ------------------ --------------------
    80 Control File Copy     1      2021-01-17 12:45:29 /u01/app/oracle/backup/cdb/bak.ctl
    81 Backup Set           17     2021-01-21 16:39:30
    82   Backup Piece       17     2021-01-21 16:39:30 /u01/app/oracle/backup/0jvl6ti2_1_1.15bak ---将第一次备份的文件标记成了obsolete
    View Code

        RMAN> CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS; --- 时间窗口策略 ---- 使用这种保留策略意味着,在恢复窗口期的数据,任何地方出问题,RMAN都要通过保留策略保存的备份恢复出来。注意:恢复窗口是个时间段,和这个时间段有无备份,或有多少备份无关。窗口期内的任意一点被损坏,都要能保证备份文件被恢复,所以窗口期前的一份备份是不会被标记为 obsolete的

        RMAN> CONFIGURE RETENTION POLICY TO NONE; ---- 将保留策略设置成NONE后,不会有任何一个备份被标记成obsolete。

      注意:保留策略只能选择其中一个,不能同时设置多个

      2. 备份优化

        RMAN> CONFIGURE BACKUP OPTIMIZATION OFF; # default  --- 默认是关闭,如果开启了备份优化,可以避免重复备份,只用于归档日志,只读,或脱机表空间的数据文件,备份优化选项依赖于RETENTION POLICY策略,如果启用优化,在已有足够相同文件副本的情况下,采用(N+1),RMAN将不创建额外的文件副本。

      1 先将其中一个表空间设置成只读模式
      2 SQL> alter tablespace hehe read only;
      3 
      4 Tablespace altered.
      5 
      6 SQL> select tablespace_name, status from dba_tablespaces where tablespace_name='HEHE';
      7 
      8 TABLESPACE_NAME                          STATUS
      9 ------------------------------------------------------------ ------------------
     10 HEHE                                 READ ONLY
     11 
     12 开启备份优化
     13 RMAN> CONFIGURE BACKUP OPTIMIZATION on;
     14 
     15 new RMAN configuration parameters:
     16 CONFIGURE BACKUP OPTIMIZATION ON;
     17 new RMAN configuration parameters are successfully stored
     18 
     19 进行三次同样的备份,查看第二次和第三次的区别(冗余策略是1)
     20 RMAN> backup database format '/u01/app/oracle/backup/%U.full';
     21 
     22 Starting backup at 2021-01-21 17:21:58
     23 using channel ORA_DISK_1
     24 channel ORA_DISK_1: starting full datafile backup set
     25 channel ORA_DISK_1: specifying datafile(s) in backup set
     26 input datafile file number=00003 name=/u01/app/oracle/oradata/OCP12C/sysaux01.dbf
     27 input datafile file number=00001 name=/u01/app/oracle/oradata/OCP12C/system01.dbf
     28 input datafile file number=00004 name=/u01/app/oracle/oradata/OCP12C/undotbs01.dbf
     29 input datafile file number=00007 name=/u01/app/oracle/oradata/OCP12C/users01.dbf
     30 input datafile file number=00016 name=/u01/app/oracle/oradata/OCP12C/hehe01.dbf
     31 input datafile file number=00017 name=/u01/app/oracle/oradata/OCP12C/memeda01.dbf
     32 input datafile file number=00019 name=/u01/app/oracle/oradata/OCP12C/xxp01.dbf
     33 input datafile file number=00020 name=/u01/app/oracle/oradata/OCP12C/aaa01.dbf
     34 input datafile file number=00023 name=/u01/app/oracle/backup/lalala01.dbf
     35 channel ORA_DISK_1: starting piece 1 at 2021-01-21 17:21:59
     36 
     37 
     38 channel ORA_DISK_1: finished piece 1 at 2021-01-21 17:27:34
     39 piece handle=/u01/app/oracle/backup/0vvl701n_1_1.full tag=TAG20210121T172158 comment=NONE
     40 channel ORA_DISK_1: backup set complete, elapsed time: 00:05:35
     41 channel ORA_DISK_1: starting full datafile backup set
     42 channel ORA_DISK_1: specifying datafile(s) in backup set
     43 input datafile file number=00010 name=/u01/app/oracle/oradata/OCP12C/ERP/sysaux01.dbf
     44 input datafile file number=00009 name=/u01/app/oracle/oradata/OCP12C/ERP/system01.dbf
     45 input datafile file number=00011 name=/u01/app/oracle/oradata/OCP12C/ERP/undotbs01.dbf
     46 input datafile file number=00012 name=/u01/app/oracle/oradata/OCP12C/ERP/users01.dbf
     47 input datafile file number=00015 name=/u01/app/oracle/oradata/OCP12C/ERP/test01.dbf
     48 input datafile file number=00018 name=/u01/app/oracle/oradata/OCP12C/ERP/xxp01.dbf
     49 input datafile file number=00021 name=/u01/app/oracle/backup/aaa01.dbf
     50 input datafile file number=00022 name=/u01/app/oracle/oradata/OCP12C/ERP/lalala01.dbf
     51 channel ORA_DISK_1: starting piece 1 at 2021-01-21 17:27:35
     52 channel ORA_DISK_1: finished piece 1 at 2021-01-21 17:28:10
     53 piece handle=/u01/app/oracle/backup/10vl70c6_1_1.full tag=TAG20210121T172158 comment=NONE
     54 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
     55 channel ORA_DISK_1: starting full datafile backup set
     56 channel ORA_DISK_1: specifying datafile(s) in backup set
     57 input datafile file number=00006 name=/u01/app/oracle/oradata/OCP12C/pdbseed/sysaux01.dbf
     58 input datafile file number=00005 name=/u01/app/oracle/oradata/OCP12C/pdbseed/system01.dbf
     59 input datafile file number=00008 name=/u01/app/oracle/oradata/OCP12C/pdbseed/undotbs01.dbf
     60 channel ORA_DISK_1: starting piece 1 at 2021-01-21 17:28:10
     61 channel ORA_DISK_1: finished piece 1 at 2021-01-21 17:28:36
     62 piece handle=/u01/app/oracle/backup/11vl70da_1_1.full tag=TAG20210121T172158 comment=NONE
     63 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
     64 Finished backup at 2021-01-21 17:28:36
     65 
     66 Starting Control File and SPFILE Autobackup at 2021-01-21 17:28:36
     67 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-07 comment=NONE
     68 Finished Control File and SPFILE Autobackup at 2021-01-21 17:28:39
     69 
     70 RMAN>
     71 RMAN>
     72 RMAN> backup database format '/u01/app/oracle/backup/%U.full';
     73 
     74 Starting backup at 2021-01-21 17:29:58
     75 using channel ORA_DISK_1
     76 channel ORA_DISK_1: starting full datafile backup set
     77 channel ORA_DISK_1: specifying datafile(s) in backup set
     78 input datafile file number=00003 name=/u01/app/oracle/oradata/OCP12C/sysaux01.dbf
     79 input datafile file number=00001 name=/u01/app/oracle/oradata/OCP12C/system01.dbf
     80 input datafile file number=00004 name=/u01/app/oracle/oradata/OCP12C/undotbs01.dbf
     81 input datafile file number=00007 name=/u01/app/oracle/oradata/OCP12C/users01.dbf
     82 input datafile file number=00016 name=/u01/app/oracle/oradata/OCP12C/hehe01.dbf
     83 input datafile file number=00017 name=/u01/app/oracle/oradata/OCP12C/memeda01.dbf
     84 input datafile file number=00019 name=/u01/app/oracle/oradata/OCP12C/xxp01.dbf
     85 input datafile file number=00020 name=/u01/app/oracle/oradata/OCP12C/aaa01.dbf
     86 input datafile file number=00023 name=/u01/app/oracle/backup/lalala01.dbf
     87 channel ORA_DISK_1: starting piece 1 at 2021-01-21 17:29:58
     88 channel ORA_DISK_1: finished piece 1 at 2021-01-21 17:31:15
     89 piece handle=/u01/app/oracle/backup/13vl70gm_1_1.full tag=TAG20210121T172958 comment=NONE
     90 channel ORA_DISK_1: backup set complete, elapsed time: 00:01:17
     91 channel ORA_DISK_1: starting full datafile backup set
     92 channel ORA_DISK_1: specifying datafile(s) in backup set
     93 input datafile file number=00010 name=/u01/app/oracle/oradata/OCP12C/ERP/sysaux01.dbf
     94 input datafile file number=00009 name=/u01/app/oracle/oradata/OCP12C/ERP/system01.dbf
     95 input datafile file number=00011 name=/u01/app/oracle/oradata/OCP12C/ERP/undotbs01.dbf
     96 input datafile file number=00012 name=/u01/app/oracle/oradata/OCP12C/ERP/users01.dbf
     97 input datafile file number=00015 name=/u01/app/oracle/oradata/OCP12C/ERP/test01.dbf
     98 input datafile file number=00018 name=/u01/app/oracle/oradata/OCP12C/ERP/xxp01.dbf
     99 input datafile file number=00021 name=/u01/app/oracle/backup/aaa01.dbf
    100 input datafile file number=00022 name=/u01/app/oracle/oradata/OCP12C/ERP/lalala01.dbf
    101 channel ORA_DISK_1: starting piece 1 at 2021-01-21 17:31:16
    102 channel ORA_DISK_1: finished piece 1 at 2021-01-21 17:31:51
    103 piece handle=/u01/app/oracle/backup/14vl70j4_1_1.full tag=TAG20210121T172958 comment=NONE
    104 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
    105 channel ORA_DISK_1: starting full datafile backup set
    106 channel ORA_DISK_1: specifying datafile(s) in backup set
    107 input datafile file number=00006 name=/u01/app/oracle/oradata/OCP12C/pdbseed/sysaux01.dbf
    108 input datafile file number=00005 name=/u01/app/oracle/oradata/OCP12C/pdbseed/system01.dbf
    109 input datafile file number=00008 name=/u01/app/oracle/oradata/OCP12C/pdbseed/undotbs01.dbf
    110 channel ORA_DISK_1: starting piece 1 at 2021-01-21 17:31:51
    111 channel ORA_DISK_1: finished piece 1 at 2021-01-21 17:32:17
    112 piece handle=/u01/app/oracle/backup/15vl70k7_1_1.full tag=TAG20210121T172958 comment=NONE
    113 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:26
    114 Finished backup at 2021-01-21 17:32:17
    115 
    116 Starting Control File and SPFILE Autobackup at 2021-01-21 17:32:17
    117 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-08 comment=NONE
    118 Finished Control File and SPFILE Autobackup at 2021-01-21 17:32:18
    119 
    120 RMAN> backup database format '/u01/app/oracle/backup/%U.full';
    121 
    122 Starting backup at 2021-01-21 17:33:22
    123 using channel ORA_DISK_1
    124 skipping datafile 5; already backed up 2 time(s)
    125 skipping datafile 6; already backed up 2 time(s)
    126 skipping datafile 8; already backed up 2 time(s)
    127 skipping datafile 16; already backed up 2 time(s)
    128 channel ORA_DISK_1: starting full datafile backup set
    129 channel ORA_DISK_1: specifying datafile(s) in backup set
    130 input datafile file number=00003 name=/u01/app/oracle/oradata/OCP12C/sysaux01.dbf
    131 input datafile file number=00001 name=/u01/app/oracle/oradata/OCP12C/system01.dbf
    132 input datafile file number=00004 name=/u01/app/oracle/oradata/OCP12C/undotbs01.dbf
    133 input datafile file number=00007 name=/u01/app/oracle/oradata/OCP12C/users01.dbf
    134 input datafile file number=00017 name=/u01/app/oracle/oradata/OCP12C/memeda01.dbf
    135 input datafile file number=00019 name=/u01/app/oracle/oradata/OCP12C/xxp01.dbf
    136 input datafile file number=00020 name=/u01/app/oracle/oradata/OCP12C/aaa01.dbf
    137 input datafile file number=00023 name=/u01/app/oracle/backup/lalala01.dbf
    138 channel ORA_DISK_1: starting piece 1 at 2021-01-21 17:33:23
    139 channel ORA_DISK_1: finished piece 1 at 2021-01-21 17:34:39
    140 piece handle=/u01/app/oracle/backup/17vl70n3_1_1.full tag=TAG20210121T173323 comment=NONE
    141 channel ORA_DISK_1: backup set complete, elapsed time: 00:01:16
    142 channel ORA_DISK_1: starting full datafile backup set
    143 channel ORA_DISK_1: specifying datafile(s) in backup set
    144 input datafile file number=00010 name=/u01/app/oracle/oradata/OCP12C/ERP/sysaux01.dbf
    145 input datafile file number=00009 name=/u01/app/oracle/oradata/OCP12C/ERP/system01.dbf
    146 input datafile file number=00011 name=/u01/app/oracle/oradata/OCP12C/ERP/undotbs01.dbf
    147 input datafile file number=00012 name=/u01/app/oracle/oradata/OCP12C/ERP/users01.dbf
    148 input datafile file number=00015 name=/u01/app/oracle/oradata/OCP12C/ERP/test01.dbf
    149 input datafile file number=00018 name=/u01/app/oracle/oradata/OCP12C/ERP/xxp01.dbf
    150 input datafile file number=00021 name=/u01/app/oracle/backup/aaa01.dbf
    151 input datafile file number=00022 name=/u01/app/oracle/oradata/OCP12C/ERP/lalala01.dbf
    152 channel ORA_DISK_1: starting piece 1 at 2021-01-21 17:34:39
    153 channel ORA_DISK_1: finished piece 1 at 2021-01-21 17:35:04
    154 piece handle=/u01/app/oracle/backup/18vl70pf_1_1.full tag=TAG20210121T173323 comment=NONE
    155 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:25
    156 Finished backup at 2021-01-21 17:35:04
    157 
    158 Starting Control File and SPFILE Autobackup at 2021-01-21 17:35:05
    159 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-09 comment=NONE
    160 Finished Control File and SPFILE Autobackup at 2021-01-21 17:35:06
    161 
    162 可以发现在第三次备份的时候,直接跳过了 5/6/8/16号数据文件(只读),采用了N+1,不再创建额外的副本
    备份优化实验

      3. 设备类型

        RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default  ---  可以是磁盘(DISK),或者是磁带(STB),默认是磁盘

      4. 控制文件是否自动备份

        RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON; # default --- 默认是打开的,当设置成OFF,在备份system表空间时,也会自动备份控制文件和SPFILE

      5. 控制文件备份路径与格式

        RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default  --- format 指明备份文件的路径和文件名 %F只能用在备份控制文件中

        官文:https://docs.oracle.com/en/database/oracle/oracle-database/19/bradv/configuring-rman-client-basic.html#GUID-C64AE090-0749-43EA-92C4-69DC6201A15F 

      6. 并行度

        RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default  ----- 如果在RUN{}中指定了通道配置,将覆盖掉配置参数中指定的默认并行度

     1 并行度为1时,只开辟一个通道
     2 RMAN> backup datafile 16 format '/u01/app/oracle/backup/%U.16bak';
     3 
     4 Starting backup at 2021-01-21 18:34:53
     5 using channel ORA_DISK_1
     6 channel ORA_DISK_1: starting full datafile backup set
     7 channel ORA_DISK_1: specifying datafile(s) in backup set
     8 input datafile file number=00016 name=/u01/app/oracle/oradata/OCP12C/hehe01.dbf
     9 channel ORA_DISK_1: starting piece 1 at 2021-01-21 18:34:53
    10 channel ORA_DISK_1: finished piece 1 at 2021-01-21 18:34:54
    11 piece handle=/u01/app/oracle/backup/1avl74ad_1_1.16bak tag=TAG20210121T183453 comment=NONE
    12 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
    13 Finished backup at 2021-01-21 18:34:54
    14 
    15 Starting Control File and SPFILE Autobackup at 2021-01-21 18:34:54
    16 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-0a comment=NONE
    17 Finished Control File and SPFILE Autobackup at 2021-01-21 18:34:56
    18 
    19 RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
    20 
    21 new RMAN configuration parameters:
    22 CONFIGURE DEVICE TYPE DISK PARALLELISM 2 BACKUP TYPE TO BACKUPSET;
    23 new RMAN configuration parameters are successfully stored
    24 released channel: ORA_DISK_1
    25 并行度设置成2,则开辟两个通道
    26 RMAN> backup datafile 16 format '/u01/app/oracle/backup/%U.16bak';
    27 
    28 Starting backup at 2021-01-21 18:35:25
    29 allocated channel: ORA_DISK_1
    30 channel ORA_DISK_1: SID=25 device type=DISK
    31 allocated channel: ORA_DISK_2
    32 channel ORA_DISK_2: SID=1 device type=DISK
    33 channel ORA_DISK_1: starting full datafile backup set
    34 channel ORA_DISK_1: specifying datafile(s) in backup set
    35 input datafile file number=00016 name=/u01/app/oracle/oradata/OCP12C/hehe01.dbf
    36 channel ORA_DISK_1: starting piece 1 at 2021-01-21 18:35:27
    37 channel ORA_DISK_1: finished piece 1 at 2021-01-21 18:35:28
    38 piece handle=/u01/app/oracle/backup/1cvl74bf_1_1.16bak tag=TAG20210121T183526 comment=NONE
    39 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
    40 Finished backup at 2021-01-21 18:35:28
    41 
    42 Starting Control File and SPFILE Autobackup at 2021-01-21 18:35:28
    43 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-0b comment=NONE
    44 Finished Control File and SPFILE Autobackup at 2021-01-21 18:35:29
    45 
    46 RMAN>
    并行度实验

      7. 备份集多路复用(印象备份不能)

        RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default ---- 最大值是4,如果为2则备份相同的两份,注意:TO STB 和 TO DISK 是独立的,不能同时以DISK 和 TAPE 多路复用

     1 RMAN> CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
     2 
     3 new RMAN configuration parameters:
     4 CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 2;
     5 new RMAN configuration parameters are successfully stored
     6 
     7 RMAN> backup datafile 16 format '/u01/app/oracle/backup/%U.16bak','/u01/app/oracle/%U.16bak';
     8 
     9 Starting backup at 2021-01-21 18:44:52
    10 allocated channel: ORA_DISK_1
    11 channel ORA_DISK_1: SID=25 device type=DISK
    12 channel ORA_DISK_1: starting full datafile backup set
    13 channel ORA_DISK_1: specifying datafile(s) in backup set
    14 input datafile file number=00016 name=/u01/app/oracle/oradata/OCP12C/hehe01.dbf
    15 channel ORA_DISK_1: starting piece 1 at 2021-01-21 18:44:52
    16 channel ORA_DISK_1: finished piece 1 at 2021-01-21 18:44:53 with 2 copies and tag TAG20210121T184452
    17 piece handle=/u01/app/oracle/backup/1evl74t4_1_1.16bak comment=NONE
    18 piece handle=/u01/app/oracle/1evl74t4_1_2.16bak comment=NONE
    19 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
    20 Finished backup at 2021-01-21 18:44:53
    21 
    22 Starting Control File and SPFILE Autobackup at 2021-01-21 18:44:54
    23 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-0c comment=NONE
    24 Finished Control File and SPFILE Autobackup at 2021-01-21 18:44:55
    25 
    26 RMAN> backup datafile 16 format '/u01/app/oracle/backup/%U.16bak';
    27 
    28 Starting backup at 2021-01-21 18:45:18
    29 using channel ORA_DISK_1
    30 channel ORA_DISK_1: starting full datafile backup set
    31 channel ORA_DISK_1: specifying datafile(s) in backup set
    32 input datafile file number=00016 name=/u01/app/oracle/oradata/OCP12C/hehe01.dbf
    33 channel ORA_DISK_1: starting piece 1 at 2021-01-21 18:45:18
    34 channel ORA_DISK_1: finished piece 1 at 2021-01-21 18:45:20 with 2 copies and tag TAG20210121T184518
    35 piece handle=/u01/app/oracle/backup/1gvl74tu_1_1.16bak comment=NONE
    36 piece handle=/u01/app/oracle/backup/1gvl74tu_1_2.16bak comment=NONE
    37 channel ORA_DISK_1: backup set complete, elapsed time: 00:00:02
    38 Finished backup at 2021-01-21 18:45:20
    39 
    40 Starting Control File and SPFILE Autobackup at 2021-01-21 18:45:20
    41 piece handle=/u01/app/oracle/product/12.2.0.1/db_1/dbs/c-671397679-20210121-0d comment=NONE
    42 Finished Control File and SPFILE Autobackup at 2021-01-21 18:45:21
    43 
    44 设置成2后,可以发现在备份的时候 piece handle 会有两个路径
    备份多路复用 

    3. 分类

      1. BACKUPSET:不备份datafile里从未使用块(HWM以上)、可以实现增量备份(可以备份到disk和tape)。如果只启用一个channel,默认会把所有备份的datafile放入到一个backupset里,并且生成一个备份片backup piece。

      2. IMAGE COPY(映像备份):实际上和手工cp 类似的,备份datafile所有的数据块,不能作为增量备份的基础(即0级增量备份),只能备份到disk,不能备份到tape,因可以省略还原步骤,所以恢复数据库速度快

  • 相关阅读:
    Kubernetes Admission Controller解析
    容器化Node Exporter对主机磁盘使用率的监控问题
    Prometheus监控指标的label注入方法
    Prometheus告警模型分析
    Kubernetes Controller执行框架解析
    深入理解Istio核心组件之Pilot
    Prometheus存储模型分析
    如何利用Prometheus监控你的应用
    Prometheus在Kubernetes下的服务发现机制
    JSON字符串和js对象转换
  • 原文地址:https://www.cnblogs.com/eniniemand/p/14309747.html
Copyright © 2011-2022 走看看