Você está na página 1de 5

ORACLE RMAN BACKUP

This article shows how to setup and configure RMAN backups.

A. ENABLING ARCHIVELOG MODE

When you enable ARCHIVELOG Mode, you will prevent REDO logs to be overwritten.
To enable archiving let’s first check the current archiving mode:

SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
NOARCHIVELOG

After ensuring that we are on NOARCHIVELOG mode, we can enable archiving:

SQL> startup mount


ORACLE instance started.

Total System Global Area 184549376 bytes


Fixed Size 1300928 bytes
Variable Size 157820480 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.

SQL> alter database archivelog;


Database altered.

SQL> alter database open;


Database altered.

After opening database, let’s check if we were successful:

B. SCHEDULING RMAN BACKUP

a. RMAN SCHEDULING VIA ORACLE ENTERPRISE MANAGER (OEM)

In order to schedule RMAN backup via oracle enterprise manager, you need to login to OEM
successfully with your SYS account. After loging in, navigate to “Maintenance-> Schedule
Backup".

To perform successful backup, you need to inform Oracle about your operating system
login credentials because Oracle will need to access database files through your os file
security system.

ATTENTION: When you change your operating system password, do not forget to update
your OS credentials info on OEM previously scheduled RMAN jobs.

Later on, choose “customized backup” to specify your backup strategy and choose “whole
database” as the object you want to backup unless you have another specific purpose.
Now you will see the page which will allow you to save all the details you want your RMAN
backup schedule has.

Lets explore these properties in details one by one:

Backup Type: There are two types of backups strategizes you can choose which are full
backups and incremental backups. We will go in more details on incremental backups
because it has a amazing algorithm inside.

- Full Backups
- Incremental Backups: RMAN incremental backups back up only datafile blocks that
have changed since a specified previous backup. You can make incremental backups of
databases, individual tablespaces or datafiles. The goal of an incremental backup is to back
up only those data blocks that have changed since a previous backup.

Incremental Backup Algorithm: Each data block in a datafile contains a system change
number (SCN), which is the SCN at which the most recent change was made to the block.
During an incremental backup, RMAN reads the SCN of each data block in the input file
and compares it to the checkpoint SCN of the parent incremental backup. If the SCN in the
input data block is greater than or equal to the checkpoint SCN of the parent, then RMAN
copies the block. Note that if you enable the block change tracking feature, RMAN can refer
to the change tracking file to identify changed blocks in datafiles without scanning the full
contents of the datafile. Once enabled, block change tracking does not alter how you take
or use incremental backups, other than offering increased performance. Incremental
backups either be Level 0 (same as full back up) or Level 1 (details are below).

Differential or Cumulative Level1 Incremental Backups:


• A differential backup, which backs up all blocks changed after the most recent
incremental backup at level 1 or 0.
• A cumulative backup, which backs up all blocks changed after the most recent
incremental backup at level 0.

Incremental backups are differential by default.

HINT: Cumulative backups are preferable to differential backups when recovery time is
more important than disk space, because during recovery each differential backup must be
applied in succession. Use cumulative incremental backups instead of differential, if
enough disk space is available to store cumulative incremental backups.

• Backup Mode: If your database is in ARCHIVELOG mode, you can take ONLINE backups
which means you can have your in OPEN mode during backup. On the other hand, if your
database is in NOARCHIVELOG mode, when your backup job starts it will shutdown your
database and start up your database in mount state. After finishing backup procedure,
your backup job will alter your database to open state.

• Advanced: If you mark “Also backup all archived logs on disk” option, rman will backup
your achived logs. If you also mark “Delete all archived logs from disk after successfully
backing up” rman will delete them after backing up. This option is useful when you start to
have disk size problems. Marking “Use Proxy copy supported by media management
software to perform a backup” will let you enable RMAN turns over control of the data
transfer to a media manager that supports this feature. When you mark “Delete obsolete
backups” option, the retention policy determines which backups and image copies are
obsolete. If selected, the obsolete backups and copies will be deleted when the backup is
finished.

When you click NEXT button, you will see a screen which will ask you about where would
you like to store your backup files, you can either choose disk backup or tape backup:

Third step is setting the job schedule:

Later on, fourth step is checking the RMAN script and submitting the job:

b. RMAN SCHEDULING VIA RMAN SCRIPTING

If you no longer have a particular archivelog file you can let RMAN catalog
know this by issuing the following command at the rman prompt after
connecting to the rman catalog and the target database -

change archivelog all crosscheck ;

C. RESTORING/RECOVERING FROM RMAN BACKUP


a. Connecting to RMAN
After connecting to RMAN command prompt, we can set retention policy to recovery
window, redundancy and controlfile autobackup on options as below:

SOURCE

1. Enabling ARCHIVELOG Mode, http://www.cuddletech.com/articles/oracle/node58.html


2. Oracle® Database Backup and Recovery Basics, http://download-
uk.oracle.com/docs/cd/B19306_01/backup.102/b14192/bkup004.htm

ORACLE RMAN BACKUP

This article shows how to setup and configure RMAN backups.

A. ENABLING ARCHIVELOG MODE

When you enable ARCHIVELOG Mode, you will prevent REDO logs to be overwritten.
To enable archiving let’s first check the current archiving mode:

SQL> SELECT LOG_MODE FROM SYS.V$DATABASE;

LOG_MODE
------------
NOARCHIVELOG

After ensuring that we are on NOARCHIVELOG mode, we can enable archiving:

SQL> startup mount


ORACLE instance started.

Total System Global Area 184549376 bytes


Fixed Size 1300928 bytes
Variable Size 157820480 bytes
Database Buffers 25165824 bytes
Redo Buffers 262144 bytes
Database mounted.

SQL> alter database archivelog;


Database altered.

SQL> alter database open;


Database altered.

After opening database, let’s check if we were successful:

B. SCHEDULING RMAN BACKUP

a. RMAN SCHEDULING VIA ORACLE ENTERPRISE MANAGER (OEM)

In order to schedule RMAN backup via oracle enterprise manager, you need to login to OEM
successfully with your SYS account. After loging in, navigate to “Maintenance-> Schedule
Backup".

To perform successful backup, you need to inform Oracle about your operating system
login credentials because Oracle will need to access database files through your os file
security system.

ATTENTION: When you change your operating system password, do not forget to update
your OS credentials info on OEM previously scheduled RMAN jobs.

Later on, choose “customized backup” to specify your backup strategy and choose “whole
database” as the object you want to backup unless you have another specific purpose.
Now you will see the page which will allow you to save all the details you want your RMAN
backup schedule has.

Lets explore these properties in details one by one:

Backup Type: There are two types of backups strategizes you can choose which are full
backups and incremental backups. We will go in more details on incremental backups
because it has a amazing algorithm inside.

- Full Backups

- Incremental Backups: RMAN incremental backups back up only datafile blocks that
have changed since a specified previous backup. You can make incremental backups of
databases, individual tablespaces or datafiles. The goal of an incremental backup is to back
up only those data blocks that have changed since a previous backup.

Incremental Backup Algorithm: Each data block in a datafile contains a system change
number (SCN), which is the SCN at which the most recent change was made to the block.
During an incremental backup, RMAN reads the SCN of each data block in the input file
and compares it to the checkpoint SCN of the parent incremental backup. If the SCN in the
input data block is greater than or equal to the checkpoint SCN of the parent, then RMAN
copies the block. Note that if you enable the block change tracking feature, RMAN can refer
to the change tracking file to identify changed blocks in datafiles without scanning the full
contents of the datafile. Once enabled, block change tracking does not alter how you take
or use incremental backups, other than offering increased performance. Incremental
backups either be Level 0 (same as full back up) or Level 1 (details are below).

Differential or Cumulative Level1 Incremental Backups:


• A differential backup, which backs up all blocks changed after the most recent
incremental backup at level 1 or 0.
• A cumulative backup, which backs up all blocks changed after the most recent
incremental backup at level 0.

Incremental backups are differential by default.

HINT: Cumulative backups are preferable to differential backups when recovery time is
more important than disk space, because during recovery each differential backup must be
applied in succession. Use cumulative incremental backups instead of differential, if
enough disk space is available to store cumulative incremental backups.

• Backup Mode: If your database is in ARCHIVELOG mode, you can take ONLINE backups
which means you can have your in OPEN mode during backup. On the other hand, if your
database is in NOARCHIVELOG mode, when your backup job starts it will shutdown your
database and start up your database in mount state. After finishing backup procedure,
your backup job will alter your database to open state.

• Advanced: If you mark “Also backup all archived logs on disk” option, rman will backup
your achived logs. If you also mark “Delete all archived logs from disk after successfully
backing up” rman will delete them after backing up. This option is useful when you start to
have disk size problems. Marking “Use Proxy copy supported by media management
software to perform a backup” will let you enable RMAN turns over control of the data
transfer to a media manager that supports this feature. When you mark “Delete obsolete
backups” option, the retention policy determines which backups and image copies are
obsolete. If selected, the obsolete backups and copies will be deleted when the backup is
finished.

When you click NEXT button, you will see a screen which will ask you about where would
you like to store your backup files, you can either choose disk backup or tape backup:

Third step is setting the job schedule:

Later on, fourth step is checking the RMAN script and submitting the job:

b. RMAN SCHEDULING VIA RMAN SCRIPTING


If you no longer have a particular archivelog file you can let RMAN catalog
know this by issuing the following command at the rman prompt after
connecting to the rman catalog and the target database -

change archivelog all crosscheck ;

C. RESTORING/RECOVERING FROM RMAN BACKUP


a. Connecting to RMAN

After connecting to RMAN command prompt, we can set retention policy to recovery
window, redundancy and controlfile autobackup on options as below:

SOURCE

1. Enabling ARCHIVELOG Mode, http://www.cuddletech.com/articles/oracle/node58.html


2. Oracle® Database Backup and Recovery Basics, http://download-
uk.oracle.com/docs/cd/B19306_01/backup.102/b14192/bkup004.htm

Você também pode gostar