Features of RMAN backup

Source: Internet
Author: User

1. Concurrency: it is mainly used to increase the backup speed, which can be divided into manual concurrency or automatic concurrency.

Manual concurrency: allocate multiple channels and specify files to a specific channel.

RMAN> run {

2> allocate channel specified 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 identifier 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 restart;

12> release channel CH2;

13> release channel CH3;

14>}

 

Automatic concurrency: Use configure to configure the concurrency.

RMAN> Configure device type disk parallelism 3 Backup Type to backupset;

-- The following Backup will automatically enable concurrent connections.

RMAN> backup database format '/u01/APP/oralce/rmanbak/P3 _ % U ';

 

2. Reuse backup

Multiple copies of one backup set. One backup set can be reused in Oracle at most.

Manually specify:

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; -- specifies 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

3. Backup set

Bacup backupset

4. Image backup

When the image is backed up, check whether there are bad blocks in the data file. You can use nochecksum to skip the check of Bad blocks.

You can also specify maxcompute upt to determine the number of Bad blocks, Oracle will stop the backup of this image

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_2017118_6chl1byd _. arc'

3> Format '/u01/APP/Oracle/rmanbak/arch_1015.bak ';

 

-- Use the following configure command to set Backup Type to copy, the default backup is an image copy.

RMAN> Configure device type disk parallelism 1 Backup Type to copy;

 

RMAN> Backup datafile 4 -- because of the above settings, the BACKUP command will be an image copy

2> Format '/u01/APP/Oracle/rmanbak/users. DBF. Bak' tag = users;

 

-- Use parallelism to copy images

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 backing up an image, specify the sub-statement db_file_name_convert to transfer the image path. This sub-statement is also an initialization parameter for primary dB to standby dB.

Data file conversion

Db_file_name_convert = ('string1', 'string2', 'string3', 'string4 '...)

Replace string1 with string2 and string4 with string3

RMAN> Backup as copy device type Disk

2> db_file_name_convert ('oradata/orcl ', 'bk/rmbk ')

3> tablespace users;

5. compress the backup set

RMAN> Configure Channel Device Type disk format'/u01/APP/Oracle/rmanbak/% d _ % u. Bak ';

-- The following command uses the as compressed parameter for manual compression.

RMAN> Backup as compressed backupset database;

RMAN> Backup as compressed backupset datafile 4, 5, 6;

-- Use the configure command to configure the automatic compression backup set function. The subsequent backup will automatically use the compression function.

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, control file, and parameter file.

RMAN> Backup tablespace system tag = system;

6. Tag

Tag tag can be used to specify a meaningful name for backup sets or image copies for future use. Its advantages are as follows:

Provide description information for backup sets or image copies

Able to better locate backup files in the LIST Command

Can be used in restore and switch commands

The same tag is used in multiple backup sets or multiple image copies.

If no tag is specified, the system generates the default tag in the format of tagyyyymmddthhmmss.

RMAN> Backup as compressed backupset datafile 1, 2, 3 tag = 'monthly _ full_bak ';

RMAN> Backup as compressed backupset tablespace users tag = 'Weekly _ full_bak ';

RMAN> List backupset tag = monthly_full_bak;

 

7. Incremental Backup

Differential Incremental Backup backs up all changed data blocks since the last Incremental Backup

Accumulative incremental backup backs up all changed data blocks since the previous secondary Incremental Backup

-- Enable Incremental Backup below

RMAN> run {

2> allocate channel category 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 restart;

7>}

 

SQL> select Sid, SOFAR, totalwork from V $ session_longops; -- Query backup status

 

-- Enable incremental differential backup below

RMAN> run {

2> allocate channel category 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 restart;

7>}

 

-- Enable Accumulative incremental backup below

RMAN> run {

2> allocate channel category 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 restart;

7>}

 

8. Enable block change tracking

When block change tracking is enabled, a file is used to record which blocks have changed in the data file. When ramn performs Incremental backup, you only need to read the file to back up these

Blocks that change, reducing the 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 12 m Oct 15 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; -- after disable, the block change tracking file is automatically deleted.

 

SQL> select * from V $ block_change_tracking;

 

Status filename bytes

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

Disabled

9. Backup retention policy

Retention policies are mainly rules for retaining backup copies, which are usually used to meet recovery or other needs (such as disk space or tape space size restrictions)

Backup retention policies are divided into redundancy and recovery windows. These two retention policies are incompatible, either using the former or using the latter

Backup Redundancy

The default value is, which can be modified through RMAN> Configure retention policy to redundancy 2;

At this time, RMAN generates a backup for each data file, archive log, and control file. You can run the report obsolete command to view backups with more backups.

Delete Obsolete is used to delete outdated backups.

Restore window

The recovery window allows you to complete the restoration to a point in time in the past, usually set to how many days

Run the command RMAN> Configure retetion policy to recovery window of 7 days

This command will ensure that there are enough data files and archive logs for execution to return Incomplete recovery at any time point in a week, and allow deletion over time

The discarded backup must meet the following conditions: sysdate-Backup checkpoint time> = 7

If the backup is larger than days but is required for restoration, it will still be retained.

Clear backup retention policy

RMAN> Configure retention policy clear;

Note: obsolete and expired

Obsolete: determines whether the backup is required for Restoration Based on the retention policy. If the backup is not needed or is replaced by an updated backup, the backup set is set

Obsolete is an discarded backup set or image copy.

Expired: indicates that during crosscheck, the backup set or image copy is located based on the backup information recorded in the storage warehouse, but the corresponding backup set or image copy cannot be found.

, These backup sets or image copies are set to expired.

 

10. Use Backup... validate to verify the logical Bad blocks of the data file. The damaged blocks will be recorded in the V $ database_block_partition uption view.

Backup validate check logical database archivelog all;

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.