0% found this document useful (0 votes)
41 views6 pages

RMAN Backup Guide for ORCL Database

This document describes the steps to configure and perform a full backup of an Oracle database using RMAN. It explains how to create an RMAN catalog, register the database, configure parameters such as compression and retention, and then perform a full backup of the database and redo files.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
41 views6 pages

RMAN Backup Guide for ORCL Database

This document describes the steps to configure and perform a full backup of an Oracle database using RMAN. It explains how to create an RMAN catalog, register the database, configure parameters such as compression and retention, and then perform a full backup of the database and redo files.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd

Rman: Complete backup of the ORCL database

Here all commands are made by the user 'oracle', our target database has the SID
ORCL.
We will first create our catalog
• Create our tablespace and a user with the rights
$ sqlplus /nolog
$ connect /as sysdba
SQL> create tablespace rman
2datafile '/u01/app/oracle/oradata/ORCL/[Link]'
3 size 10m autoextend on next 5m ;
Tablespace created.
SQL> create user rman identified by rmanpwd default tablespace rman ;
User created
SQL> grant connect, resource, recovery_catalog_owner to rman;
Grant succeeded.
• Now that the tablespace and the user are created, we will create the catalog.
• We connect to the 'blank' catalog.
$ rman catalog rman/rmanpwd@orcl
connected to recovery catalog database
Recovery catalog is not installed
RMAN> create catalog;
Recovery catalog created.
• We will now register our ORCL database in the repository (rman target /
catalog UserRman@SidTargetBase)
$ rman target / catalog rman@orcl
A password will be requested, it is the password for the user rman in our case.
rmanpwd)
RMAN> register database ;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
Now that everything is done, we need to configure some RMAN settings (including the famous
window redundancy seen in the introduction
• First, let's list all the parameters with the command show all:
RMAN> show all ;
======================================================================
RMAN configuration parameters for database with db_unique_name ORCL are:
CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 1 DAY;
CONFIGURE BACKUP OPTIMIZATION OFF; # default
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP ON;
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F';
CONFIGURE DEVICE TYPE DISK BACKUP TYPE TO COMPRESSED BACKUPSET PARALLELISM 1;
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE COMPRESSION ALGORITHM 'BASIC' AS OF RELEASE 'DEFAULT' OPTIMIZEFOR
LOAD TRUE ; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO
'/u01/app/oracle/home/oracle/product/11.2.0/db_1/dbs/snapcf_orcl.f'; # default
======================================================================
• Conservation strategy configuration:
We have two methods for backup preservation, on one hand we have the method called 'window of
"retrieval" or "window" allows you to set the expiration time of backups in number of
days (method used in our case)
RMAN> configure retention policy to recovery windows of 7 days ;
In our case, backups older than 7 days will be marked as obsolete and
delete by RMAN if space is needed.
The second method called ''redundancy'' is based not on time but on
name of save games.
RMAN> configure retention policy to redundancy = 3 ;
In that case, all save games (identical files...) will become obsolete except for the 3 games of
the most recent backups.
• Backup of the control file:
Due to the importance of the control file, it would be wise to back it up at each
backup and put it, why not, in a specific folder. To do this, first of all
We will create the folder that will receive the control file with the root user and give all the
rights to the Oracle user then we will configure at the RMAN level.
#mkdir -p /save/rman
#chown–R oracle /save/rman
#chgrp–R dba /save/rman
$ rman target / catalog rman/rmanpwd@orcl
RMAN> configure controlfile autobackup on;
RMAN> configure controlfile autobackup format for device type disk to '/save/rman/cf%F';
• Let's make sure to compress our backups.
During a restoration or recovery operation, the files will be automatically
decompressed.
RMAN> configure device type disk backup type to compressed backupset ;

The Backups

• Full backup of our database: ORCL


In our backup, we will copy all the files from the database including the SPFILE to the area.
of recovery flash (I will show you later a way to know where the area is in
question)
RMAN> backup as backupset database spfile ;
after a while you will have two lines like 'Finished backup at ...' and 'Finished Control'
File and SPFILE Autobackup at ...
Now we need to ensure the presence of redo archives for the transactions, especially those
that occurred during the backup operation, this guarantees us the recovery of media after the
restoration of this backup.
RMAN> sql 'alter system archive log current';
See where the flash recovery area is located, run the command with the system user:
SQL > show parameter db_recovery_file_dest
Here we see that the folder is: /u01/app/oracle/flash_recovery_area
Let's take a look in the folder
Other features with RMAN
It is important to know that there are several types of backups. I will talk to you about a few of them with the
appropriate commands without delving into the heart of the matter.
Tablespace backup
see all the available tablespaces

Save:
RMAN> backup as backupset tablespace rman ;
Data file backup:
see the data files

Save:
RMAN> backup as backupset datafile '/u01/app/oracle/oradata/orcl/[Link]'
• Backup all archived redo files
RMAN> backup archivelog all;
• Incremental backup
Instead of making full backups, we can make incremental backups. The first
incremental backup must be at zero level, it should be seen as a full backup then
Subsequently, we will have level 1 backups that will either be differential by default or cumulative.
The difference is that the differential acts according to the last incremental backup while the
cumulative acts according to the initial incremental backup (the one at level 0)
• Level 0 incremental backup + compression:
RMAN> backup incremental level 0 as compressed backupset database;
• Incremental backup level 1+ compression (default differential):
RMAN> backup as compressed backupset incremental level 1 database;
• Cumulative level 1 incremental backup + compression:
RMAN> backup as compressed backupset incremental level 1 cumulative database;
• Validate our backups
It would be good to check that our backups are not showing any alterations, to do this here are a few
examples of verifications.
• Validation of the entire database and the archived redo files
RMAN> backup validate database archivelog all ;
• Verify that a restoration will be done without problems
RMAN> restore validate database ;
• Encountered errors
I won't hide from you that I learned to use the RMAN utility on my own, so I encountered
some problems when I had to practice. One of the errors encountered is the error:
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode
To solve:
1. Connect to sqlPlus and perform an immediate shutdown
2. Set up the database
3. Set the database to archivelog mode
4. Open the database

You might also like