Saturday, June 21, 2014

Database Recovery with RMAN backup (Disaster Recovery)

Database Recovery with RMAN backup (Disaster Recovery)
This are the steps for Database recovery when entire complete database crashed even though don’t have spfile and control file backup. I have one copy of Full RMAN backup. Using this backup I am going to be performing the recovery scenario.
Here in this case required to rebuild entire database server
Environment is  OEL 6.5 Oracle 11g with ASM standalone server.
RMAN Backup:
1)      Controlfile and SPFILE autobackup
2)      RMAN Full Backup files
3)      RMAN Archivelog files
Steps:
1)      Create new file system same as old server.
2)      Install same version of Oracle Software in the production server.(In this case 11.2.0.3 Enterprise Edition).
3)      Create the Instance.
4)      Create the relevant folder hierarchy under <ORACLE_BASE> directory.
5)      Restore the SPFILE from autobackup, and use the SPFILE to start the instance in NOMOUNT state.
6)      Restore the controlfile from autobackup, and MOUNT the database .
7)      Restore the Database from RMAN backup files .
8)      Recover the Database from RMAN backup files, and OPEN the database with RESETLOGS.



Database Disaster Recovery using only RMAN Backups
Note: After installation of same version of Oracle software below are the steps to be followed.

[oracle@linux dbs]$ set ORACLE_SID=ORCL
[oracle@linux dbs]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jun 20 19:04:55 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database (not started)

RMAN> set DBID=1372442605

executing command: SET DBID

RMAN> startup force nomount;

startup failed: ORA-01078: failure in processing system parameters
ORA-01565: error in identifying file '+DATA/orcl/spfileorcl.ora_2'
ORA-17503: ksfdopn:2 Failed to open file +DATA/orcl/spfileorcl.ora_2
ORA-15056: additional error message
ORA-17503: ksfdopn:2 Failed to open file +DATA/orcl/spfileorcl.ora_2
ORA-15173: entry 'spfileorcl.ora_2' does not exist in directory 'orcl'
ORA-06512: at line 4

starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area     158662656 bytes

Fixed Size                          2226456 bytes
Variable Size                104859368 bytes
Database Buffers          46137344 bytes
Redo Buffers                    5439488 bytes


RMAN>





















[oracle@linux dbs]$ rman target /

Recovery Manager: Release 11.2.0.3.0 - Production on Fri Jun 20 19:11:56 2014

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

connected to target database: DUMMY (not mounted)

RMAN> set DBID=1372442605

executing command: SET DBID

RMAN> restore spfile to '/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initasm.ora' from "+DATA/ORCL/AUTOBACKUP/2014_06_20/s_850757433.294.850757669";

Starting restore at 20-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=172 device type=DISK

channel ORA_DISK_1: restoring spfile from AUTOBACKUP +DATA/ORCL/AUTOBACKUP/2014_06_20/s_850757433.294.850757669
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 20-JUN-14

RMAN> shutdown immediate;

Oracle instance shut down

RMAN>



(Or )

2nd Method :

I am using my pfile for temporarily to start the Instance  Based on my test server. Below is my pfile script

orcl.__db_cache_size=3305111552
orcl.__java_pool_size=50331648
orcl.__large_pool_size=16777216
orcl.__oracle_base='/u01/app/oracle'#ORACLE_BASE set from environment
orcl.__pga_aggregate_target=22598909952
orcl.__sga_target=4294967296
orcl.__shared_io_pool_size=0
orcl.__shared_pool_size=855638016
orcl.__streams_pool_size=33554432
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.audit_trail='db'
*.compatible='11.2.0.0.0'
*.control_files='+DATA/orcl/controlfile/current.261.845224563','+DATA/orcl/controlfile/current.260.845224563'
*.db_block_size=8192
*.db_create_file_dest='+DATA'
*.db_domain=''
*.db_name='orcl'
*.db_recovery_file_dest='+DATA'
*.db_recovery_file_dest_size=4322230272
*.diagnostic_dest='/u01/app/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=orclXDB)'
*.open_cursors=300
*.pga_aggregate_target=22595764224
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=4293918720
*.undo_tablespace='UNDOTBS1'

RMAN> startup force pfile='/u01/app/oracle/product/11.2.0/dbhome_1/dbs/initasm.ora' nomount;

Oracle instance started

Total System Global Area    4275781632 bytes

Fixed Size                     2235208 bytes
Variable Size                956302520 bytes
Database Buffers            3305111552 bytes
Redo Buffers                  12132352 bytes

RMAN> restore controlfile from autobackup;

Starting restore at 20-JUN-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=135 device type=DISK

recovery area destination: +DATA
database name (or database unique name) used for search: ORCL
channel ORA_DISK_1: AUTOBACKUP +data/ORCL/AUTOBACKUP/2014_06_20/s_850757433.294.850757669 found in the recovery area
channel ORA_DISK_1: looking for AUTOBACKUP on day: 20140620
channel ORA_DISK_1: restoring control file from AUTOBACKUP +data/ORCL/AUTOBACKUP/2014_06_20/s_850757433.294.850757669
channel ORA_DISK_1: control file restore from AUTOBACKUP complete
output file name=+DATA/orcl/controlfile/current.272.850764747
output file name=+DATA/orcl/controlfile/current.275.850764749
Finished restore at 20-JUN-14

RMAN>




















RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> restore database;

Starting restore at 20-JUN-14
using channel ORA_DISK_1

channel ORA_DISK_1: starting datafile backup set restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_DISK_1: restoring datafile 00001 to +DATA/orcl/datafile/system.270.850764909
channel ORA_DISK_1: restoring datafile 00002 to +DATA/orcl/datafile/sysaux.273.850764909
channel ORA_DISK_1: restoring datafile 00003 to +DATA/orcl/datafile/undotbs1.261.850764909
channel ORA_DISK_1: restoring datafile 00004 to +DATA/orcl/datafile/users.277.850764911
channel ORA_DISK_1: restoring datafile 00005 to +DATA/orcl/datafile/example.281.850764909
channel ORA_DISK_1: reading from backup piece +DATA/orcl/backupset/2014_06_20/nnndf0_tag20140620t173119_0.295.850757481
channel ORA_DISK_1: piece handle=+DATA/orcl/backupset/2014_06_20/nnndf0_tag20140620t173119_0.295.850757481 tag=TAG20140620T173119
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:03:25
Finished restore at 20-JUN-14

RMAN> recover database;

Starting recover at 20-JUN-14
using channel ORA_DISK_1

starting media recovery

RMAN-08187: WARNING: media recovery until SCN 2293142 complete
Finished recover at 20-JUN-14

RMAN> alter database open resetlogs;

database opened

RMAN>























Exit RMAN prompt and check Database recovered properly or not.

Thank you for visiting my blog


1 comment:

Rowelli Jorden said...

This blog provides very nice information on database recovered. Nicely explained wit the help of Steps and screenshot.
BDR