Академический Документы
Профессиональный Документы
Культура Документы
Read Offline:
Brijesh Gogia
Im an experienced Oracle Applications DBA with more than a decade of full-time DBA experience. I have gained a wide knowledge
of the Oracle software stack and have worked on several big projects for multi-national companies. I enjoy working with the
leading-edge technology and have passion for database performance and stability. Thankfully my work allows me time for researching
new technologies (and to write about them).
RMAN Configurations
June 1, 2011talipozturkLeave a comment
Hi Friends,
In this article Ill explain to you important RMAN configurations. You can do these configurations once and take backups
with these configurations. You can also set special configuration in the backup script.
CONFIGURE RETENTION POLICY
It used with the 2 different options. Recovery Window or Redundancy
Redundancy: CONFIGURE RETENTION POLICY TO REDUNDANCY 1;
If you set Redundancy to 1, RMAN will keep one backup. If you take second backup , RMAN will sign previous backup as
obsolete. You can delete obsolete backup with delete obsolete command.
Recovery Windows: CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 3 DAYS;
If you set Recovey windows to 3 days, RMAN will sign backups as obsolete older than 3 days. For example, we have 4 backups.
And our backup dates are 16 may, 18 may, 21 may and 23 may. If we set Recovery window to 3 days, RMAN must sign 16may and 18
may backups as obsolete (23may 3 days=20may). But RMAN signs 18may backup as not obsolete. Because RMAN automatically
detects backups. And 18may backup is needed for recovery of 20may.
CONFIGURE DEFAULT DEVICE TYPE
Backup can be taken two different locations. Tape and Disk
For backing up to disk: CONFIGURE DEFAULT DEVICE TYPE TO DISK;
For backing up to tape: CONFIGURE DEFAULT DEVICE TYPE TO SBT;
CONFIGURE CONTROLFILE AUTOBACKUP ON/OFF
Automatically backups the controlfile to fra. (If you dont set FRA then it puts backup of controlfile to $ORACLE_HOME/dbs by
default)
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO %F
By default, RMAN automatically names control file backups and saves them into FRA. To configure RMAN to write control file
backups to the specific directory: %F will generate a unique filename likes c-IIIIIIIIII-YYYYMMDD-QQ .
Here IIIIIIIIII is DBID, YYYYMMDD is date and QQ is hexadecimal id. You can also backup controlfile to specific
location. For example;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO ora_home/oradata/cf_%F;
You can also reset configuration.
CONFIGURE CONTROLFILE AUTOBACKUP FOR DEVICE TYPE DISK CLEAR;
You can also write in RUN script.
RMAN> SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE sbt TO 'controlfile_%F';
RMAN> BACKUP AS COPY DATABASE;
RMAN> RUN {
SET CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '/tmp/%F.bck';
BACKUP AS BACKUPSET DEVICE TYPE DISK DATABASE;
}
Format Aklamas
%a Specifies the activation id number of the database.
%A Specifies the activation id number of the database completed 0
%c Specifies the copy number of the backup piece within a set of duplexed backup pieces. The maximum value is 256.
%d Specifies the name of the database
%D Specifies the current day of the month in format DD
%e Specifies the archived log sequence number
%f Specifies the absolute file number
%F Combines the DBID, day, month, year, and sequence into a unique and repeatable generated name
%h Specifies the archived redo log thread number
%I Specifies the DBID
%M Specifies the month in format MM
%n Specifies the name of the database. padded on the right with x characters to a total length of eight characters.
%N Specifies the tablespace name.
%p Specifies the piece number within the backup set
%r Resetlogs ID
%s Specifies the backup set number
%S Specifies the backup set number completed 0
%t Specifies the backup set time stamp.
%T Specifies the year, month, and day in format YYYYMMDD
%u Specifies an 8-character name constituted by compressed representations of the backup set or image copy number.
%U Specifies a system-generated unique file name.
%Y Specifies the year in this format: YYYY.
CONFIGURE BACKUP OPTIMIZATION OFF/ON
If you set this configuration to ON then the backup command skips backing up files when the identical file has already been
backed up. RMAN uses to determine whether a file is identical to a file that it is backed up with following criterias.
Dosya tipi Ayn dosya olup olmadn anlama kriteri
Datafile The data file must have the same dbid, SCN, creation SCN, and RESETLOGS SCN and time as a data file in a
backup
Archive log Same DBID, thread, sequence number and RESETLOGS SCN and time
file
Backup set Same backup set recid and stamp.
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET
Specifies number of channels which determines whether RMAN reads or writes in parallel. You must also specify DEVICE TYPE.
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 3
The configure datafile backup copies used to specify how many copies of each backup piece should be created on the
specified device type for the datafile. In my example above, it will take backup 3 copy. It is known as mirror backup. You
can specify 3 different location with FORMAT option.
BACKUP DEVICE TYPE DISK COPIES 3 DATAFILE 7 FORMAT
/tmp/%U,?/oradata/%U,?/%U;
In it's most basic form, the RMAN client connects, an it needs to be with a "sysdba" privileged user, to the database that is being backed up,
called a TARGETdatabase, this client, is an executable that is normally found in $ORACLE_HOME/bin.
By being a client side utility, it allows you to use one RMAN executable version to backup current and previous versions of the Oracle
Database, there are some restrictions to this though, which can be verified in MOS document RMAN Compatibility Matrix [ID 73431.1].
This RMAN executable uses a file called recover.bsq , this file is located in $ORACLE_HOME/rdbms/admin , basically what the executable
does, is to interpret the commands you give it , direct server sessions to execute those commands, and record its activity in
the TARGET database control file that is being backed up.
There are two main SYS packages that do the work of backup and recovery, which are DBMS_RCVMAN, this has the procedures which list
your database incarnations, the set until time recovery window, list your backups, to name a few, and DBMS_BACKUP_RESTORE , which as
you might have guessed is the one who does the backup and recovery operations, like create the control file snapshot , backup the datafiles ,
backup the spfile to name some.
As mentioned above, the way that the RMAN client directs the server sessions to execute the commands are through channels , a channel
represents one stream of data to a device, and corresponds to one database server session. The channel reads data into PGA memory,
processes it, and writes it to the output device.
The work of each channel, whether of type disk or System Backup Tape (SBT), is subdivided into the following distinct phases:
1. Read Phase
A channel reads blocks from disk into input I/O buffers. The allocation of these buffers depend on the number of datafiles being
read simultaneously from disk and written to the same backup piece. One way to control the numbers of files is the backup
parameter FILESPERSET
2. Copy Phase
A channel copies blocks from input buffers to output buffers and performs additional processing on the blocks, like the validation of the data
blocks, as it verifies that it's not backing up corrupt data blocks, it's also the phase where it does the binary compression and the backup
encryption
3. Write Phase
A channel writes the blocks from output buffers to storage media. The write phase can be either to SBT or to disk, and these are mutually
exclusive, meaning you write to one or the other, not both.
As you can see by the phases above, and what distinguishes RMAN from any other method, is that the backup is at the block level, as to the
user managed backups, it brings great advantages , as it wont have to backup empty blocks.
One great way to see how your backup works, is to do a trace, here you will see everything that has been mentioned above
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
Once the backup finishes, you can search the trace file and see what it is actually doing, here is an example of the RCVMAN fetching
the incarnation information:
Below you can see the RPC calls being done by DBMS_BACKUP_RESTORE and the IO information by the INPUT buffers and the
OUTPUT buffers.
I hope this helps you understand more how your backup works, and this is just the super condensed version, there is a lot of information
missing, like how RMAN allocates the IN and OUT buffers, or how the disk writes are differentiated from the SBT writes, so go out there and
see it yourself.
Also some of the information for this entry came from these two great books:
Oracle Database Backup and Recovery User's Guide 11g Release 2 (11.2)