RMAN (Recovery Manager)
This post i will summarize and explain the most used rman commands.
What is RMAN ? :
RMAN (Recovery Manager) is a backup and recovery manager supplied for Oracle databases created by the Oracle Corporation. It provides database backup, restore. and recovery capabilities, addressing high availability and disaster recovery concerns. Oracle Corporation recommends RMAN as its preferred method for backup and recovery and has written command-line and graphical (via Oracle Enterprise Manager) interfaces for the product.
What to backup in a database:
- Database Files
- Control Files
- Offline Redolog Files
- INIT.ORA
- Password Files
We use RMAN to backup up
Database Files,Control Files, and Offline Redolog Files.
What are the benefits of using RMAN instead of traditional backup strategies:
-
You can take advantage of the powerful Data Recovery Advisor feature,
which enables you to easily diagnose and repair data failures and
corruption (Chapter 20 discusses the Data Recovery Advisor).
-
There are simpler backup and recovery commands.
-
It automatically manages the backup files without DBA intervention.
-
It automatically deletes unnecessary backup datafiles and archived redo log files both from disk and tape.
-
It provides you with detailed reporting of backup actions.
-
It provides considerable help in duplicating a database or creating a standby database.
-
It lets you test whether you can recover your database, without actually restoring data.
-
It lets you verify that available backups are usable for recovery.
-
It lets you make incremental backups, which isn’t possible by any other means of backup.
-
It lets you perform database duplication without backups by using the
network-enabled database duplication feature, also known as active
duplication.
- It automatically detects corrupt data blocks during backups, with the
corruption relevant information recorded in the
V$DATABASE_BLOCK_CORRUPTION view.
-
When only a few data blocks are corrupted, you can recover at the data block level, instead of recovering an entire datafile.
-
You can take advantage of the unused block compression feature, wherein RMAN skips unused data blocks during a backup.
-
Only RMAN provides the ability to perform encrypted backups.
-
You can use RMAN with a variety of third-party storage systems.
-
You can use a powerful yet easy-to-use scripting language, which lets you write custom backup and recovery scripts quickly
Architectural components:
1.RMAN executable
2.Server processes
3.Channels
4.Target database
5.Recovery catalog database (optional)
6.Media management layer (optional)
7.Backups, backup sets, and backup pieces
RMAN Executable:
The RMAN executable, usually named rman, is the program that manages all
backup and recovery operations. You interact with the RMAN executable to specify
backup and recovery operations you want to perform.
Server Processes:
RMAN server processes are background processes, started on the server, used
to communicate between RMAN and the databases. When you connect the RMAN client
to the target database server, RMAN allocates server sessions on the target
instance and directs them to perform the backup and recovery operations. The
RMAN client itself does not perform the backup, restore, or recovery.
Channels:
A channel is an RMAN server process started when there is a need to communicate
with an I/O device, such as a disk or a tape. A channel is what reads and writes
RMAN backup files. It is through the allocation of channels that you govern I/O
characteristics such as:
- Type of I/O device being read or written to, either a disk or an sbt_tape
- Number of processes simultaneously accessing an I/O device
- Maximum size of files created on I/O devices
- Maximum rate at which database files are read
- Maximum number of files open at a time
Target Database:
The target database is the database on which RMAN performs backup, restore, and
recovery operations. This is the database that owns the datafiles, control
files, and archived redo files that are backed up, restored, or recovered.
Note:-- that RMAN does not back up the online redo logs of the target database
Recovery Catalog Database:
The recovery catalog database is an optional repository used by RMAN to record
information concerning backup and recovery activities performed on the target.
This includes information such as:
- Details about the physical structure of the target database
- A log of backup operations performed on the target
database's datafiles, control files, and archived redo log
files
- Stored scripts containing frequently used sequences of RMAN
commands
Why is the catalog optional?
Because RMAN manages backup and recovery operations, it requires a place to
store necessary information about the database. RMAN always stores this
information in the target database control file. You can also store RMAN
metadata in a recovery catalog schema contained in a separate database. The
recovery catalog
schema must be stored in a database other than the target database.
Contents of the Recovery Catalog
The recovery catalog contains information about RMAN operations, including:
- Datafile and archived redo log backup sets and backup pieces
- Datafile copies
- Archived redo logs and their copies
- Tablespaces and datafiles on the target database
- Stored scripts, which are named user-created sequences of
RMAN commands
- Persistent RMAN configuration settings
Media Management Layer
The Media Management Layer (MML) is a third-party piece of software that manages
the reading and writing of files to and from tape
Backups, Backup Sets, and Backup Pieces
When you issue an RMAN backup command, RMAN creates backup sets, which are
logical groupings of physical files. The physical files that RMAN creates on
your backup media are called backup pieces.
RMAN backup
A backup of all or part of your database. This results from issuing an RMAN
backup command. A backup consists of one or more backup sets.
Backup set
A logical grouping of backup files -- the backup pieces -- that are created when
you issue an RMAN backup command. A backup set is RMAN's name for a collection
of files associated with a backup. A backup set is composed of one or more
backup pieces.
Backup piece
A physical binary file created by RMAN during a backup. Backup pieces are
written to your backup medium, whether to disk or tape. They contain blocks from
the target database's datafiles, archived redo log files, and control files.
When RMAN constructs a backup piece from datafiles, there are a several rules
that it follows:
A datafile cannot span backup sets
A datafile can span backup pieces as long as it stays within one backup
set
Datafiles and control files can coexist in the same backup sets
Archived redo log files are never in the same backup set as
datafiles or control files
RMAN is the only tool that can operate on backup pieces. If you need to restore
a file from an RMAN backup, you must use RMAN to do it. There's no way for you
to manually reconstruct database files from the backup pieces. You must use RMAN
to restore files from a backup piece.