Sunday, January 4, 2015

Oracle - Restore RAC DB Ex1


Restoring  RAC database  “testa”  with Two Instances “testa1”, “testa2

Loss of  everything , No catalog used but knew the RMAN backup location and files

 Step : Startup SID in the Force NOMOUNT  (Use SQLPlus or RMAN)

export ORACLE_SID=testa1
twebs01-testa1 /apps/oracle/product/11.2.0/db/dbs> rman target /

Recovery Manager: Release 11.2.0.2.0 - Production on Fri Sep 12 09:37:27 2014
Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.
connected to target database (not started)

RMAN> startup force nomount

startup failed: ORA-01078: failure in processing system parameters
LRM-00109: could not open parameter file '/apps/oracle/product/11.2.0/db/dbs/inittesta1.ora'
starting Oracle instance without parameter file for retrieval of spfile
Oracle instance started

Total System Global Area     158662656 bytes
Fixed Size                     2224584 bytes
Variable Size                104861240 bytes
Database Buffers              46137344 bytes
Redo Buffers                   5439488 bytes

Step : Now restore SPFILE from Backup ( Here I am not using Recovery catalog, I know the Location)

n  If you have  DBID then

SET DBID 676549873;
STARTUP FORCE NOMOUNT;
Restore the server parameter file. If restoring to the default location, then simply run:
RESTORE SPFILE; # if you are using a catalog
RESTORE SPFILE FROM AUTOBACKUP; # if in NOCATALOG mode

If restoring to a nondefault location, then you could run commands as in the following example:

RESTORE SPFILE TO '/tmp/spfileTEMP.ora'; # if you are using a catalog
RESTORE SPFILE TO '/tmp/spfileTEMP.ora' FROM AUTOBACKUP; # if in NOCATALOG mode
You can restore the server parameter file as a client-side initialization parameter file with the TO PFILE 'filename' clause as in the following example:

RESTORE SPFILE TO PFILE '/tmp/initTEMP.ora';

n  Else  Try this

RMAN> restore spfile to '/apps/oracle/product/11.2.0/db/dbs/inittesta1.ora' from '+DG_BACKUP/TESTA/BACKUPSET/2014_09_09/ncsnn0_TAG_FULLBKP_0.2736.857812337';

Starting restore at 12-SEP-14
using channel ORA_DISK_1

channel ORA_DISK_1: restoring spfile from AUTOBACKUP +DG_BACKUP/TESTA/BACKUPSET/2014_09_09/ncsnn0_TAG_FULLBKP_0.2736.857812337
channel ORA_DISK_1: SPFILE restore from AUTOBACKUP complete
Finished restore at 12-SEP-14

RMAN > exit

Step : Now Create a text file “PFILE” from restored SPFILE  and Start in MOUNT using PFILE

SQL> create pfile='test.txt' from spfile='inittesta1.ora';
File created.
SQL> startup nomount pfile='test.txt';
ORACLE instance started.

Total System Global Area 2388422656 bytes
Fixed Size                  2228800 bytes
Variable Size            1409289664 bytes
Database Buffers          956301312 bytes
Redo Buffers               20602880 bytes

SQL> exit

Step3 : Now Restore Control File ( This will restore ctrl file  in the location specified in PFILE)


Try1

RMAN target /

RMAN> restore controlfile;

Starting restore at 12-SEP-14
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=18 instance=testa1 device type=DISK

RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 09/12/2014 09:53:03
RMAN-06563: control file or SPFILE must be restored using FROM AUTOBACKUP

Try2

RMAN> restore controlfile from '+DG_BACKUP/TESTA/BACKUPSET/2014_09_09/ncsnn0_TAG_FULLBKP_0.2736.857812337';

Starting restore at 12-SEP-14
using channel ORA_DISK_1

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:02
output file name=+DG_TIER1/testa/controlfile/current.319.857810469
output file name=+DG_BACKUP/testa/controlfile/current.2810.857810469
Finished restore at 12-SEP-14

Step :  Now MOUNT the Database ( Now we  have ctrlfile + pfile )

RMAN> startup mount;

database is already started
database mounted
released channel: ORA_DISK_1

Step :  Restore the Database ( Ctrl-file knows backup location ow you will have to catalog  them)

RMAN> restore database;

Starting restore at 12-SEP-14
Starting implicit crosscheck backup at 12-SEP-14
allocated channel: ORA_DISK_1
Crosschecked 2 objects
Finished implicit crosscheck backup at 12-SEP-14

Starting implicit crosscheck copy at 12-SEP-14
using channel ORA_DISK_1
Finished implicit crosscheck copy at 12-SEP-14

searching for all files in the recovery area
cataloging files...
cataloging done

List of Cataloged Files
=======================

File Name: +dg_backup/TESTA/BACKUPSET/2014_09_09/ncsnn0_TAG_FULLBKP_0.2736.857812337
...
...
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:15
Finished restore at 12-SEP-14

Step :  Recover the database  You may give additional option UNTIL SCN or Time etc

RMAN> recover database;

Starting recover at 12-SEP-14
using channel ORA_DISK_1
starting media recovery

archived log for thread 1 with sequence 4 is already on disk as file +DG_BACKUP/testa/archivelog/2014_09_09/thread_1_seq_4.2738.857812339

archived log for thread 1 with sequence 5 is already on disk as file +DG_BACKUP/testa/archivelog/2014_09_09/thread_1_seq_5.2748.857815117

Step :  Open Now

RMAN> ALTER DATABASE OPEN RESETLOGS;
or
SQL> alter database open resetlogs;

Database altered.

SQL> show parameter spfile

NAME                                 TYPE        VALUE
----------------------------------- ----------- ------------------------------
spfile                               string

Step :  Now Database is Open , Time to create SPFILE

SQL> create spfile='+DG_TIER1' from pfile='/apps/oracle/product/11.2.0/db/dbs/test.txt';

File created.

Step :  Time to finish

Change pfile and add this SPFILE location
Restart the instance using spfile
Also copy this pfile to other node, rename pfile as 2dn node and start 2nd instance


You Are Done





 
======= Error because RMAN was called from grid Home not DB home =========

twebs01-testa1 /home/oracle> rman
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Sep 12 09:34:28 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================

RMAN-00554: initialization of internal recovery manager package failed

RMAN-03000: recovery manager compiler component initialization failed

RMAN-06035: wrong version of recover.bsq, expecting 11.2.0.3, found 11.2.0.2

twebs01-testa1 /home/oracle>