1.understanding Rman
1.understanding Rman
Is a tool to backup oracle database , restore oracle database and recovery oracle
database
--------------------------
1. Understanding rman tool
--------------------------
Under $ORACLE_HOME/bin
Copyright (c) 1982, 2019, Oracle and/or its affiliates. All rights reserved.
RMAN>
------------------------------------------------
Benefits of rman backup over user managed backup
------------------------------------------------
i. Rman need not require any documentation for backup , user managed backup
requires manual documentation
ii. Rman stores the backup information in Database control file
iii. OS cp will copy whole 32gb file which doing backup , rman copy only formatted
blocks only , rman copies blocks below high water mark only
iv. rman can detect the logical corruption of block OS copy will not detect it
v. incremental backup is possible only through rman, it means backing up changed
blocks since last bakcup
vi. rman can backup data in encrypted manner , OS copy can not
vii. rman can devide copy content on different channels at a time , it is not
possible with OS cp command
viii. rman is free
------------------------
RMAN COLD and HOT backup
------------------------
Rman needs to access the datafiles hence database needs to be in mount state
--------------------------
Which backup is preferred :
--------------------------
Hot bakcup/ online bakcup is preferred because it does not have downtime during
bakcup
-----------------------------------------
Consistant backup and Inconsistant backup
-----------------------------------------
It needs recovery , as database was used by users while backup transactions has
happend on database
we need to apply all the archived redo logs since when we start the backup until
backup got finished
9 AM start backup
.
.
10 AM backup completed
-------------------------
2. How to connect to rman
-------------------------
a. Locally
. oranv
PROD
rman target /
b. Remotely
--------------------
RMAN backup metadata
--------------------
What is metadata ?
Data about data is called as metadata
Rman keeps the metadata about backup in target database control file
For each database its own controlfile will maintain the metadata of the backup
control_file_record_keep_time parameter will decide how long to maintain this
metadata
by default its 7 days , we can set it to 365 days max for the database
Note: Catalog database is used to store the backup information for longer time if
required
Catalog database can maintain the backup info for multiple databases
Types of backup
proprietary means : Rman multiplexed backup , it copies formatted blocks from all
datafiles and send it to output file
called as backuppiece
/u008/app/orabase/fast_recovery_area/PROD/backupset/2025_01_03/
o1_mf_nnndf_TAG20250103T095307_mqgskcws_.bkp
rman_rcvman
rman_rcvcat
database
controlfile
archivelog
fra
spfile
tablespace
a. Consistent backup
b. Inconsistent backup
RMAN can store backup data in a logical structure called a backup set, which is the
smallest unit of an RMAN backup.
A backup set contains the data from one or more datafiles, archived redo logs, or
control files or server parameter file.
Backup sets, which are only created and accessed through RMAN, are the only form in
which RMAN can write backups to media managers
such as tape drives and tape libraries.
A backup set contains one or more binary files in an RMAN-specific format. This
file is known as a backup piece. A backup set can contain multiple datafiles. For
example, you can back up ten datafiles into a single backup set consisting of a
single backup piece. In this case, RMAN creates one backup piece as output. The
backup set contains only this backup piece.
If you specify the SECTION SIZE parameter on the BACKUP command, then RMAN produces
a multisection backup. This is a backup of a single large file, produced by
multiple channels in parallel, each of which produces one backup piece. Each backup
piece contains one file section of the file being backed up.
In backup undo optimization, RMAN excludes undo not needed for recovery of a
backup, that is, for transactions have already been committed. You can enable and
disable backup optimization, but backup undo optimization is built-in behavior.
/d1/orcva/TEST/backupset/2007_12_12/o1_mf_nnndf_TAG20071212T162825_2qyl99jm_.bkp
Note that if you specify the SECTION SIZE parameter on the BACKUP command, then
RMAN can create a multisection backup. In this case, a single backup set can
contain multiple backup pieces, each containing a file section. The purpose of
multisection backups is to enable multiple channels to back up a large file in
parallel.
Number and Size of Backup Sets
You use the backupSpec clause of the BACKUP command to specify the objects to be
backed up. Each backupSpec clause produces at least one backup set.
The total number and size of backup sets depends for the most part on an internal
RMAN algorithm. However, you can influence RMAN behavior with the MAXSETSIZE
parameter in the CONFIGURE or BACKUP command. By limiting the size of the backup
set, the parameter indirectly limits the number of files in the set and can
possibly force RMAN to create additional backup sets. Also, you can specify
BACKUP ... FILESPERSET to specify the maximum number of files in each backup set.
This number is the minimum of the FILESPERSET setting and the number of files read
by each channel. The FILESPERSET default is 64.
Image Copies
An image copy is an exact copy of a single datafile, archived redo log file, or
control file. Image copies are not stored in an RMAN-specific format. They are
identical to the results of copying a file with operating system commands. RMAN can
use image copies during RMAN restore and recover operations, and you can also use
image copies with non-RMAN restore and recovery techniques.
You can use the COPIES parameter in the CONFIGURE, SET, or BACKUP commands to
specify duplexing of backup sets when using the BACKUP command. RMAN can duplex
backups to either disk or tape, but cannot duplex backups to tape and disk
simultaneously. When backing up to tape, ensure that the number of copies does not
exceed the number of available tape devices.
The FORMAT parameter of the BACKUP command specifies the destinations for duplexed
backups. The following example creates 3 copies of the backup of datafile 7:
==
######################
Rman Retention Policy
######################
RMAN>show all;
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; maintain one good L0 bakup and all
previous L0 are marked as obsolete and can be deleted
CONFIGURE RETENTION POLICY TO recovery window of 7 days; means from today until
last 7 days we should be able to recover the database at any point
rman target /
Catalog backup
run
{
allocate channel ch1 device type disk;
allocate channel ch2 device type disk;
format '/stage_software/rman/backup_%U';
backup database ;
}
RMAN architecture
Target database
Rman repository (control file)
recovery catalog ( to keep backup medatadata in separate database )
rman client
rman executable
server process
Backup optimization
backup tag