Friday, 29 January 2021

𝐎𝐑𝐀𝐂𝐋𝐄 𝟏𝟐𝐂 𝐑𝟏 𝟐𝐍𝐎𝐃𝐄 𝐑𝐀𝐂 𝐃𝐀𝐓𝐀𝐁𝐀𝐒𝐄 𝐑𝐄𝐒𝐓𝐎𝐑𝐀𝐓𝐈𝐎𝐍 𝐏𝐋𝐀𝐍

                                                            [̲̅O][̲̅R][̲̅A][̲̅C][̲̅L][̲̅E] [̲̅R][̲̅A][̲̅C]

  Ø WE have 2 Node RAC – Oracle1 & Oracle2

 

Steps 1) Pre-configuration for WIN-RAC Installation on Both Node.

☑   Create ASM DISK using SAN disks through multipath in    Oracle DB Servers.

      ·         External – DATA, DATA1, DBDATA

 

☑ Install Oracle Grid Services and configure cluster.

 

☑ Install Oracle database software only.

 

 

Step 2) Take RMAN backup from source Server and transfer to target Server. (make sure controlfile autobackup is on)

 

☑ Create required directory structures in ASM for C.R.D. files.

 

☑ Change required parameters in pfile( audit_file_dest,db_name,diagnostic_dest, controlfiles, etc,)

 

 

Step 3) CREATE SID FOR SINGLE INSTANCE ON NODE 1

 

C: oradim -new -sid RACDB

C :> Set ORACLE_SID=RACDB

 

Step 4) RESTORE AND RECOVER DATABASE.

 

C: > rman target /

 

RMAN> set DBID=1896487842

 

RMAN>startup nomount;

 

 

Restore Spfile from full backup

RMAN>restore spfile to 'C:\Oracle\Product\12.1.0\dbhome_1\database\init<<Old sid>>/ora'  from 'f:\fast_recovery_area\<<oldsid>>\BackupSet\2021_01_17\O1_MF_NNSNF_SPFILE_LEVEL_0_DOSTOJT8_.BKP';

 

 

 

 

Create Pfile from spfile

RMAN>create pfile='c:\oracle\product\12.1.0\dbhome_1\Database\pfile<<old sid>>.ora' from spfile='c:\oracle\product\12.1.0\dbhome_1\Database\Init<<old sid>>.ora';

 

 

  Ø  shutdown immediate;

 

 

CREATE PFILE FOR SINGLE INSTANCE

*.audit_file_dest='D:\app\Administrator\admin\RACDB\adump'

*.audit_trail='db'

*.compatible='12.1.0.2.0'

*.control_files='+DBDATA/RACDB/CONTROLFILE/control01.ctl'

*.db_block_size=8192

*.db_create_file_dest='+DBDATA'

*.db_domain=''

*.db_name='RACDB'

*.diagnostic_dest='D:\app\Administrator'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=RACDBXDB)'

*.log_archive_dest_1='LOCATION=+DATA/ARC'

*.memory_target=1600m

*.open_cursors=300

*.processes=300

*.remote_login_passwordfile='exclusive'

*.resource_manager_plan=''

*.undo_tablespace='UNDOTBS1'

 

Go back to your RMAN session and restore the control files. Again, fix paths as needed.

RMAN>startup nomount pfile = 'c:\oracle\product\12.1.0\dbhome_1\Database\pfile<<new_sid>>.ora’;

 

RMAN>restore controlfile to '+dbdata/homedb/controlfile/control01.ctl' from

'D:\rmanbackup\ctl\CF_homedb.C-1547250382-20130527-05';

 

Verify using asmcmd:

ASMCMD> pwd

+dbdata/homedb/controlfile

ASMCMD> ls

control01.ctl

current.305.816437125

 

RMAN>Alter Database Mount;

 

RMAN> catalog start with ‘backup location’;

 

RMAN> run {

ALLOCATE CHANNEL ch01 device TYPE DISK;

ALLOCATE CHANNEL ch02 device TYPE DISK;

ALLOCATE CHANNEL ch03 device TYPE DISK;

set newname for datafile 1 to '+DBDATA';

set newname for datafile 2 to '+DBDATA';

set newname for datafile 3 to '+DBDATA';

set newname for datafile 4 to '+DBDATA';

set newname for datafile 5 to '+DBDATA';

set newname for datafile 6 to '+DBDATA';

set newname for datafile 7 to '+DBDATA';

set newname for datafile 8 to '+DBDATA';

set newname for datafile 9 to '+DBDATA';

set newname for datafile 10 to '+DBDATA';

set newname for datafile 11 to '+DBDATA';

set newname for datafile 12 to '+DBDATA';

set newname for datafile 13 to '+DBDATA';

set newname for datafile 14 to '+DBDATA';

set newname for datafile 15 to '+DBDATA';

restore database;

switch datafile all;

RELEASE CHANNEL ch01;

RELEASE CHANNEL ch02;

RELEASE CHANNEL ch03;

}

 

Step 5) Now Recover the Database

 

 RMAN> recover database;

 

  Ø  Open database with resetlogs option

 

 RMAN> alter database open resetlogs;

database opened

Step 6) ADD RAC PARAMETERS TO PARAMETER FILE

 

racdb.__data_transfer_cache_size=0

racdb1..__data_transfer_cache_size=0

racdb2.__data_transfer_cache_size=0

racdb.__db_cache_size=704643072

racdb2.__db_cache_size=637534208

racdb1..__db_cache_size=620756992

racdb.__java_pool_size=16777216

racdb1..__java_pool_size=16777216

racdb2.__java_pool_size=16777216

racdb.__large_pool_size=33554432

racdb1..__large_pool_size=33554432

racdb2.__large_pool_size=33554432

racdb.__oracle_base='D:\app\Administrator'#ORACLE_BASE set from environment

racdb1..__oracle_base='D:\app\Administrator'#ORACLE_BASE set from environment

racdb2.__oracle_base='D:\app\Administrator'#ORACLE_BASE set from environment

racdb.__pga_aggregate_target=671088640

racdb1..__pga_aggregate_target=671088640

racdb2.__pga_aggregate_target=671088640

racdb.__sga_target=1006632960

racdb1..__sga_target=1006632960

racdb2.__sga_target=1006632960

racdb.__shared_io_pool_size=0

racdb1..__shared_io_pool_size=0

racdb2.__shared_io_pool_size=0

racdb.__shared_pool_size=234881024

racdb2.__shared_pool_size=301989888

racdb1..__shared_pool_size=318767104

racdb.__streams_pool_size=0

racdb1..__streams_pool_size=0

racdb2.__streams_pool_size=0

*.audit_file_dest='D:\app\Administrator\admin\RACDB\adump'

*.audit_trail='db'

*.cluster_database=true

*.cluster_database_instances=2

*.compatible='12.1.0.2.0'

*.control_files='+DBDATA/RACDB/CONTROLFILE/control01.ctl'

*.db_block_size=8192

*.db_create_file_dest='+DBDATA'

*.db_domain=''

*.db_name='RACDB'

*.diagnostic_dest='D:\app\Administrator'

*.dispatchers='(PROTOCOL=TCP) (SERVICE=RACDBXDB)'

RACDB1..instance_number=1

RACDB2.instance_number=2

*.log_archive_dest_1='LOCATION=+DATA1/ARC'

*.memory_target=1600m

*.open_cursors=300

*.processes=300

*.remote_login_passwordfile='exclusive'

*.resource_manager_plan=''

RACDB2.thread=2

RACDB1..thread=1

*.undo_tablespace='UNDOTBS1'

RACDB2.undo_tablespace='UNDOTBS2'

RACDB1..undo_tablespace='UNDOTBS1'

 

Step 7) CREATE SPFILE ON ASM FROM PFILE

 

SQL> create spfile=’+DBDATA’ from pfile=’D:\rmanbackup\initRACDB.ora’;

File created.

 

VERIFY THAT FILE IS CREATED ON ASM

ASMCMD [+dbdata] > cd +dbdata/RCTEST/parameterfile

ASMCMD [+dbdata/RCTEST/parameterfile] > ls

spfile.267.817161073

 

Step 8) CREATE PFILE ON BOTH NODES

 

create parameter files in ORACLE_HOME/database folder for both instances on both servers

(initRACDB1..ora on Node1 and initRACDB2.ora on node 2)

 

Add only one line in both files.

SPFILE=+DBDATA/RACDB/parameterfile/spfile.267.817161073

 

Step 9) SHUTDOWN DATABASE

 

SQL> shutdown immediate;

Step 10) ADD DATABASE TO CLUSTER

 

Go to Grid home

cd D:/app/11.2.0.3/grid/BIN

 

Add database to cluster

D:/app/11.2.0.3/grid/BIN> srvctl add database -d RACDB -oraclehome D:\app\Administrator\product\12.1.0\dbhome_1

 

CHECK DATABASE IS ADDED TO CLUSTER OR NOT

 

D:/app/11.2.0.3/grid/BIN> srvctl config database -d RACDB

 

Step 11) ADD RAC INSTANCES

 

D:/app/11.2.0.3/grid/BIN> srvctl add instance -d RACDB -i RACDB1. -n Oracle1

D:/app/11.2.0.3/grid/BINsrvctl add instance -d RACDB -i RACDB2 -n Oracle2

 

VERIFY THAT INTANCES ARE ADDED TO CLUSTER

D:/app/11.2.0.3/grid/BINsrvctl config database -d RACDB

 

Step 12) START DATABASE and VERIFY THAT DATABASE AND INSTANCES

                 ARE UP

D:/app/11.2.0.3/grid/BINsrvctl start database -d RACDB

D:/app/11.2.0.3/grid/BIN> srvctl config database -d RACDB

 

Database unique name: RACDB

Database name:

Oracle home: D:\app\oracle\product\12.1.0.2\dbhome_1

Oracle user: nt authority\system

Spfile:

Domain:

Start options: open

Stop options: immediate

Database role: PRIMARY

Management policy: AUTOMATIC

Server pools: RACDB

Database instances: RACDB1.,RACDB2

Disk Groups: DBDATA

Mount point paths:

Services:

Type: RAC

Database is administrator managed


5 comments:

  1. Hi Sarfaraz I go through your blog post it's good,find I we have same location for all database then we can restore below mentioned command.its save the dba work.


    run
    {
    set newname for database to '+DBDATA';
    restore database;
    switch datafile all;
    }

    ReplyDelete
    Replies
    1. Thanks for the read.Really appreciate. Actually I have just given an example. If you will see in pfile parameter above i have declared *.db_create_file_dest='+DBDATA which will restore all the datafiles in the given location.

      Delete
  2. Very well explained Sarfaraz.

    ReplyDelete
  3. Great Post...I have followed your post and implemented in UAT RAC Env 3-Node. It's worked. Cheers !!

    ReplyDelete