Purpose
We want to backup the Oracle database to be available all time to users and minimize down time.
Objectives
- Overview
- Benefits of using RMAN Backups
- Pre-installation Tasks
- Software Requirements
- RMAN Connection to Database
- RMAN Configuration
- Incremental Backups
- Incremental Backup Scripts
- Daily Backup Strategy
Overview
Recovery Manager is Oracle’s utility to manage the backup, and more importantly the recovery, of the database. It eliminates operational complexity while providing superior performance and availability of the database. Recovery Manager debuted with Oracle8 to provide DBAs an integrated backup and recovery solution.
Recovery Manager determines the most efficient method of executing the requested backup, restore, or recovery operation and then executes these operations in concert with the Oracle database server. Recovery Manager and the server automatically identify modifications to the structure of the database and dynamically adjust the required operation to adapt to the changes.
Benefits of Using RMAN Backup
- RMAN supports incremental backups of database
- It is free with your database software
- Easy to use
- It is fully integrated with database and fully supported by Oracle
- It supports auto backup for Controlfile and SPfile
- It restores only the corrupted files from backup
- Backups the used blocks only
- Can be scheduled as an operating system job to backup database daily
- Can recover a tablespace to a point in time
- Block media recovery
Pre-installation Tasks
- On your backup server, create a folder that holds the backup files. e.g create a New Folder called “F:\rman_backup“ to hold the daily database backups
- Inside “rman_backup“ Folder, create 5 Folders “arch“,“level0“,“level1“,“level2“,“control“ to hold daily backups of Archived redo log files,Level0,Level1,Level2 and Controlfile
Software version that I used:
Operating system: Windows 2000/2003 Server
Oracle database version: Oracle 9i or 10g
Database Archivelog Mode: Archivelog Mode
RMAN Connection to Database
The connection will be to the target database which is the database that you will use RMAN to back up and restore: RMAN connects to the target database as SYSDBA. If you do not have this privilege, then the connection fails. You can connect with the SYSDBA privilege by using a password file or using operating system authentication.
1- If the DBA connects to database from the Server Machine:
C:\>rman target /
2- If the DBA connects to database remotely:
C:\>rman target sys/syspassword@service_name
RMAN Configuration
You can configure persistent settings in the RMAN environment. The configuration setting is done once, and used by RMAN to perform all subsequent operations. Display the preconfigured settings by typing the command SHOW ALL.
There are various parameters that can be used to configure RMAN operations to suit your needs. Some of the things that you can configure are:
* Required number of backups of each datafile
* Number of server processes that will do backup/restore operations in parallel
* Directory where on-disk backups will be stored
* Controlfile autobackup or not
* Backups Retention Policy
RMAN> CONFIGURE DEFAULT DEVICE TYPE TO DISK;
RMAN> CONFIGURE RETENTION POLICY TO RCOVERY WINDOW OF 7 DAYS;
RMAN> CONFIGURE DEVICE TYPE DISK PARALLELISM 2;
RMAN> CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT
\'F:\rman_backup\ora_df%t_s%s_s%p\';
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP ON;
RMAN> CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO \'F:\rman_backup\control\ora_cf%F\';
RMAN> CONFIGURE BACKUP OPTIMIZATION ON;
Incremental Backups
In an incremental backup strategy, you first create a level 0 backup, which is a whole backup of the database.
Later, you can create backups at a higher \"level.\" In a cumulative incremental backup, RMAN only backs up those blocks that are different between the specified level n and the most recent level n-1.
Incremental Backup Scripts
DBA runs the following scripts from RMAN command line prompt after connecting to the target database to backup his database
1- Backup Level 0
run{
allocate channel c1 device type disk;
backup incremental level 0
format \'F:\rman_backup\level0\bak_%s_%t_level0.bak\'
database include current controlfile;
}
2- Backup Level 1
run{
allocate channel c1 device type disk;
backup incremental level 1
format \'F:\rman_backup\level1\bak_%s_%t_level1.bak\'
database include current controlfile;
}
3- Backup Level 2
run{
allocate channel c1 device type disk;
backup incremental level 2
format \'F:\rman_backup\level2\bak_%s_%t_level2.bak\'
database include current controlfile;
}
4- Backup Archivelog Files
run{
allocate channel c1 device type disk;
backup
format \'F:\rman_backup\arch\bak_%s_%t_ARCH.bak\'
archivelog all delete input;
sql \'alter system archive log current\';
}
Recommended Daily Backup Strategy
Saturday:Backup Level0 + Archivelog files
Sunday:Backup Level1 + Archivelog files
Monday:Backup Level2 + Archivelog files
Tuesday:Backup Level2 + Archivelog files
Wednesday:Backup Level2 + Archivelog files
Thursday:Backup Level2 + Archivelog files
Friday:Backup Level2 + Archivelog files
Notes:
- Level 0 backup is made at the day with less database activity as it is time and hardware resources consuming.
- In this article we assumed that the day with less database activity is Saturday.
- Level1 backup is made once a week.
- Level2 backup is made at the rest of days.
- Archivelog files are backed up daily.
- After DBA backs up the database to disk he will copy these backup files to a Tape or any other media away of the server to protect them from being lost if the server crashes.
No comments:
Post a Comment