Physical Backups  «Prev  Next»

Lesson 4Closed Database Backups
Objective List the Required Steps to Prepare for a Closed Database Backup.

Steps to Prepare Closed Database Backup in Oracle

A closed or cold database backup is an operating system backup of all the datafiles, redo log files, control file(s), parameter files, and the password file that constitute an Oracle database.

Advantages and Disadvantages for Closed Database Backup

ADVANTAGES DISADVANTAGES
Maintain high database availability:
When using an open database backup, the database is available for process access during the backup and the business transactions will not be interrupted because of the backup.
More training required for the DBA : Because an open database backup is a complicated process (compared to the closed database backup), a DBA will need more training to handle the process.
Can be done at a tablespace or datafile level :
A DBA may choose to backup all the datafiles for a specific tablespace or just individual datafiles for a tablespace.
More error:prone :
An online database backup is more error-prone because of additional operator interaction. Thus, it is best to use tested scripts to automate the process.
Allows recovery to point-in-time: With an open database backup, the DBA may choose to recover the database to a certain point of time.

Online Redo Log Switching

Another important RMAN feature is automatic online redo log switching. To make an open database backup of archived redo logs that includes the most recent online redo log, you can execute the BACKUP command with any of the following clauses:
  1. PLUS ARCHIVELOG
  2. ARCHIVELOG ALL
  3. ARCHIVELOG FROM

Before beginning the backup, RMAN switches out of the current redo log group, and archives all online redo logs that have not yet been archived, up to and including the redo log group that was current when the command was issued. This feature ensures that the backup contains all redo generated before the start of the command. An effective way of backing up archived redo logs is the
BACKUP ... PLUS ARCHIVELOG

command, which causes RMAN to do the following:
  1. Runs the ALTER SYSTEM ARCHIVE LOG CURRENT statement.
  2. Runs BACKUP ARCHIVELOG ALL. If backup optimization is enabled, then RMAN skips logs that it has already backed up to the specified device.
  3. Backs up the rest of the files specified in the BACKUP command.
  4. Runs the ALTER SYSTEM ARCHIVE LOG CURRENT statement.
  5. Backs up any remaining archived logs generated during the backup. If backup optimization is not enabled, then RMAN backs up the logs generated in Step 1 plus all the logs generated during the backup.
  6. The preceding steps guarantee that data file backups taken during the command are recoverable to a consistent state. Furthermore, unless the online redo log is archived at the end of the backup, DUPLICATE is not possible with the backup.

Before a backup is made there are several steps you must take:
  1. Perform a clean shutdowns
  2. Get an up-to-date list of all files
  3. Locate files

Perform Clean shutdown

First, all datafiles must be closed with a clean shutdown procedure. If a database instance is aborted, you have to reopen it and shut it down cleanly by issuing the command
  1. SHUTDOWN IMMEDIATE or
  2. SHUTDOWN NORMAL.
Without a clean shutdown of the database, the backup files are inconsistent with respect to each other. This inconsistency forces Oracle to do an instance recovery on the first startup after the backup is restored. In certain failure scenarios, this automatic recovery may not be successful, and the DBA may be forced to troubleshoot. It is best to avoid this situation by ensuring the database is shut down cleanly before backup.

Get a List of all Files

Second, you must get an up-to-date list of all the files for backup. Oracle datafiles belonging to a single database can reside on several disks. In order to have a complete copy of the database for database recovery, you must decide which files you need to back up. Typically you must locate and copy the following files:
Oracle Database File File Description
Datafiles Large binary file(s) containing data, indexes, and otherdatabase objects
Redo logs Small, re-usable binary files that continuously receive database change information in the form of "redo entries"
Control files Small binary file(s) containing database structure information
Parameter files Small text file(s) containing instance startup parameters
The password file Small, encrypted binary file containing DBA-level passwords

Locate Files

Next, you must determine where these files are located. Since datafiles, redo logs, and control files are database files, you can obtain information about these files by querying the data dictionary views using SQL*Plus or Server Manager. The following table gives you a list of the data dictionary views you can use to find information about the database files that you must backup:
Data Dictionary Views Function
V$DATAFILE Contains a list of the names and status of all datafiles
V$CONTROLFILEContains the names of all control files
V$LOGFILE Contains the names of all redo log files
DBA_DATA_FILES Contains a list of all datafiles and their respective tablespaces

The other two files, the parameter file and password file, are operating system files and are usually located in the file system of the machine on which the database server is started. A parameter file is also called init.ora with the naming convention initSID.ora. You can usually find it in ORACLE_HOME\DBS. On an NT platform, the parameter and the password files for a database named P look like this:
Parameter file:
D:\data\database\initP.ora
Password file: D:\orant\database\pwdP.ora

The series of images below demonstrates how to use the data dictionary views to retrieve the required information.

How to obtain Information about Database Files

SQL> SELECT NAME, STATUS FROM V$DATAFILE;
1) To get a list of names and the status of all datafiles from V$DATAFILE in SQL*PLUS, the DBA issues a SELECT statement.
1) To get a list of names and the status of all datafiles from V$DATAFILE in SQL*PLUS, the DBA issues a SELECT statement.

2) To find all the control files, a DBA can use the V$CONTROLFILE view
2) To find all the control files, a DBA can use the V$CONTROLFILE view


3) The DBA can use the V$LOGFILE view to find the names of all redo log files. Note the correct column in the select statement is MEMBER for this view.
3) The DBA can use the V$LOGFILE view to find the names of all redo log files. Note the correct column in the select statement is MEMBER for this view.

4) The DBA can use the DBA_DATA_FILES data dictionary view to get a list of all datafiles and their respective tablespaces
4) The DBA can use the DBA_DATA_FILES data dictionary view to get a list of all datafiles and their respective tablespaces

Oracle Database Files Concepts

The final components of the Oracle architecture consist of the physical files where our information resides on disk. Oracle has several types for data files, two of the five listed are described below.
  1. Database datafiles
  2. Control files
  3. Online redo logs
  4. Parameter files
  5. Other database related files
Database Datafiles
"Database datafiles" are physical files stored on disk and these files are used to store data on disk. Database datafiles are only written to by the DBWR processes. These database datafiles are associated with Oracle tablespaces, which are logical containers for tables and indexes.

Control files

The Control File of the database is a binary file that contains a great deal of database information. The control file contains the
  1. database name and
  2. data about the database log files.
Oracle cannot function without valid control files. Because the control file is so important, Oracle allows you to maintain duplicate copies of the control file. When you have more than one control file, then you are said to be multiplexing your control files. It is a good practice to put these multiple copies on different disks to protect the control file.

If you use SQL*Plus, you must log in as System or Sys, or as a user with DBA privileges. The next lesson shows you how to perform a closed database backup.

SEMrush Software