Solution available for backup and recovery of Oracle Database
i) RMAN (Recovery Manager)
ii) User Managed backup (using o.s. commands like cp, copy..)
.
RMAN (Recovery Manager) – is Oracle Database client that perform backup & restore task of oracle database.
.
Components in RMAN
1. Target Database – is Oracle database which you want to backup or restore. You use RMAN client to connect to Target Database.
2. RMAN Client – is Oracle executable that interprets backup/restore related commands and direct server to execute those commands on Target Database.
3. RMAN Repository – RMAN maintains metadata about its operations, this RMAN metadata is called as RMAN repository and stored in control file of database.
4. Recovery Catalog (Optional Component) – Separate database schema to record RMAN activity against one or more TARGET database.
5. Media Manager (Optional Component) – Application for RMAN to interface with sequential media devices like tape library. Job of media manager is to load , label , unload ….media devices.
“You can use RMAN with or Without Recovery Catalog and Media Manager”
.
Terminology in RMAN
a) Backup Set – is one or more backup piece (physical files) written in format that only RMAN can access.
b) Image Copy – is bit-by-bit copy of database files created on Disk. This is equivalent to cp (on Linux) or copy (on windows).
* Backup Set is default method to backup, for image copy use BACKUP AS COPY while backup.
c) Hot backup – backup taken while Oracle Database is Up. (Database should be in “Archive Log” mode for hot backup)
d) Cold backup – backup taken while Oracle database is down or in mount state (NOT OPEN).
e) Full Backup – Backing up entire database is called as full backup
f) Incremental Backup – Backup of block level changes to database made after previous incremental/full backup.
g) “Level 0” Incremental backup – This backs up all blocks in database. This is equivalent to full backup.
h) “level 1” Incremental backup – This backs up database block changes after previous incremental backup.
If there is no level 0 incremental backup and you run level 1 incremental backup, RMAN will automatically make level 0 incremental backup.
i) Cumulative incremental backup – level 1 incremental backup which includes all blocks changed since most recent level 0 incremental backup.
j) Differential incremental backup – level 1 incremental backup which includes only block changed since most recent incremental backup.
By default, incremental backups are differential
.
Basic Commands in RMAN
1. Start RMAN client
rman (rman executable is in $ORACLE_HOME/bin)
2. Connect to target database (start RMAN client as shown above)
RMAN> connect target sys@TNS_ALIAS_FOR_TARGET
like
RMAN> connect target sys@PROD
To connect to local database use operating system authentication
RMAN> connect target /
3. To exit from RMAN client
use EXIT like
RMAN> exit
4. To view current RMAN configuration
rman (To start RMAN Client)
RMAN> connect target / (to connect to target database)
RMAN> SHOW ALL
5. To backup database and archived redo while system is Up (Hot Backup)
Database should be in archive log mode
rman (To start RMAN Client)
RMAN> connect target / (to connect to target database)
RMAN> BACKUP DATABASE PLUS ARCHIVELOG;
6. To make consistent backup while database is not open (Database in No archive log mode)
rman (To start RMAN Client)
RMAN> connect target / (to connect to target database)
RMAN> SHUTDOWN IMMEDIATE (to shutdown database)
RMAN> STARTUP MOUNT;
RMAN> BACKUP DATABASE; (to backup database, no need to backup archived log as database is not open)
RMAN> ALTER DATABASE OPEN; (To Open Database )
.
7. To make incremental backup
rman (To start RMAN Client)
RMAN> connect target / (to connect to target database)
RMAN> BACKUP INCREMENTAL LEVEL 0 DATABASE; (For incremental level 0 backup)
RMAN> BACKUP INCREMENTAL LEVEL 1 DATABASE; (For incremental level 1 backup)
.
8. To List backup
rman (To start RMAN Client)
RMAN> connect target / (to connect to target database)
RMAN> LIST BACKUP ; (To list backup)
.
9. To Delete Obsolete backup
rman (To start RMAN Client)
RMAN> connect target / (to connect to target database)
RMAN> DELETE OBSOLETE ; (To DELETE obsolete backup)
.
Scripting of RMAN, Recovery?restore using RMAN and Advanced topics coming soon…