Concept and architecture of RMAN

Source: Internet
Author: User

I. Concept and architecture of RMAN
Recovery Manager (RMAN) is an oracle tool used for backup, recovery, and recovery of databases. RMAN can only be used in oracle8 or later versions. It can back up the entire database or database parts, such as tablespaces, data files, control files, archive files, and spfile parameter files. RMAN also allows you to perform incremental data block-level backup. incremental RMAN backup is effective in time and space because they only back up the data blocks that have changed since the last backup. Moreover, through the interfaces provided by rman, third-party backup and recovery software such as Veritas will provide more powerful backup and recovery management functions.

RMAN also provides other functions, such as database cloning, using RMAN to create a backup database, and using RMAN backup and mobile bare device (raw) files and other work will become more convenient and simple. 9i RMAN makes backup and recovery faster and more perfect through enhanced automatic configuration and management functions and unique block-level recovery.

9i RMAN has the following features:

·

· Automatic backup and recovery

· Convenient backup and archiving logs

· Automatic Detection of new data files

· Support for Incremental Backup

· Minimize backup and recovery errors

· Reduce recovery time

· No additional redo logs will be generated during Hot Backup

· Automatic Detection of damaged data blocks

· Parallel backup and recovery operations

· During online backup, The tablespace is not in the backup mode.

We can see that some of the above features show the powerful features and benefits of RMAN. The implementation of the above features is because RMAN is a block-level backup and recovery, backup and recovery occur at the database block level. Consistent data blocks can be obtained by comparing data blocks, which can avoid block-level problems such as block damage.

The structure of RMAN is described as follows:
1. RMAN tools
That is, the RMAN command, originated from Oracle version 8, is generally located in the $ ORACLE_HOME/bin directory. You can run the RMAN command to start the RMAN tool for backup and recovery interfaces.
2. Service Process
The RMAN service process is a background process used to communicate with the RMAN tool and the database. It is also used to communicate with the RMAN tool and disk/tape and other I/O settings, the service process is responsible for all backup and recovery. A service process is generated in the following circumstances:

·

· When connected to the target database

· Allocate a new channel

3. Channels
A channel is a way to read and write data between a service process and an I/O device. A Channel corresponds to a service process. When allocating a channel, you must consider the type of an I/O device, i/O concurrent processing capability, size of files that can be created by I/O devices, maximum read rate of database files, maximum number of opened files, and other factors
4. target database
It is the database for RMAN backup and recovery. RMAN can back up data files, control files, archive logs, and spfiles In addition to online logs, pfiles, and password files.
5. Restore the Directory
A database used to store backup and recovery information. It is not recommended to create it on the target database. You can manage multiple target databases at the same time using the recovery directory to store more backup information, backup scripts can be stored. If the directory is not restored, you can use a control file to replace the directory. Because of the automatic backup function of the control file, Oracle 9i can replace the directory to a large extent by using the control file.
6. Media Management Layer
Media Management Layer (MML) is a third-party tool or software used to manage tape read/write and file tracking management. If you want to back up data directly to tape through rman, you must configure media management. media management tools such as backup software can call RMAN for backup and recovery.
7. Backup, backup set and backup part
When the BACKUP command is issued, RMAN creates a complete backup that contains one or more backup sets. The backup set is a logical structure that contains a group of physical files. These physical files are the corresponding backup slices. A backup slice is the most basic physical structure that can be generated on a disk or tape. It can contain data files, control files, archived logs, and spfile files of the target database.
Backup sets and backup slices have the following requirements:
A data file cannot span a backup set, but can span a backup set.
Data files. The control files can be stored in the same backup set, but cannot be stored in the same backup set as the archive logs.

Ii. Start and run RMAN
Operation requirements
1. Process and memory requirements
More process needs
Allocation of large pools
2. Basic Environment Variable requirements
Oracle_sid, ORACLE_HOME, path, nls_lang. If time-based backup and recovery are used, you need to set nls_date_format
3. Permission requirements
Sysdba system permissions required
If it is local, you can use OS authentication. Password File authentication is required remotely.
4. version requirements
The RMAN tool version must be the same as the target database version. If the directory is restored, pay attention
· The script version used to create the RMAN recovery directory must be equal to or greater than the version of the database in which the directory is restored
· The script version used to create the RMAN recovery directory must be equal to or greater than the target database version.

Basic Running Method
9i is nocatalog by default. If you do not use Restore directory, run RMAN to access the command line interface of RMAN, as shown in figure

[Oracle @ dB Oracle] $ ORACLE_HOME/bin/RMAN
Recovery MANAGER: Release 9.2.0.4.0-Production
Copyright (c) 1995,200 2, Oracle Corporation. All rights reserved.
RMAN>

To connect to the target database, run the following command:
RMAN> connect target/

How to run RMAN commands
1. Single execution

RMAN> backup database;

2. Run a command Block

RMAN> run {
2> copy datafile 10
3> '/Oracle/Prod/backup/prod_10.dbf ';
4>}

3. Run the script

$ RMAN target/@ backup_db.rman
RMAN> @ backup_db.rman
RMAN> run {@ backup_db.rman}

Run the script stored in the recovery directory

RMAN> run {execute script backup_whole_db };

4. If the shell script is executed in cron, set the correct environment variable in the script.

[Oracle @ dB worksh] $ more rmanback. Sh
#! /Bin/KSh
# Set env
Export ORACLE_HOME =/opt/Oracle/product/9.2
Export oracle_sid = test
Export nls_lang = "american_america.zhs16gbk"
Export Path = $ path: $ ORACLE_HOME/bin
Echo "------------------------------- start -----------------------------"; Date
# Backup start
$ ORACLE_HOME/bin/RMAN <connect target
Delete noprompt obsolete;
Backup database format'/netappdata1/rmanback/tbdb2/% u _ % S. Bak 'filesperset = 2;
Exit;
EOF
Echo "------------------------------ end ------------------------------"; Date

Iii. automatic configuration of RMAN

Oracle 9i can configure some parameters, such as the Channel and backup retention policy. It can be used multiple times through one setting, and the information in the setting does not affect the resetting in the script. The default configuration parameters of RMAN can be seen through show all.

RMAN> show all;
RMAN configuration parameters are:
Configure retention policy to redundancy 1;
Configure backup optimization off;
Configure Default device type to disk;
Configure controlfile autobackup off;
Configure controlfile autobackup format for Type disk to '% F ';
Configure device type disk parallelism 1;
Configure datafile backup copies for device type disk to 1;
Configure archivelog backup copies for device type disk to 1;
Configure maxsetsize to unlimited;
Configure snapshot controlfile name to '/u01/APP/Oracle/product/9.0.2/dbs/snapcf_u02.f ';

1. Backup policy persistence
There are two retention policies: one is the time policy, which determines that at least one backup can be restored to the specified date, and the other
Redundancy policy, which requires at least several redundant backups.

Configure retention policy to recovery window of 5 days;
Configure retention policy to redundancy 5;
Configure retention policy to none;

In the first policy, at least one backup is guaranteed to be restored to the point in time of the Sysdate-5, and the previous backup is marked as obsolete. The second policy indicates that at least three redundant backups must exist. If more than three backups are redundant, the backups are marked as redundant. None can invalidate the backup retention policy. Clear will restore the default retention policy.

2. Channel Configuration and automatic channel allocation
Use configure to configure the channels for automatic allocation, and use numbers to specify the distribution of different channels.

Configure Channel Device Type disk format '/u01/Oracle/backup/% U'
Configure channel n device type disk format '/u01/Oracle/backup/% U'

Of course, you can also manually specify channel allocation in the running block. In this way, the default channel allocation will be replaced.

Run {
Allocate channel CQ type disk format = '/u01/backup/% u. Bak'
......
}

The following are some features of the channel:
Read Speed Limit
Allocate channel... rate = integer
Maximum backup Part Size Limit
Allocate channel... maxpiecesize = integer
Maximum number of files opened concurrently (16 by default)
Allocate channel... maxopenfile = integer

3. Automatic Backup of Control Files
From 9i, you can configure automatic backup of the control file, but this setting is invalid in the backup database. Use the following command to set automatic backup of Control Files
Configure controlfile autobackup on;

This feature is particularly effective for backup policies that do not restore directories. Automatic Backup of control files occurs after any backup or Copy command, or after any database structure change.
You can use the following configuration to specify the backup path and format of the control file.
Configure controlfile autobackup format for Type disk to '% F ';

During the backup, a snapshot of the control file is generated to control the read consistency of the file. The snapshot can be configured as follows:
Configure snapshot controlfile name to '/u01/APP/Oracle/product/9.0.2/dbs/snapcf_u02.f ';

4. Set parallel backup
RMAN supports parallel backup and recovery. You can also specify the default parallel degree in the configuration. For example
Configure device type disk parallelism 4;
It indicates that in future backup and recovery, the degree of parallelism will be 4, and four channels will be enabled for backup and recovery at the same time, of course, you can also specify the path in the run block to determine the parallel degree of backup and recovery.
The number of parallel threads determines the number of opened channels. If channel configuration is specified, the specified channel is used. If no channel is specified, the default Channel configuration is used.

5. Configure the default IO Device Type
The IO Device type can be disk or tape. By default, it is disk. You can reconfigure it using the following command.

Configure Default device type to disk;
Configure Default device type to SBT;

Note: If you change an I/O device, the corresponding configuration also needs to be modified, as shown in figure

RMAN> Configure device type SBT parallelism 2;

6. Configure the number of copies for multiple backups.
If you feel uneasy about a single backup set, you can set multiple copies of the Backup set, such

Configure datafile backup copies for device type disk to 2;
Configure archivelog backup copies for device type disk to 2;

If multiple copies are specified, you can specify multiple copies in the Channel configuration or backup configuration.
Configure Channel Device Type disk format '/u01/backup/% U','/u02/backup/% U ';
RMAN> Backup datafile n format'/u01/backup/% U', '/u02/backup/% U ';
3.7 backup Optimization
You can configure backup optimization, as shown in figure
Configure backup Optimization on;
If optimization settings are enabled, an optimization algorithm is run for the backed up data files, archived logs, or backup sets.
The same dbid, checkpoint SCN, resetlogscn, and time
Normally offline, read-only or normally closed files
Archive logs
The same thread, serial number resetlog SCN and time
3.8 backup file format
Backup files can be customized in the following formats:
% C Number of copies of backup slices
% D Database Name
% D the day in the month (dd)
% M is in the month of the year (mm)
% F a unique name based on dbid, in the form of a C-IIIIIIIIII-YYYYMMDD-QQ,
Here, iiiiiiiiii is the dbid of the database, yyyymmdd is the date, and QQ is a 1-256 order.
Column
% N Database Name, up to eight characters to the right
% U an eight-character name represents the backup set and Creation Time
% P Number of the backup credits in the backup set, starting from 1 to the number of files created
A unique file name of % u, representing % u _ % P _ % C
ID of the % s backup set
% T backup set Timestamp
% T year month day format (yyyymmdd)

 

Article Source: http://www.diybl.com/course/7_databases/oracle/Oracleshl/2008926/145856.html

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.