RMAN

Rman backup can be taken in two ways

BACKUP SET - Recovery Manager backs up the datafiles, control file, archived log files, and server parameter files in a RMAN specific format called backup pieces. A set of one or more such backup pieces makes up a backup set. A backup set is created using the BACKUP command.

IMAGE COPY - As opposed to the backup set, an image copy is not a RMAN specific format. It is a replica of an actual file. Image copies are created using the COPY command.


TARGET DATABASE - A Target Database is the primary database that will be backed up for standby database creation. In RMAN's terminology, the term target database identifies the database that is undergoing a backup, restore or recovery operation by Recovery Manager.

AUXILIARY DATABASE - An Auxiliary Database is a standby database that will be created as a result of the duplication of the target database. In RMAN's terminology, Auxiliary instance identifies an instance which RMAN connects in order to execute the duplicate command.


RESTORE:
Restore is used to restore the datafiles from a backup. You can restore up to the time of the backup or a point before using SET UNTIL cancel/TIME/SCN...etc.

example:
run 
{
set newname for database to "/u02/app/oracle/oradata/TST1/%U";
restore database until time="TO_DATE('11/13/2013 01:53:36', 'MM/DD/YYYY HH24:MI:SS')";
switch datafile all;
}
exit;


RECOVER:
You would lose any changes made to the database after the backup by performing only a RESTORE.

RECOVER is used to roll the database forward after a RESTORE by applying the redo logs

example:

run {
recover database until scn 7266782191960;
}
exit;

###Duplicate method in Rman####

Rman duplicate command uses
It is mainly used for database rename after restore
To use duplication in rman we have the below senories
1.Adding dbfilename_convert,Logfilename_convert parameters in pfile(if it source data file mounts and target mounts are same count.ex||source db saves datafiles in 3mount points and target db also saves datafiles in 3mounts)


2.set new name command in rman script(if source data file mounts and target mount are having different count.ex||source db saves datafiles in 3mount points and target db saves datafiles in 6mounts)

3.configure auxname.
By this same like set new name it will rename dbfiles but we can modify number of log files or groups.
It is necessary to connect to the recovery catalog in order to use the CONFIGURE AUXNAME command


How rman create target redologs?
RMAN uses all incremental backups, archived redo log backups, and archived redo logs to perform incomplete recovery. RMAN then shuts down, starts, and opens the database with the RESETLOGS option to create the online redo logs.

Why we don't use nofilenamecheck option in same host db?
Do not use the NOFILENAMECHECK option when duplicating to the same Oracle home as the primary database. If you do, then the DUPLICATEcommand may overwrite the datafiles of the target database.

DB_CREATE_ONLINE_LOG_DEST_n : this parameter used to specify no.of controlfiles and redologs files generation.we can specify this parameter in pfile



*****USING SBT BACKUP***********


1.Restoring Oracle Full Databases:

Put the database in MOUNT mode

run {
allocate channel ch1 type 'sbt_tape';
allocate channel ch2 type 'sbt_tape';
restore database ;
recover database;
sql “alter database open”;
}

2.Restoring Oracle Control Files

Restore control and files in the following scenarios:

If the control file is lost and you need to restore the backup repository contained in the control file
If the recovery catalog is lost
If the recovery catalog was never used
If the catalog connect string is not specified for the instance during the backup




Put the database in NOMOUNT mode.

run {
set DBID <dbid>;
allocate channel ch1 type 'sbt_tape';
restore controlfile from autobackup ;
}

3.Duplicating Oracle Database

To redirect data files, specify the DB_FILE_NAME_CONVERT init parameter in the PFILE

run {
allocate auxiliary channel ch1 type 'sbt_tape';
allocate auxiliary channel ch2 type 'sbt_tape';
DUPLICATE TARGET DATABASE TO dupdb;
PFILE = /dup/oracle/dbs/initDUPDB.ora
NOFILENAMECHECK;
}

4.Restoring Oracle Individual Tablespaces to a Point-in-Time

On the RMAN command line, set the SBT CHANNEL parameter:

RMAN> CONFIGURE CHANNEL DEVICE TYPE 'sbt_tape' PARMS="SBT_LIBRARY= <software_installation_path>/Base/libobk.so, BLKSIZE=1048576";

n the RMAN command line, run the following sample script, substituting any required or optional Oracle SBT parameters.
RMAN> RUN {
recover tablespace test1 until time = "TO_DATE('02/12/2013 16:58:43',HH24:MI:SS')" auxiliary destination '/u01/tspit/'; }


5.Redirecting an Oracle Restore Using SET NEWNAME
When you redirect a restore for Oracle database 11gR2 or later by using the SET NEWNAME FOR DATABASE, or SET NEWNAME FOR TABLESPACE commands, you must specify variables in the file name to avoid name collisions.

run
{
set newname for database to "/u02/app/oracle/oradata/TST1/%U";
restore database until time="TO_DATE('11/13/2013 01:53:36', 'MM/DD/YYYY HH24:MI:SS')";
switch datafile all;
}
exit;
run {
recover database until scn 7266782191960;
}
exit;

RMAN PERFORMANCE TUNING PARAMETERS

– Parallelism
– Maxpiecesize – Maximum size of each backup piece
– FIlesperset  _ The number of datafiles in each backupset
– Maxopenfiles – Maximum No. of files which can be read from simultaneously
– Multiplexing level
– Asynchronous / Synchronous I/O
– Large pool Size-


If You Fail to Allocate Shared Memory, Set LARGE_POOL_SIZE

  • If LARGE_POOL_SIZE is set, then the database attempts to get memory from the large pool. If this value is not large enough, then an error is recorded in the alert log, the database does not try to get buffers from the shared pool, and asynchronous I/O is not used.
  • If LARGE_POOL_SIZE is not set, then the database attempts to get memory from the shared pool.
  • If the database cannot get enough memory, then it obtains I/O buffer memory from the PGA and writes a message to the alert.log file indicating that synchronous I/O is used for this backup.The formula for setting LARGE_POOL_SIZE is as follows:
    LARGE_POOL_SIZE =  number_of_allocated_channels * 
                       (16 MB + ( 4 *  size_of_tape_buffer )
  • http://oracleinaction.com/tune-rman-i/

No comments: