RMAN (recovery manager) is an important DBA tool used to back up, restore, and restore Oracle databases. Some time ago, some netizens asked me for it. Unfortunately, there was no time, I wrote it for the reference of beginners when I was on a business trip in the past two days. This article describes the basic operations of RMAN. For more information, see Oracle8i backup & Recovery guide and RMAN manual, or OCP student guide m09096 backup and recovery workshop volume 2, you can also contact me via gototop@ncn.cn. For the example provided by Oracle, see *. RCV script in the $ ORACLE_HOME/rdbms/demo directory.
I. Introduction to RMAN
RMAN can be used to back up and restore database files, archive logs and control files, or perform full or incomplete database recovery. RMAN has three different user interfaces: command line, Gui (Backup manager integrated in OEM), and API (used for integration into third-party backup software ). It has the following features:
1) functions are similar to physical backup, but they are n times more powerful than physical backup. We can see from the following features;
2) Empty blocks can be compressed;
3) increment can be achieved at the block level;
4) The backup output can be packaged into a backup set, or the backup set can be split by fixed size;
5) the backup and recovery process can be automatically managed;
6) scripts can be used (in recovery Catalog)
7) Monitoring of Bad blocks
Ii. Glossary
1) backup sets backup set
A backup set, as its name implies, is a set of backups. It contains all the copies of this backup and is saved in Oracle proprietary format. A backup set may constitute a full backup or Incremental Backup Based on Different backup types.
2) backup pieces
A backup set consists of several backup slices. Each backup file is a separate output file. The size of a backup slice is limited. If there is no size limit, the backup set is composed of only one backup slice. The size of the backup file cannot exceed the maximum file length supported by your file system.
3) image copies image backup
Image backup does not compress, pack, or directly copy independent files (data files, archived logs, and control files), similar to file backup at the operating system level. You can only copy data to disks, but not to tapes. It can be used as level 0 of Incremental backup and is generally used to back up control files.
4) Full backup
Full backup refers to the backup of data blocks used in data files. Unused data blocks are not backed up, that is, RMAN is compressed for backup.
5) Incremental Backup
Incremental Backup refers to the data block that has been modified since the last or lower-level backup in the backup data file. Same as full backup, Incremental backup is also compressed. Although the concept of Incremental backup is good and the backup is simple, it is another thing to restore, which is not only troublesome but error-prone, so it is rarely used in practice. We recommend that you stop using it when it comes to Oracle 9i, later versions will gradually remove support for Incremental backup.
6) Recovery catalog Restore directory
The recovery directory is used to record the control information during RMAN usage. The recovery directory should be synchronized frequently (This will be discussed later ). Although we can use RMAN in nocatalog mode, the control information is recorded in the control file of the target database, but this is not safe after all, if the control file of the target database is corrupted, all RMAN backups become invalid. In the same way, the recovery directory should be created in another database. In the following example, we call it "directory database ".
3. Create a recovery directory
1. Create and restore the tablespace used by the directory database
SQL> Create tablespace rmants datafile 'C: \ oracle \ oradata \ CC \ rmants. ora 'size 20 m;
The tablespace has been created.
2. Create and authorize the RMAN user in the directory database
SQL> create user RMAN identified by RMAN default tablespace rmants temporary tablespace temp quota
Unlimited On rmants;
User Created
SQL> grant recovery_catalog_owner to RMAN;
Authorization successful.
3. Create a recovery directory in the directory database
C: \> RMAN catalog RMAN/RMAN
Recovery MANAGER: Version 8.1.7.0.0-Production
RMAN-06008: connecting to recovery Catalog Database
RMAN-06428: Recovery directory Not Installed
RMAN> Create catalog tablespace rmants;
RMAN-06431: Recovery directory created
4. register the target database to the recovery directory
Note: here, the service name of my target database is rman, which means the database to be backed up using rman, And the Directory
The service name used by the database is CC.
C: \> RMAN target sys/sys @ RMAN
Recovery MANAGER: Version 8.1.7.0.0-Production
RMAN-06005: connect to target database: RMAN (dbid = 1303772234)
RMAN> connect catalog RMAN/RMAN @ CC
RMAN-06008: connecting to recovery Catalog Database
RMAN> Register database;
RMAN-03022: compiling command: Register
RMAN-03023: Executing command: Register
RMAN-08006: a database registered in the recovery directory
RMAN-03023: Executing command: Full Resync
RMAN-08002: Starting Resync for all recovery Directories
RMAN-08004: Finished all Resync
Now we have prepared all the preparations. Now we can use RMAN for backup and recovery.
Iv. Use RMAN
The following is an example to illustrate how to use RMAN. All RMAN operations except restoration will be involved here. For details about how to use RMAN for restoration, refer to another article I wrote earlier. Article : RMAN recovery practices.
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.