Hot backup in Oracle

It is possible to make a hot backup in Oracle. This implies that we do not have to shutdown the database before creating a backup.

The steps are as follows:

First, we check if the system is in an archive mode:

archive log list

This command is given in sqlplus when logged in as sysdba. The answer from the system should be something like “Database log mode Archive Mode”. This indicates that archive files are created. The files look like “ARC0000000197_0999381692.0001” in a directory. In my case the directory is “C:\app\tmaanen\product\12.1.0\dbhome_1\RDBMS”.

We also must verify where the datafiles are stored. This can be checked with:

select file_id, file_name from dba_data_files;

We can then check which archive log is relevant:

select group#, sequence#, status from v$log;

Now, we can start the backup:

alter database begin backup;
alter system switch logfile;

Now copy all datafiles (*.dbf) , all archive files (ARC*.*) and the controlfiles.

Then continue the system:

alter database end backup;

To restore the database, we must take several steps:

First, shutdown the instance:

shutdown immediate

Copy the *.dbf files to the datafile locatipon. Copy the controlfiles to controlfile location. Copy the archive files to the archive location.

Then start Oracle in the mount status:

startup mount;
recover database until cancel using backup controlfile;

With the latter command, we must indicate “AUTO”.

We start the database with

alter database open resetlogs;

This should provide the consistent database on the moment when database was backed up.