Whole Database and Partial Database Backups
This section contains the following topics:-
Whole Database Backups
-
Tablespace Backups
-
Datafile Backups
-
Control File Backups
-
Archived Redo Log Backups
See Also:
Oracle Database Utilities for information about logical backupsWhole Database Backups
A whole database backup is a backup of every datafile in the database, plus the control file. Whole database backups are the most common type of backup.Whole database backups can be taken in either
ARCHIVELOG or NOARCHIVELOG mode. Before performing whole database backups, however, be aware of the implications of backing up in ARCHIVELOG and NOARCHIVELOG modes.Figure 15-1 illustrates the valid configuration options given the type of backup that is performed.
A whole database backup is either a consistent backup or an inconsistent backup. Whether a backup is consistent determines whether you need to apply redo logs after restoring the backup.
Tablespace Backups
A tablespace backup is a backup of the datafiles that constitute the tablespace. For example, if tablespaceusers contains datafiles 2, 3, and 4, then a backup of tablespace users backs up these three datafiles.Tablespace backups, whether online or offline, are valid only if the database is operating in
ARCHIVELOG
mode. The reason is that redo is required to make the restored
tablespace consistent with the other tablespaces in the database.Datafile Backups
A datafile backup is a backup of a single datafile. Datafile backups, which are not as common as tablespace backups, are valid inARCHIVELOG databases. The only time a datafile backup is valid for a database in NOARCHIVELOG mode is if:-
Every datafile in a tablespace is backed up. You cannot restore the database unless all datafiles are backed up.
-
The datafiles are read only or offline-normal.
RMAN and User-Managed Backups
There are two types of backups: image copies and backup sets. An image copy is an exact duplicate of a datafile, control file, or archived log. You can create image copies of physical files with operating system utilities or RMAN, and you can restore them as-is without performing additional processing by using either operating system utilities or RMAN.
Note:
Unlike operating system copies, RMAN validates the blocks in the file and records the copy in the repository.RMAN with Online Backups
Because the database continues writing to the file during an online backup, there is the possibility of backing up inconsistent data within a block. For example, assume that either RMAN or an operating system utility reads the block while database writer is in the middle of updating the block. In this case, RMAN or the copy utility could read the old data in the top half of the block and the new data in the bottom top half of the block. The block is a fractured block, meaning that the data in this block is not consistent.During an RMAN backup, the Oracle database server reads the datafiles, not an operating system utility. The server reads each block and determines whether the block is fractured. If the block is fractured, then Oracle re-reads the block until it gets a consistent picture of the data.
When you back up an online datafile with an operating system utility (rather than with RMAN), you must use a different method to handle fractured blocks. You must first place the files in backup mode with the
ALTER TABLESPACE BEGIN BACKUP statement (to back up an individual tablespace), or the ALTER DATABASE BEGIN BACKUP statement (to back up the entire database). After an online backup is completed, you must run the ALTER TABLESPACE ... END BACKUP or ALTER DATABASE END BACKUP statement to take the tablespace out of backup mode.When updates are made to files in backup mode, additional redo data is logged. This additional data is needed to repair fractured blocks that might be backed up by the operating system utility.
Control File Backups
Backing up the control file is a crucial aspect of backup and recovery. Without a control file, you cannot mount or open the database.You can instruct RMAN to automatically backup the control file whenever you run backup jobs. The command is
CONFIGURE CONTROLFILE AUTOBACKUP.
Because the autobackup uses a default filename, RMAN can restore this
backup even if the RMAN repository is unavailable. Hence, this feature
is extremely useful in a disaster recovery scenario.You can make manual backups of the control file by using the following methods:
-
The RMAN
BACKUPCURRENTCONTROLFILEcommand makes a binary backup of the control file, as either a backup set or an image copy.
-
The SQL statement
ALTERDATABASEBACKUPCONTROLFILEmakes a binary backup of the control file.
-
The SQL statement
ALTERDATABASEBACKUPCONTROLFILETOTRACEexports the control file contents to a SQL script file. You can use the script to create a new control file. Trace file backups have one major disadvantage: they contain no records of archived redo logs, and RMAN backups and copies. For this reason, binary backups are preferable.
Archived Redo Log Backups
Archived redo logs are essential for recovering an inconsistent backup. The only way to recover an inconsistent backup without archived logs is to use RMAN incremental backups. To be able to recover a backup through the most recent log, every log generated between these two points must be available. In other words, you cannot recover from log 100 to log 200 if log 173 is missing. If log 173 is missing, then you must halt recovery at log 172 and open the database with theRESETLOGS option.Because archived redo logs are essential to recovery, you should back them up regularly. If possible, then back them up regularly to tape.
You can make backups of archived logs by using the following methods:
-
The RMAN
BACKUPARCHIVELOGcommand
-
The RMAN
BACKUP...PLUSARCHIVELOGcommand
-
An operating system utility
No comments:
Post a Comment