The Oracle suggested backup strategy is a scheduled disk backup strategy that protects your data and provides efficient recoverability to any point in the user-specified recovery window (time period). It leverages the incrementally updated backup features to provide faster backups than whole database backups, and faster recoverability than is possible by applying multiple incremental backups to the last full backup.
Complete the following tasks, detailed in this section, to schedule a daily backup that implements the Oracle suggested backup strategy:
This section also contains the following topic:
The Oracle suggested backup strategy is based on incrementally updated backups. This strategy starts with an image copy of each data file and then rolls forward the image copies each day by applying an incremental level 1 backup.
For each data file, the strategy calls for backups as follows:
At the beginning of day 1 of the strategy (the time the first scheduled job actually runs), Oracle Recovery Manager (RMAN) creates an incremental level 0 image copy. It contains the data file contents at the beginning of day 1.
If a recovery is required, then the archived redo log files from day 1 can be used to recover to any point during day 1.
At the beginning of day 2, RMAN creates a differential incremental level 1 backup that contains the blocks changed during day 1.
If a recovery is required, then RMAN can apply this incremental level 1 to roll forward the level 0 backup to the beginning of day 2. RMAN can use archived redo log files to recover to any point during day 2.
At the beginning of each day n for day 3 and onward, RMAN applies the level 1 backup from the beginning of day n-1 to the level 0 backup. This action brings the data file copy to its state at the beginning of day n-1. Then, RMAN creates a new level 1 backup that contains the blocks changed during day n-1.
If a recovery is required, then RMAN can apply this incremental level 1 backup to the data file rolled forward on day n-1 to the beginning of day n. RMAN can use archived redo log files to recover the database to any point during day n.
In this Oracle suggested backup strategy, the data file image copies and the level 1 incremental backups share the same tag. You can safely implement other backup strategies without interfering with the Oracle suggested backup strategy.
Oracle suggested backup strategies also use tape backups in addition to disk backups, but these are beyond the scope of this section.
To use the Oracle suggested backup strategy, ensure that:
The database is in ARCHIVELOG
mode.
The fast recovery area size is configured, or a default device for storing backups is configured.
You have added a database host user to the OSBACKUPDBA operating system group, for operating system authentication.
This backup script implements the Oracle suggested backup strategy, enabling quick recovery to any time in the preceding 24 hours. This script can be used to back up a non-CDB or a whole multitenant container database (CDB).
To create the backup script for UNIX and Linux:
Start a text editor and create and save a file with the following contents. Save the file in a directory that is accessible to the Oracle Database software and on which the Oracle software owner has the read permission.
Note:
In the following script, substitute the correct values for your installation for the ORACLE_HOME
and ORACLE_SID
environment variables.
#!/bin/sh export ORACLE_HOME=/u01/app/oracle/product/11.2.0/dbhome_1 export ORACLE_SID=orcl PATH=$ORACLE_HOME/bin:$PATH rman <<EOF connect target / RUN { ALLOCATE CHANNEL disk_iub DEVICE TYPE DISK; RECOVER COPY OF DATABASE WITH TAG daily_iub; BACKUP INCREMENTAL LEVEL 1 FOR RECOVER OF COPY WITH TAG daily_iub DATABASE; } exit EOF
It is recommend that you run the script manually, to check for errors, before scheduling it. Your manual run of the script will start day one of the strategy, creating an incremental level 0 image copy of all datafiles.
To test the backup script:
The script starts Oracle Recovery Manager (RMAN), which starts the backup. The output from RMAN includes warning messages similar to the following:
... no copy of datafile 1 found to recover no copy of datafile 2 found to recover ... no parent backup or copy of datafile 1 found no parent backup or copy of datafile 2 found ...
These messages are normal for the first run of the script.
Note:
For the second run of the script, the output includes only these warning messages:
no copy of datafile 1 found to recover no copy of datafile 2 found to recover ...
Again, these messages are normal. For the third and subsequent script runs, no further warning messages are output.
The following procedure uses the cron
utility to schedule daily database backups at 2:00 a.m.
To schedule the Oracle-suggested disk backup strategy:
See Also:
Your operating system documentation for a description of the crontab command and crontab files