top of page

Backup and Recovery Basics

Writer's picture: Brian WashingtonBrian Washington

Production databases rely on physical backups as the primary method.

Development databases and for some data movement, logical backups offer a viable solution.

Logical backups = Data Pump Exports and Imports. During Data Pump Export, the output written to a XML file called a dump file. The dump file also contains the commands necessary to completely re-create all the chosen objects and data.

Physical Backups = Involve copying the files that constitute the database (control files, data files, archived redo logs, spfile).

Cold (offline) Backups = Occur when the database has been shut down normally. Considered a consistent backup. While the database is "offline", the following files are backed up:

  • All control files

  • All data files

  • All archived redo logs

  • Pfile or SPFILE


Hot (online) Backups = Use online backups for any database that is running in ARCHIVELOG mode. Physical backup of the database occurs while the database is open. An online backup involves setting each tablespace into a backup state, backing up its datafiles, and then restoring the tablespace to its normal state. When using RMAN, it is not necessary to manually place each tablespace into a backup state.

The database can be fully recovered from an online backup and, via the archived redo logs, be rolled forward to any point in time before the failure. All committed transactions that were in the database at the time of failure will be restored, and any uncommitted transactions get rolled back. When the database is open, the following files are backed up:

  • All datafiles

  • All archived redo logs

  • One control file

  • SPFILE


Enable archiving to the fast recovery area only with DB_RECOVERY_FILE_DEST parameter. As an Oracle best practice, the fast recovery area should be created on a mirrored ASM disk group separate from the primary disk group. DB_RECOVERY_FILE_DEST_SIZE assists in managing the size of the fast recovery area.

Enable archiving to the fast recovery area and set at least one LOG_ARCHIVE_DEST_n parameter to another location outside of the fast recovery area. 

Set at least two LOG_ARCHIVE_DEST_n parameters to archive to non-fast recovery area destinations.

Retention Policy

Recovery Window = RMAN will retain as many backups as necessary to bring the database to any point in time within the recovery window. For example, with a recovery window of seven days, RMAN will retain enough backups to ensure that the database can be restored and recovered to any point in time within the seven days. Any backups not needed to support this recovery window are marked OBSOLETE.

Redundancy = RMAN retains the specified number of backups of each datafile and control file. Extra copies or backups beyond the specified number are marked as OBSOLETE.

Control File Autobackup = By default, the control file is not automatically backed up. By turning this option on, the control file is automatically backed up when a backup occurs.

Full backups = records all blocks

Incremental Backups = An alternative to using full backups with archived redo logs is to use incremental backups along with archived redo logs for recovery. 

The initial incremental backup is known as a Level 0 incremental backup

Each incremental backup after the initial incremental backup contains only changed blocks and as a result takes less time and space. Known as Incremental Level 1 backups.

Incremental Level 1 backups can either be cumulative or differential

Cumulative backup records all changed blocks since the initial incremental backup.

Differential backup records all changed blocks since the last incremental backup, whether it was a level 0 or a level 1 incremental backup.

Validating Backups

The RMAN command BACKUP VALIDATE DATABASE will simulate a backup, checking for the existence of the specified files, ensuring that they are not corrupted. No backup files are created. This command allows to check for problems with the database or archived redo logs proactively, giving and opportunity to fix problems before the actual backup operation.

Validate Restore Operations

RMAN can validate backups that have already been made. 

RESTORE …PREVIEW command will provide a list of files that RMAN will use to perform the requested operation. No files are actually restored.

RESTORE …VALIDATE command validates whether the backupsets themselves are readable and not corrupted.

RECOVERY

Block Media Recovery = RMAN can perform block media recovery rather than a full datafile recovery when there are only a small handful of blocks to recover in a database. While block media recovery is in progress, the affected datafiles can remain online and available to users.

Data Recovery Advisor = can both proactively and reactively analyze failures. It will not automatically fix problems it finds but instead provide on or more possible fixes and gives the option and commands to perform the fix. (as of 12.1, only non-CDBs and single-instance CDBs are supported).

CONTROLFILE RECOVERY WITH AUTOBACKUP

deletion of both controlfiles

controlfile autobackup was on.

startup nomount.

restore controlfile from autobackup.

restore database.

recover database.

WITHOUT AUTOBACKUP

You must tell RMAN to restore from a specific backup piece file.

restore controlfile from '/u01/app/oracle/flash_recovery_area/ORCL/controlfile/controlfile01.ctl'

DATAFILE RESTORE AND RECOVERY

alter database datafile 6 offline

restore datafile 6;

recover datafile 6;

alter database datafile 6 online

CORRUPTED TEMPFILE

create new tempfile

make new tempfile default temporary tablespace

drop old tempfile

8 views0 comments

Recent Posts

See All

ความคิดเห็น


ปิดการแสดงความคิดเห็น
Post: Blog2_Post
bottom of page