Concept and architecture of Oracle Rman (iv) using Rman backup

Source: Internet
Author: User
Tags file copy log tag name backup

Rman can be used to back up primary or standby databases, such as tablespaces, data files, archive logs, control files, server files, and backup sets.

4.1 File copies

Copies of the original file, somewhat similar to OS hot backup, can copy the entire data file to another location, but the result is only written to the hard drive, and separate files are separate.

An example of a file copy

Run {

Allocate channel D1 type disk;

Allocate channel D2 type disk;

Allocate channel D3 type disk;

Copy #

DataFile 1 to ' $HOME/prd1.dbf ',

DataFile 2 to ' $HOME/prd2.dbf ';

Copy # Second

DataFile 3 to ' $HOME/prd3.dbf ';

SQL ' alter system archive log current ';

}

4.2 Backup and backup sets

The regular backup of Rman is a backup set that is only recognized by Rman, so other backups, other than the copy command, are the backup sets produced by Rman and the corresponding backup slices.

An example of a backup database, open two channels, backup the database to tape

Run {

Allocate channel T1 type ' Sbt_tape ';

Allocate channel T2 type ' Sbt_tape ';

Backup

Filesperset 2

Format ' df_%t_%s_%p '

Database

}

RMAN can also implement multiple mirror-phase backups

run{

Allocate channel D1 type disk;

Allocate channel D2 type disk;

Allocate channel D3 type disk;

SET BACKUP copies 3;

BACKUP datafile 7 FORMAT '/tmp/%u ', '/oradata/%u ', '/%u ';

};

The following are examples of common backup archives

Rman>sql ' alter system archive log current ';

Rman>backup archivelog all Delete input;

Rman> backup Archivelog from time ' 01-jan-00 ' until time ' 30-jun-00 ';

rman> backup archivelog like ' oracle/arc/dest/log% ';

rman> backup Archivelog all;

Rman> backup Archivelog from logseq until LOGSEQ thread 1;

Rman> backup Archivelog from SCN 1 until SCN 9999;

In a RAC environment, because the database is shared, you can connect to an instance to back up the entire database, but because the archive log can be backed up locally, the backup of the RAC archive log becomes more complex, and we can back up the two-instance archive logs by connecting to two-instance channels.

run{

ALLOCATE CHANNEL node_c1 DEVICE TYPE DISK CONNECT ' sys/pass@dbin1 ';

ALLOCATE CHANNEL node_c2 DEVICE TYPE DISK CONNECT ' sys/pass@dbin2 ';

SQL ' ALTER SYSTEM ARCHIVE LOG current ';

Backup Archivelog All Delete input format '/u01/dbbak/%u_%s.bak ' Filesperset =

5;

}

4.3 Common backup parameters

1, keep parameters can be maintained for a long time special backup or copy, so that they are not affected by the default backup retention strategy,

Such as

rman> BACKUP DATABASE KEEP UNTIL time

2> "To_date (' 31-mar-2002 ', ' dd_mm_yyyy ')" nologs;

rman> BACKUP tablespace SAMPLE KEEP FOREVER nologs;

Where nologs indicates that the archive log since the backup could not be retained, by default logs, which means that the backup is retained to

parameter, you can use the Forever parameter if you want to make the backup permanent.

2, the tag parameter indicates the backup set of flags, can reach 30 characters long, such as

rman> BACKUP DEVICE TYPE DISK datafile 1 TAG

2> "Wkly_bkup";

After Oracle version 92, RMAN automatically provides a tag, formatted as TAGYYYYMMDDTHHMMSS

such as tag20020208t133437, through the backup flag tag, can also be easily recovered from the backup set, such as

Restore database from tag= ' tag name '

4.4 Incremental Backups

Before you describe an incremental backup, you first understand the differential increment and cumulative incremental backup, and the backup and restore principles for incremental backups. Difference increment, which is the default incremental backup method.

(1) Cumulative incremental backup

As you can see, the variance increment is the block that has changed since the backup of the parent or sibling, and the cumulative increment is the block that has changed since the parent backup was backed up. Cumulative increments increase the time of the backup, but because of the recovery, the data needs to be recovered from fewer backup sets, so the cumulative incremental backup will be more efficient than the differential incremental backup to reduce the recovery.

No matter how incremental backups are, in Oracle version 9, it is also a lengthy process to compare all the blocks of data in a database, and since incremental backups form multiple different backup sets, making recovery more unreliable and slower, incremental backups are still a bit of a chicken in version 9. Unless it is a large data warehouse system, it is not necessary to select an incremental backup. Oracle version 10 has made significant improvements on incremental backups, incremental backups can be made into real increments, because it is not necessary for Rman to compare each block of data in the database with a unique incremental log, and of course, the cost is the IO and disk space paid by the log, which is completely unsuitable for the OLTP system. In addition, version 10 consolidates the results of the incremental backup with a combination of backups, which completely reduces recovery time.

Related Article

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.