Views

Thursday, September 28, 2017

Oracle Backup and Restore Case Scenarios - Case Study 8 (Recover Noarchivelog database)

Oracle Backup and Restore Case Scenarios - Case Study 8

Case 8: Recover a Noarchivelog database

SQL> select name,open_mode,log_mode from v$database;

NAME          OPEN_MODE                     LOG_MODE
--------- -------------------- ------------
ORADB1      READ WRITE                     NOARCHIVELOG

Connect to target and catalog database

rman target / catalog rman/oracle@catdb

Take a full backup of database. You can't take rman backup of noarchivelog database when database is open.

RMAN> backup database;

...
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 09/27/2017 12:31:17
ORA-19602: cannot backup or copy active file in NOARCHIVELOG mode

Put the database in mount mode.

RMAN> shutdown immediate;
RMAN> startup mount;

Now you can backup your database.

RMAN> backup database;

RMAN> startup

database is already started
database opened

Create One more table to take incremental backup.

sqlplus aj/aj@oradb1

SQL> create table testaj tablespace tbs_test as select * from dba_objects;

Table created.

Take the ccount of table to verify later.

SQL> select count(*) from testaj;

  COUNT(*)
----------
     86978

SQL> shut immediate;

Take an incremental level 1 backup of database

SQL> shutdown immediate
SQL> startup mount
rman target / catalog rman/oracle@catdb
RMAN> backup incremental level 1 database;
RMAN> shutdown immediate;

Simulate failure by renamign all datafiles, controlfiles, spfile and init file for ORADB1

Now run the restore script in RUN prompt.

RMAN> RUN
{
STARTUP NOMOUNT;
RESTORE SPFILE;
SHUTDOWN IMMEDIATE;
STARTUP NOMOUNT;
RESTORE CONTROLFILE;
ALTER DATABASE MOUNT;
RESTORE DATABASE;
ALTER DATABASE OPEN RESETLOGS;
}

connected to target database (not started)
startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/u01/app/oracle/product/11.2.0/db_1/dbs/initORADB1.ora'
...
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started
...
channel ORA_DISK_1: restoring SPFILE
output file name=/u01/app/oracle/product/11.2.0/db_1/dbs/spfileORADB1.ora
...
channel ORA_DISK_1: restoring control file
output file name=/u01/app/oracle/oradata/ORADB1/control01.ctl
output file name=/u01/app/oracle/fast_recovery_area/ORADB1/control02.ctl
...
database mounted
...
channel ORA_DISK_1: starting datafile backup set restore
...
database opened

Verfy the data.


sqlplus aj/aj@oradb1
SQL> select count(*) from testaj;

  COUNT(*)
----------
     86978

No comments:

Post a Comment

Leave a Reply...