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.
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"
Â
Make a secure backup ofÂ
initMZ.ora
.
 Â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;
Â
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;
Â
Make a full database backup, using a script such as the following:
Â
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.
Shut down .
ÂShut down the Oracle Instance.
ÂMake a cold backup of the crashed , including the Oracle instance.
Â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 systemMZFS_<id>
.
Â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.
ÂMake a backup copy of the control filesÂ
MZ_control1
 andÂMZ_control2
.
Â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.
ÂExecute the following commands:
Â
Restart the database instance with the following commands:
Â
Start .