Oracle Database Online Backup and Restore



Note!

This section is not applicable when the Oracle database is installed in Amazon Web Services. 

You can take an online backup while the system is still up and running. This backup can be used to restore  in case of a critical failure. The backup will contain a consistent snapshot of the file system and database at a certain point of time. The snapshot may be used to recover the system to the state it had at the time of the backup.

The following sections contain examples of how to perform this procedure, and how to perform a restore, when using an Oracle database.

Example of Online Backup of Database and File System

The database part of the backup is made as one full backup and a number of incremental changes. For every incremental backup of the database, a full backup has to be taken of the file system. It is vital to keep file system and Oracle-backups in a consistent state with each other.

Taking a file system snapshot is exemplified with the fssnap utility. Taking database backup, is exemplified using the Oracle RMAN utility.

Note!

The instructions presented here are samples used with and Oracle running on a single machine.

Always consult an Oracle Database Administrator when setting up database backup scripts.

  1. Before taking backups, Oracle needs to be set in Archive mode. Make sure the following entries in the initMZ.ora file are present and correct according to the ORACLE installation:

    log_archive_dest = /path_to_oracle/redologs_directory log_archive_format = "log_%d_%a_%T_%S_%r.arc"

     

  2. Make a secure backup of initMZ.ora.
      

  3. Run the following commands:

    $ sqlplus "/AS SYSDBA" SQL> shutdown <Note, the shutdown must be graceful> SQL> startup mount SQL> alter database archivelog; SQL> archive log start; SQL> alter database open; SQL> quit;

     

  4. Use the following instructions to find the DBID (Database Identifier) and write it down. It is needed if a recovery is to be performed.

    $ rman nocatalog RMAN> connect target RMAN-06005: connected to target database: MZ (DBID=749276174) RMAN> exit;

     

  5. Make a full database backup, using a script such as the following:

     

  6. Make an incremental database backup and a file system snapshot. This creates a timestamp backup, to be used for recovery.



Example of Restoring an Online Backup

In case of critical failure, the system may be recovered with the backup files produced using a procedure such as the example described in the previous section.

Note!

TEMP table spaces will not be recovered.



  1. Shut down .
     

  2. Shut down the Oracle Instance.
     

  3. Make a cold backup of the crashed , including the Oracle instance.
     

  4. Locate the backup to restore. That is, a directory containing a full backup and at least one incremental backup. The directory should contain one or several Oracle control files control.<id>, and a snapshot of the file system MZFS_<id>.
     

  5. Remove all table space files, the corresponding archived redo logs, and control files. If necessary, remove the initMZ.ora file as well, and replace it with the backed up version.
     

  6. Make a backup copy of the control files MZ_control1 and MZ_control2.
     

  7. Replace the dynamic directories with the corresponding backup directories. An example of a dynamic directory is the storage handler directory, used by the Inter Workflow application.
     

  8. Execute the following commands:

     

  9. Restart the database instance with the following commands:

     

  10. Start .