RMAN basics


1. Concept:

A backup set is a backup that is taken using the RMAN’s BACKUP command. A backup set is a logical grouping of one or more physical (binary) files called backup pieces.A backup set is a logical structure that consists of a minimum of one backup piece, which is a physical, RMAN-specific format file that actually contains the backed-up data. A backupset can contain data from one or more datafiles, archived redo log files, or control files.

Backup sets are of two types: data file backup sets and archived log backup sets. A data file backup set is a backup of data files or control files. A data file backup set is compressed, i.e., it contains only used data blocks.

An archived log backup set is a backup of archived redo logs. An archived log backup set is not compressed.

A backup piece can belong to only one backup set. Backups of data files and archived redo logs cannot be stored in the same backup set.

2. Datafile in bkset and bk pieces

– One bk set = one or more datafiles

bkset must have at least one datafile, which means you cannot have part of a datafile(of course lar) in one dataset.

The parameter MAXSETSIZE is used to limit the size of each bk set. This parameter must be larger than the size of the largest datafiles will be backed up.

e.g if I have 3 datafiles with 500m, 600m, 700m, then the MAXSETSIZE must be set larger than or equal to 700m. if not, error will occurred and backup will fail.
– When we can have multi. Pieces in one bkset? Set the MAXPIECESIZE

RMAN> CONFIGURE MAXPIECESIZE TO500M;
By default, MAXPIECESIZE is UNLIMITED; if we set the MAXPIECESIZE to 500M as this case, datafile that larger than 500M will be divided into two or more pieces. For example, backing up a datafile with 1200m will contain three pieces.
– When we can have more than one bk set in each backup? Set the FILEPERSET parameter:

RMAN> run{
allocate channel d1 type disk
maxpiecesize =300M;
backup
filesperset 2
format=’/u01/app/bak/db_%t_%p.bus’
database;
}

“filesperset 2” means that each backupset contains two datafiles; if the backup contains more than 2 datafiles, say 5 datafiles, it will have 3 backup sets.

3. difference between an image copy and a backup set :
RMAN can write blocks from many files into the same backup set (known as multiplexing) but can’t do so in the case of an image copy—an image copy is identical, byte by byte, to the original datafile, control file, or archived redo log file.
An RMAN image copy and a copy you make with an operating system copy command such as dd (which makes image copies) are identical.
Since RMAN image copies are identical to copies made with operating system copy commands, you may use user-made image copies for an RMAN restore and recovery operation after first making the copies “known” to RMAN by using the catalog command.
You can make image copies only on disk but not on a tape device. “backup as copy database;” Therefore, you can use the backup as copy option only for disk backups, and the backup as backupset option is the only option you have for making tape backups.
After this point, there’s no difference between those image copies made by you and those made by RMAN. During a restore operation, if you have both image copies and backup sets from the same time period, RMAN prefers to use an image copy over a backup set.
This is because there is more overhead involved in sorting through a backup set to get the files to restore.
In addition image copies offer yet another benefit during a restore and recovery operation. If you need to restore a current datafile and happen to have an image copy of that datafile available, you can use the switch command to simply point the database to the replacement file instead of the original datafile. This eliminates the need to restore the datafile, thus speeding up database recovery considerably.

4. What is a channel?

123030

An RMAN channel represents one stream of data to a device type, and corresponds to one server session. Most backup and recovery commands in RMAN are executed by server sessions. As illustrated above figure.Each channel establishes a connection from the RMAN client to a target or auxiliary database instance by starting a server session on the instance. The server session performs the backup, restore, and recovery.

There are two ways of Channel allocation.

i)Automatic Channel allocation
ii)Manual Channel allocation.

i)Automatic channel Allocation:
This can be allocated through following command.
RMAN>CONFIGURE CHANNEL DEVICE TYPE DISK MAXPIECESIZE 2G;
RMAN>CONFIGURE CHANNEL DEVICE TYPE DISK RATE 1900K;

ii)Manual Channel Allocation:
This can be allocated through following command.
In the Run block.. Allocated the channel..
Allocate channel c1 device type disk format ‘/oracle/g01/backup/’;
Allocate channel for maintenance;

You can override automatic channel allocation settings by manually allocating channels within a RUN block. Manual channels always override automatic channels. For example, you override automatic channel allocation when you issue a command as follows:

RUN
{
ALLOCATE CHANNEL c1 DEVICE TYPE sbt;
BACKUP DATABASE PLUS ARCHIVELOG;
}
You can change a parallelism setting by issuing another CONFIGURE DEVICE TYPE … PARALLELISM command. This example configures PARALLELISM 2 and then changes it to 3:

CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
CONFIGURE DEVICE TYPE DISK PARALLELISM 3;
You can view the default setting for parallelism by running the SHOW DEVICE TYPE command. For example:

RMAN> SHOW DEVICE TYPE;
RMAN configuration parameters are:
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; #default

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s