Oracle RMAN
Oracle RMAN
Marcin Przepiorowski
Delphix
Ireland
Keywords:
Introduction
The Oracle Recovery Manager is the main tool for backup and recovery of the Oracle database. It is
very important for all DBA’s to understand how it’s working and how to resolve any issues with
backups and more importantly to understand how to recover database in the different scenarios.
My work experience is showing me that junior DBA’s are using Recovery Manager mostly through
Oracle Enterprise Manager and some of them are afraid or don’t know how to use command line
interface.
This presentation is going to cover RMAN concepts and show examples of how to deal with typical
back and recovery scenarios and how to interpret scripts and RMAN output logs. It will cover a
concept of Recovery Manager channel and typical backup, restore and recover commands.
In addition to that, maintenance of backups including adding, cross checking and delete of backup set
in the typical scenarios.
Recovery Manager is a part of an Oracle database. It’s built into kernel of database and it has a
PL/SQL API.
Recovery Manager has two interfaces: command line interface (rman command) and GUI interface (
Oracle Cloud Control or Oracle Enterprise Manager). GUI interface has a faster learning curve but it
also has more limitations. All jobs defined by GUI are generating scripts executed by command line
interface.
Client command (rman) can be connected to managed database in same way like SQLPlus is
connected to database: using SQL*Net network or local connection. Recovery Manager user must
have the followed role: SYSDBA role in 11g or at least SYSBACKUP in 12c.
Client parses single commands or scripts created by DBA or generated automatically by GUI.
If script can’t be parsed due to syntax errors, all errors are reported immediately to the user. After the
parsing phase, a final version of script is translated into PL/SQL and executed on the database server.
If there are errors during a runtime, error messages are sent back by server to client and displayed
there.
When Recovery Manager is connected to an Oracle database, a dedicated server process is started and
this process is responsible for coordination of backup and recovery operations.
Recovery Manager performs I/O operations using channels. Each channel is assigned to an additional
Oracle dedicated process. This process is reading data from data files and sending to output data
stream. An Oracle database supports two types of output data streams:
- disk
- sbt_tape – an library with well defined API which can be provided by a 3rd party
RMAN script can define a channel or a default channel will be used. If a channel is defined as a disk
type, output data stream will be saved into a file system accessible from a database server. If channel
is defined as a sbt_tape type, a 3rd party library has be in installed and this library will redirect a data
stream into a Media Manager server, backup appliance or cloud. This is a clearer solution as changing
the data stream’s location doesn’t require a change in the backup script.
RMAN connection
Recovery Manager client uses local or SQL*Net connectivity. Here are connectivity examples:
Local connection
Remote connection
When connection is established, there will be one coordination process and one channel process.
SID SERIAL#
---------- ----------
266 27553
269 15497
If a Fast Recovery Area is configured, an Oracle database uses it as a default location for all backups
executed by Recovery manager. After successful connection, the easiest command to run is “backup
database” to perform a backup of database using the default settings.
In the next step an archive log backup should be performed. There is a command to do it “backup
archivelog all”
The last step is a control file backup and this time it’s good to add a tag to have a easier way to
identify a backup set name.
The only one prerequisite to restore an Oracle database from backup, is an Oracle instance in nomount
state. Script showed below required a name of control file backup and it will perform all steps
automatically
run {
restore controlfile from
'/u01/app/oracle/fast_recovery_area/RMANTEST/backupset/2016_09_28/o1
_mf_ncnnf_CONTROLFILE_cyr730vl_.bkp';
alter database mount;
restore database;
recover database;
}
Statement processed
released channel: ORA_DISK_1
RMAN>
The last line of output is an error. It doesn’t look great but this is an expected error, as there is no more
archive logs to apply. The simplest script showed above doesn’t have any condition, which is a last
archive log to apply, so it was applying logs until next log wasn’t found.
After recovery is completed the very last step is to open a database using a reset log option.
The example showed above is a simplest possible scenario for backup and recovery using an Oracle
Recovery Manager. Other examples will be included in Power Point presentation and presented during
session.
Contact address:
Marcin Przepiorowski
Delphix
Email [email protected]
Internet: www.delphix.com