[Forward] RMAN Beginner Guide

zhaozj2021-02-16  41

First floor

[Recommended] Rman Beginner Guide [ZT]

RMAN (Recovery Manager) is an important tool for DBA for backup, restore, and restoring Oracle database. There are netizens who have been looking for me for a long time. Unfortunately, there is no time, I have n'thing to do, I wrote it, for Friends of your beginners. This article will introduce the basic operation of RMAN, please refer to "Oracle8i Backup & Recovery Guide" and RMAN manual, or OCP Student Guide M09096 "Backup and Recovery Workshop" Volume 2, can also pass

Gototop@ncn.cn Contact me. Oracle comes with the * .rcv script under the Oracle_Home / Rdbms / Demo directory.

First, RMAN introduction

RMAN can be used to back up and restore database files, archive logs, and control files, or to perform complete or incomplete database recovery. RMAN has three different user interfaces: Command Line mode, GUI mode (integrated in OEM backup manager), API mode (used to integrate backup software to third parties). Has the following features:

1) The function is similar to physical backup, but it is better than the physical backup power N times, and it can be seen from the following characteristics;

2) Can compress the blanket;

3) You can achieve incremental on the block level;

4) You can pack the backup output into a backup set, or segment the backup set by fixed size;

5) The process of backup and recovery can be automatically managed;

6) You can use scripts (there is Recovery Catalog)

7) Can make bad block monitoring

Second, the interpretation of related terms

1) Backup sets backup set

Backup collection is a collection of backups that contain all backups of this backup, saved in Oracle's proprietary format. A backup set may constitute a full backup or incremental backup according to the type of backup.

2) Backup PIECES backup film

A backup set consists of several backup sheets. Each backup piece is a separate output file. The size of a backup piece is limited; if there is no size limit, the backup set is constructed only by one backup sheet. The backup piece size cannot be greater than the maximum value of the file supported by your file system.

3) Image Copies Image Backup

Image backups are not compressed, not packaged, direct Copy independent files (data files, archive logs, control files), similar to operating system-level file backups. And you can only get to the disk and you cannot go to the tape. It can be used as an incremental backup of the 0 level, generally used to back up the control file.

4) Full Backup full backup

Full backup refers to a backup of data blocks used in data files. The data blocks that are not used are not backed up, that is, RMANs are backups are compressed.

5) Incremental Backup incremental backup

Incremental backups refer to data blocks that have been modified since the last level of or lower levels of backups in the backup data file. The same is the same as fully backed up, and the incremental backup is also compressed. Incremental backups, although the concept is very good, the backup is also very simple, but it is another thing to restore, not only trouble and easy to make mistakes, so it is increasingly used in actual, and it has been suggested that it will be gradually used in Oracle 9i. Cancel support for incremental backups.

6) Recovery Catalog Recovery Directory

The recovery directory is used to record control information during the RMAN use, and the recovery directory should be synchronized (this will be said later). Although we can use the NOCATALOG way to use RMAN, the control information is recorded in the control file of the target database, but it is not safe, because the control file damage once the target database means all RMAN backups have failed. The same way to restore the directory should be built in another database, we are called "directory database" in the example below. Third, create a recovery directory

1. Create a table space used in the directory database

SQL> CREATE TABLESPACE RMANTS DATAFILE 'C: / Oracle/oradata/cc/rmants.ora' size 20m

The table space has been created.

2. Create RMAN users and authorize in the directory database

SQL> Create User Rman Identified by Rman Default TableSpace Rmants Temporary TableSpace Temp Quota

Unlimited on rmants;

User has created

SQL> Grant Recovery_catalog_owner to rman

Authorized success.

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: Connect to the recovery directory database

RMAN-06428: No recovery catalog

Rman> Create Catalog TableSpace Rmants;

RMAN-06431: The recovery directory has been created

4, registration target database to the recovery directory

Note, here my target database is used by RMAN, which means to use RMAN to back up the database, 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 the target database: rman (dbid = 1303772234)

Rman> Connect Catalog RMAN / RMAN @ CC

RMAN-06008: Connect to the recovery directory database

Rman> Register Database;

RMAN-03022: Compiling command: register

RMAN-03023: Execute command: register

RMAN-08006: Register the database in the recovery directory

RMAN-03023: Execute command: Full Resync

RMAN-08002: Resync that is starting all restored directories

RMAN-08004: Complete all RESYNC

Ok, I will do it until the preparatory work in front is done. You can use RMAN to make backups and recovery.

Fourth, use RMAN

The following will illustrate the use of the RMAN by the specific example, which will involve all RMAN operations other than recovery, and refer to I have written to another article before using RMAN: RMAN Restore Practice.

1, back up the entire database

Rman> Run {

2> Allocate Channel C1 TYPE DISK;

3> Backup Database Format 'E: /DBBACKUP/2DB.DMP';

4>}

2, copy data file

Rman> Run {

2> Allocate Channel C1 TYPE DISK;

3> Copy DataFile 'C: /oracle/oradata/rman/Users01.dbf' to 'E: /DBBACKUP/U.DBF' TAG = U1215;

4>}

3, check the backup and copy information

Rman> List backup;

RMAN-03022: Compiling command: List

Backup set list

Keyword Recid tag LV collection tag set count completion time

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

216 1 417347013 0 417346992 1 26-12 month -00

Backup segment list

Keyword PC # CP # status completion time period name

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

217 1 1 Available 26-12 month -00 E: /DBBACKUP/2DB.DMP

Data files include lists

File Name LV Type Check Point SCN Check Point Time

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

1 c: /oracle/oradata/rman/system01.dbf 0 Full 33224 26-12 month -00

2 c: /oracle/oradata/rman/rbs01.dbf 0 Full 33224 26-12 month -00

3 c: /oracle/oradata/rman/users01.dbf 0 Full 33224 26-12 month -00

4 c: /oracle/oradata/rman/temp01.dbf 0 Full 33224 26-12 month -00

5 c: /oracle/oradata/rman/tools01.dbf 0 Full 33224 26-12 month -00

6 c: /oracle/oradata/rman/indx01.dbf 0 Full 33224 26-12 month -00

Rman> list copy of datafile 'c: /oracle/oradata/rman/users01.dbf';

RMAN-03022: Compiling command: List

Data file backup list

Keyword file status completion time checkpoint SCN checkpoint time name

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

226 3 A 26-12 month -00 33226 26-12 month -00 E: /DBBACKUP/U.DBF

4, in the backup is set related parameters

Format - file output format,

% D - Database Name,

% s - backup sets sequence number,

% P - Backup Pieces Sequence Number

Filesperseet - Number of files included in each backup set

For more parameters, please refer to the books listed at the beginning of this article.

Rman> Run {

2> Allocate Channel C1 TYPE DISK;

3> SET LIMIT CHANNEL C1 KBYTES 8000;

4> BACKUP

5> Format 'E: /DBBACKUP/DB_%D_%S_%P.BCK'

6> (Database FilesPerset = 2);

7>}

RMAN-03022: Compiling commands: Allocate

RMAN-03023: Execute command: Allocate

RMAN-08030: Assign channel: C1RMAN-08500: Channel C1: SID = 9 DevType = Disk

RMAN-03022: Compiling commands: SET LIMIT

RMAN-03023: Execute command: set limit

RMAN-03022: Compiling command: Backup

RMAN-03023: User command: Backup

RMAN-08008: Channel C1: Start Full Data File Backup Set

Rman-08502: set_count = 6 set_stamp = 417351064 CREATION_TIME = 26-12 month -00

RMAN-08010: Channel C1: Data file being specified in the backup set

RMAN-08522: Enter data file fno = 00003 name = c: /oracle/oradata/rman/Users01.dbf

RMAN-08522: Enter data file fno = 00005 name = c: /oracle/oradata/rtman/tools01.dbf

RMAN-08013: Channel C1: 1 paragraph

RMAN-08503: Segment Handle = E: /DBBACKUP/DB_RMAN_6_1.bck comment = none

RMAN-08525: Backup set is completed, after time: 00: 00: 03

RMAN-08008: Channel C1: Start Full Data File Backup Set

RMAN-08502: set_count = 7 set_stamp = 417351067 CREATION_TIME = 26-12 month -00

RMAN-08010: Channel C1: Data file being specified in the backup set

RMAN-08522: Enter data file fno = 00002 Name = C: /oracle/oradata/rman/rbs01.dbf

RMAN-08522: Enter data file fno = 00006 name = c: /oracle/oradata/rman/indx01.dbf

RMAN-08013: Channel C1: 1 paragraph

RMAN-08503: Section Handle = E: /DBBACKUP/DB_RMAN_7_1.BCK Comment = NONE

RMAN-08525: Backup collection is completed, after the time: 00: 00: 04

RMAN-08008: Channel C1: Start Full Data File Backup Set

RMAN-08502: set_count = 8 set_stamp = 417351071 CREATION_TIME = 26-12 month -00

RMAN-08010: Channel C1: Data file being specified in the backup set

RMAN-08522: Enter data file fno = 00001 name = c: /oracle/oradata/rman/system01.dbf

RMAN-08011: Backup Concentration includes current control files

RMAN-08013: Channel C1: 1 paragraph

RMAN-08503: Segment Handle = E: /DBBACKUP/DB_RMAN_8_1.BCK Comment = NONE

RMAN-08013: Channel C1: 2 paragraphs have been created

RMAN-08503: Segment Handle = E: /DBBACKUP/DB_RMAN_8_2.BCK Comment = Nonerman-08013: Channel C1: 3 paragraphs have been created

RMAN-08503: Section Handle = E: /DBBACKUP/DB_RMAN_8_3.BCK Comment = NONE

RMAN-08013: Channel C1: 4 paragraphs

RMAN-08503: Section Handle = E: /DBBACKUP/DB_RMAN_8_4.BCK Comment = NONE

RMAN-08013: Channel C1: 5 paragraphs have been created

RMAN-08503: Segment Handle = E: /DBBACKUP/DB_RMAN_8_5.bck comment = None

RMAN-08013: Channel C1: 6 paragraphs have been created

RMAN-08503: Segment Handle = E: /DBBACKUP/DB_RMAN_8_6.BCK Comment = NONE

RMAN-08013: Channel C1: 7 paragraphs have been created

RMAN-08503: Segment Handle = E: /DBBBACKUP/DB_RMAN_8_7.bck comment = NONE

RMAN-08525: Backup collection is completed, after time: 00: 00: 19

.... ....

RMAN-08008: Channel C1: Start Full Data File Backup Set

RMAN-08502: set_count = 9 set_stamp = 417351090 CREATION_TIME = 26-12 month -00

RMAN-08010: Channel C1: Data file being specified in the backup set

RMAN-08522: Enter data file fno = 00004 name = c: /oracle/oradata/rtman/temp01.dbf

RMAN-08013: Channel C1: 1 paragraph

RMAN-08503: Segment Handle = E: /DBBACKUP/DB_RMAN_9_1.BCK Comment = NONE

RMAN-08525: Backup collection is completed, after the time: 00: 00: 07

RMAN-03023: Is executing a command: Partial Resync

RMAN-08003: Starting part of the resumes of the resume directory

RMAN-08005: Complete part of RESYNC

RMAN-08031: Released channel: C1

5, use script functions

The purpose of using scripts is to facilitate our convenience, operation and stored procedures.

Rman> Create Script L0dbbackup {

2> Allocate Channel C1 TYPE DISK;

3> BACKUP

4> Format 'E: /DBBBBBBUP/DB_%D_%S_%P.BCK'

5> (Database FilesPerset = 2);

6>}

RMAN-03022: Compiling command: CREATE SCRIPT

RMAN-03023: Execute command: CREATE SCRIPT

RMAN-08085: Script L0DBACKUP has been created

Rman> Run {EXECUTE Script L0DbBackup;

转载请注明原文地址:https://www.9cbs.com/read-19395.html

New Post(0)