ORACLE_OCP之RMAN_JOB
1、RMAN FORMAT格式参数的意义:
- %d:数据库名
- %T:备份的日期
- %s:备份集
- %p:备份片
2、完整的RMAN JOB:
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup database format '/full/full_%d_%T_%s_%p';
}
RMAN> show all;
using target database control file instead of recovery catalog
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON; # 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 COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZE FOR LOAD TRUE ; # default
CONFIGURE RMAN OUTPUT TO KEEP FOR 7 DAYS; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/12.2.0/db_1/dbs/snapcf_orcl.f'; # default
run{
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
backup database format '/full/full_%d_%T_%s_%p';
6> }
allocated channel: c1
channel c1: SID=266 device type=DISK
allocated channel: c2
channel c2: SID=392 device type=DISK
allocated channel: c3
channel c3: SID=18 device type=DISK
Starting backup at 2021-01-02 07:18:15
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf
input datafile file number=00007 name=/u01/app/oracle/oradata/orcl/users01.dbf
channel c1: starting piece 1 at 2021-01-02 07:18:15
channel c2: starting full datafile backup set
channel c2: specifying datafile(s) in backup set
input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf
channel c2: starting piece 1 at 2021-01-02 07:18:15
channel c3: starting full datafile backup set
channel c3: specifying datafile(s) in backup set
input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/undotbs2_01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/undo02.dbf
channel c3: starting piece 1 at 2021-01-02 07:18:15
channel c3: finished piece 1 at 2021-01-02 07:18:16
piece handle=/full/full_ORCL_20210102_11_1 tag=TAG20210102T071815 comment=NONE
channel c3: backup set complete, elapsed time: 00:00:01
channel c1: finished piece 1 at 2021-01-02 07:18:30
piece handle=/full/full_ORCL_20210102_9_1 tag=TAG20210102T071815 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:15
channel c2: finished piece 1 at 2021-01-02 07:18:30
piece handle=/full/full_ORCL_20210102_10_1 tag=TAG20210102T071815 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:15
Finished backup at 2021-01-02 07:18:30
Starting Control File and SPFILE Autobackup at 2021-01-02 07:18:30
piece handle=/u01/app/oracle/product/12.2.0/db_1/dbs/c-1587326136-20210102-00 comment=NONE
Finished Control File and SPFILE Autobackup at 2021-01-02 07:18:32
released channel: c1
released channel: c2
released channel: c3
RMAN>
3、这里我们修改相关的并发度
注意:并发度的这个设置值遇到手工分配通道的话,以手工分配通道为准,如果没有手工通道的话,以设置的值为准。
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters:
CONFIGURE DEVICE TYPE DISK PARALLELISM 4 BACKUP TYPE TO BACKUPSET;
new RMAN configuration parameters are successfully stored
RMAN>
- 备份,走四个通道
RMAN> backup database format '/full/full_%d_%T_%s_%p'; Starting backup at 2021-01-02 07:22:12 allocated channel: ORA_DISK_1 channel ORA_DISK_1: SID=266 device type=DISK allocated channel: ORA_DISK_2 channel ORA_DISK_2: SID=392 device type=DISK allocated channel: ORA_DISK_3 channel ORA_DISK_3: SID=18 device type=DISK allocated channel: ORA_DISK_4 channel ORA_DISK_4: SID=140 device type=DISK channel ORA_DISK_1: starting full datafile backup set channel ORA_DISK_1: specifying datafile(s) in backup set input datafile file number=00001 name=/u01/app/oracle/oradata/orcl/system01.dbf input datafile file number=00007 name=/u01/app/oracle/oradata/orcl/users01.dbf channel ORA_DISK_1: starting piece 1 at 2021-01-02 07:22:13 channel ORA_DISK_2: starting full datafile backup set channel ORA_DISK_2: specifying datafile(s) in backup set input datafile file number=00003 name=/u01/app/oracle/oradata/orcl/sysaux01.dbf input datafile file number=00004 name=/u01/app/oracle/oradata/orcl/undotbs01.dbf channel ORA_DISK_2: starting piece 1 at 2021-01-02 07:22:13 channel ORA_DISK_3: starting full datafile backup set channel ORA_DISK_3: specifying datafile(s) in backup set input datafile file number=00002 name=/u01/app/oracle/oradata/orcl/undotbs2_01.dbf input datafile file number=00005 name=/u01/app/oracle/oradata/orcl/undo02.dbf channel ORA_DISK_3: starting piece 1 at 2021-01-02 07:22:13 channel ORA_DISK_3: finished piece 1 at 2021-01-02 07:22:14 piece handle=/full/full_ORCL_20210102_15_1 tag=TAG20210102T072213 comment=NONE channel ORA_DISK_3: backup set complete, elapsed time: 00:00:01 channel ORA_DISK_1: finished piece 1 at 2021-01-02 07:22:20 piece handle=/full/full_ORCL_20210102_13_1 tag=TAG20210102T072213 comment=NONE channel ORA_DISK_1: backup set complete, elapsed time: 00:00:07 channel ORA_DISK_2: finished piece 1 at 2021-01-02 07:22:20 piece handle=/full/full_ORCL_20210102_14_1 tag=TAG20210102T072213 comment=NONE channel ORA_DISK_2: backup set complete, elapsed time: 00:00:07 Finished backup at 2021-01-02 07:22:20 Starting Control File and SPFILE Autobackup at 2021-01-02 07:22:20 piece handle=/u01/app/oracle/product/12.2.0/db_1/dbs/c-1587326136-20210102-01 comment=NONE Finished Control File and SPFILE Autobackup at 2021-01-02 07:22:21 RMAN>
4、独立备份控制文件和参数文件命令:
backup current controlfile format ‘/full/bak/ctl_%d_%T_%s_%p’;
backup spfile format ‘/full/bak/%d_%U.spfile’;