1.7.3.1 Concurrency:
Mainly used to improve the speed of backup, can be divided into manual concurrency or automatic concurrency
Manual concurrency: By assigning multiple channels and assigning files to a specific channel
Rman> Run {
2> Allocate channel CH1 device type disk;
3> Allocate channel CH2 device type disk;
4> Allocate channel CH3 device type disk;
5> Backup Incremental Level=0
6> format '/u01/app/oracle/rmanbak/df_%d_%u '
7> (datafile 1 channel ch1 tag= ' sys ')
8> (datafile 3 channel ch2 tag= ' aux ')
9> (datafile 2,4,5,6 channel CH3 tag= ' other ');
10> SQL ' alter system archive log current ';
11> release channel CH1;
12> release channel CH2;
13> release channel CH3;
14>}
Automatic Concurrency: Configure concurrency with Configure
Rman> Configure device type disk parallelism 3 backup type to backupset;
--The following backup will automatically enable channel execution concurrency
Rman> Backup Database format '/u01/app/oralce/rmanbak/p3_%u ';
1.7.3.2 Multiplexing Backup
Copy multiple copies of a backup set, the same backup set, Oracle can reuse a maximum of
Manual designation:
Rman> backup copies 2 datafile 4
2> format '/u01/app/oracle/rmanbak/d1/df_%u ',
3> '/u01/app/oracle/rmanbak/d2/df_%u ';
Auto-Specify: Configure the following parameters
Rman> Configure DataFile backup copies for device type disk to 2; --Specify the number of copies of backup data files
Rman> Configure Archivelog backup copies for device type disk to 2;--specify the number of copies of backup log files
1.7.3.3 Backing up backup sets
Backup Backupset
1.7.3.4 Mirrored Backup
Mirror backup checks for bad blocks in the data file, you can use Nochecksum to skip bad block detection
You can also specify maxcorrupt to determine how many bad blocks Oracle will stop the mirrored backup
rman> Backup as Copy
2> datafile 4 format '/u01/app/oracle/rmanbak/users.dbf ' tag= ' users '
--The following command is equivalent to the previous
Rman> copy datafile 4 to '/u01/app/oracle/rmanbak/user01.dbf ';
rman> Backup as Copy
2> archivelog like ' O1_mf_1_118_6chl1byd_.arc '
3> format '/u01/app/oracle/rmanbak/arch_1015.bak ';
--After setting backup type to copy using the following configure command, the default backup is a mirrored copy
Rman> Configure device type disk parallelism 1 backup type to copy;
Rman> Backup DataFile 4--because of the above settings, this command will be backed up by a mirrored copy
2> format '/u01/app/oracle/rmanbak/users.dbf.bak ' tag=users;
--use parallelism to perform mirrored copies
Rman> Configure device type disk parallelism 4;
rman> Backup as copy #3 files copied in parallel
2> (datafile 1 format '/u01/app/oracle/rmanbak/df1.bak ')
3> (datafile 2 format '/u01/app/oracle/rmanbak/df2.bak ')
4> (datafile 3 format '/u01/app/oracle/rmanbak/df3.bak ');
When mirroring a backup, specify clause Db_file_name_convert to implement a mirrored path transfer, which is also an initialization parameter for primary DB to standby DB
The conversion of the data file
Db_file_name_convert = (' string1 ', ' string2 ', ' string3 ', ' String4 ' ...)
Replace String1,string4 with string2 replace String3
rman> Backup as Copy device type disk
2> db_file_name_convert (' Oradata/orcl ', ' BK/RMBK ')
3> tablespace users;
1.7.3.5 compressing backup Sets
Rman> Configure channel Device type disk format '/u01/app/oracle/rmanbak/%d_%u.bak ';
--The following command uses the parameter as compressed to achieve manual compression
Rman> Backup as compressed backupset database;
Rman> Backup as compressed backupset datafile 4,5,6;
--The following uses the Configure command to configure the auto-compress backup set feature, and subsequent backups automatically use the compression feature
Rman> Configure device type disk parallelism 4 backup type to compressed backupset;
--because automatic compression is set, the following command compresses the backup system tablespace and control file, parameter file
Rman> backup tablespace system tag=system;
1.7.3.6 using tag tags
The tag tag can specify a meaningful name for the backup set or image copy for later use, with the following advantages:
Provide descriptive information for a backup set or image copy
Ability to use better location backup files in the list command
Ability to use in Restore and switch commands
The same tag is used in multiple backup sets or multiple image replicas
When the tag tag is not specified, the system produces the default tag tag, in the format: TAGYYYYMMDDTHHMMSS
Rman> Backup as compressed backupset datafile tag= ' Monthly_full_bak ';
Rman> Backup as compressed backupset tablespace users tag= ' Weekly_full_bak ';
rman> list backupset Tag=monthly_full_bak;
1.7.3.7 Incremental Backup
Differential incremental backup backs up all data blocks that have changed since the last incremental backup
Cumulative incremental backup backs up all changed blocks since the last-level incremental backup
--Enable level incremental backup below
Rman> run{
2> Allocate channel CH1 type disk;
3> Backup Incremental Level 0 database
4> format '/u01/app/oracle/rmanbak/db_%d_%u '
5> Tag=db_inc_0;
6> release channel CH1;
7>}
Sql> select Sid,sofar,totalwork from V$session_longops; --Query Backup status
--Enable level differential incremental backup below
Rman> run{
2> Allocate channel CH1 type disk;
3> Backup Incremental Level 1 database
4> format '/u01/app/oracle/rmanbak/db1_%d_%u '
5> tag=db_inc_1;
6> release channel CH1;
7>}
--Enable level cumulative incremental backup below
Rman> run{
2> Allocate channel CH1 type disk;
3> Backup Incremental Level 1 cumulative database
4> format '/u01/app/oracle/rmanbak/dbc_%d_%u '
5> tag=db_inc_c_1;
6> release channel CH1;
7>}
1.7.3.8 Enable block change tracking
Enabling block change tracking specifies that a file is used to record which blocks in the data file have changed, and when Ramn makes an incremental backup, it simply needs to read the file to back up the
Changed blocks, which reduces backup time and I/O resources.
Use the following command to enable block change tracking
ALTER DATABASE ENABLE BLOCK change TRACKING USING FILE ' <dir> '
Sql> ALTER DATABASE enable block change tracking
2 using file '/U01/APP/ORACLE/ORADATA/ORCL/BLK_CH_TRC.TRC ';
Sql> Ho ls-lht/u01/app/oracle/oradata/orcl/blk_ch_trc.trc
-RW-R-----1 Oracle oinstall 12M Oct 19:41/U01/APP/ORACLE/ORADATA/ORCL/BLK_CH_TRC.TRC
Sql> select * from v$block_change_tracking;
STATUS FILENAME BYTES
---------- --------------------------------------------- ----------
ENABLED/U01/APP/ORACLE/ORADATA/ORCL/BLK_CH_TRC.TRC 11599872
Sql> ALTER DATABASE disable block change tracking; --disable after block change tracking file is automatically deleted
Sql> select * from v$block_change_tracking;
STATUS FILENAME BYTES
---------- --------------------------------------------- ----------
DISABLED
1.7.3.9 Backup Retention Policy
Retention policies are primarily rules that retain backup copies and are typically used to meet recovery or other needs (such as disk space or tape space size limitations)
The backup retention policy is divided into redundancy and recovery windows, which are incompatible with each other, either using the former or using the latter
Backup redundancy
It can be modified by rman> configure retention policy to redundancy 2;
When last, Rman generates a backup for each data file, archive log, and control file. You can use the report obsolete command to view backups with more backups
and use delete obsolete to delete obsolete backups
Recovery window
Recovery window allows you to complete recovery to a point in time in the past, usually set to how many days
Using the command rman> configure retetion policy to recovery windows of 7 days
This command will ensure that you have sufficient data files and archive logs to perform incomplete recoveries that can return any point in time of one weeks, and allow deletion over time
Instead of becoming an obsolete backup, that condition should be met: Sysdate-backup CHECKPOINT time >= 7
Backups that are required to recover more than days are still retained
Clear Backup Retention Policy
Rman> Configure retention policy clear;
Attention Obsolete and expired
Obsolete: Refers to a retention policy that determines whether the backup is required when it is restored, if it is not required or if an updated backup is replaced, the backup set is
Obsolete, which is an obsolete backup set or mirrored copy.
Expired: Refers to the backup set or mirror copy that is located based on the backup information recorded in the storage warehouse when the crosscheck is executed, and the corresponding backup set or mirror pair cannot be found
These backup sets or mirrored copies are set to expired.
10. Use Backup ... Validate verify data file logical bad block, corrupted bad block will be logged to V$database_block_corruption view
BACKUP VALIDATE CHECK LOGICAL DATABASE ARCHIVELOG all;
Additional features of Rman backup