RMAN Backup, Restore and Recover
the Noarchivelog Database
As it was mentioned in the previous chapters, Oracle strongly
recommends running the database in archivelog mode. If we do not
run the database in archivelog mode, you cannot recover the
database and apply changes to the restored datafiles due to
missing archived redo log files.
From RMAN, you cannot make a backup of the database when it is
open. If you try, the following error will occur:
RMAN-03009: failure of backup
command on ORA_DISK_1 channel at 10/21/2009 11:00:45
ORA-19602: cannot backup or copy active file in noarchivelog
mode
RMAN>
However, it is possible to backup the database from mount stage
and even apply incremental backups and recover it to specific
points in time. In the following scenario, we are going to
perform the following steps to understand how the backup of the
noarchivelog database could be restored and recovered.
- Backup the database running in noarchivelog mode
- Make some changes to the database and do an incremental
backup
- Rename the folder which contains all physical files of the
database
- Restore the backup and recover
Here are the steps in detail:
- Back up the database. Before backup, make sure you have
configured RMAN to do an automatic backup of the control file.
It will help us to easily restore the control file.
- Connect to RMAN and run the following commands:
RMAN> shutdown immediate
RMAN> startup mount
RMAN> configure controlfile autobackup on;
RMAN> backup database;
RMAN> startup;
database is already started
database opened
Create a table and insert one row. Then take a level 1
incremental backup of the database:
SQL>
create
table test (str varchar2(10));
Table created.
SQL>
insert into
test values('test');
1 row created.
SQL>
commit;
Commit complete.
SQL>
select * from
test;
STR
----------
TEST
SQL>
shutdown immediate
SQL>
startup mount
RMAN> backup incremental level 1 database;
RMAN> shutdown immediate;
Rename the oradata folder and create another empty oradata
folder for destination of datafiles that will be restored. Open
database in nomount mode and restore the control file from
autobackup. Then switch to mount mode and restore all datafiles.
Then perform recovery using the noredo keyword to not look for
redo log files that should be applied to datafiles.
RMAN> startup nomount;
RMAN> restore controlfile from autobackup;
RMAN> alter database mount;
RMAN> restore database;
RMAN> recover database;
RMAN-03002: failure of recover command at 10/21/2009 12:26:19
RMAN-06054: media recovery requesting unknown log: thread 1 seq
2
lowscn 549157
#As you see, RMAN looks for redo log files to be applied. Thus,
we use
NOREDO keyword to bypass redo log files as weve lost them all
RMAN> recover database noredo;
RMAN> alter database open resetlogs;
Now, query the table test that was created between full and
incremental backup:
SQL>
select * from
test;
STR
-----
TEST
As this shows, RMAN restored backup of the datafiles and
applied an incremental backup even though the database is running
in noarchivelog mode.
More information about backup of the database while running in
noarchivelog mode is contained in Chapter 3 under the Backing Up
a Database Running in Noarchivelog Mode? heading.