Thursday, October 24, 2013

11g DR build manually using rman backup

1.copy/scp Oracle home from primary and relink

2.Modify Init and tns files as below on standby

[oratpr@drhost  dbs]$


db_unique_name             = SID
*.FAL_CLIENT='SID'
*.fal_server='SID_STBY'
*.log_archive_config='dg_config=(SID,SID_STBY)'
*.LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST MANDATORY'
*.LOG_ARCHIVE_DEST_2='service=SID_STBY valid_for=(online_logfiles,primary_role) db_unique_name=SID LGWR ASYNC=20480 OPTIONAL REOPEN=15 NET_TIMEOUT=30'
*.log_archive_dest_state_2='DEFER'
*.log_archive_dest_state_3='DEFER'
*.LOG_ARCHIVE_FORMAT='%t_%s_%r.dbf'
*.db_recovery_file_dest='/archivelogs/SID'
*.db_recovery_file_dest_size=100G




[oratpr@drhost SID_drhost]$ cat SID_drhost_ifile.ora
SID_STBY=
    (DESCRIPTION=
        (ADDRESS=(PROTOCOL=tcp)(HOST=primaryhost)(PORT=1571))
      (CONNECT_DATA=
        (SID=SID)
      )
    )


3.Modify init/tns  file on primary to include following


init
-----

*.DB_UNIQUE_NAME='SID'
*.FAL_CLIENT='SID'
*.fal_server='SID_STBY'
*.log_archive_config='dg_config=(SID,SID_STBY)'
*.LOG_ARCHIVE_DEST_1='LOCATION=USE_DB_RECOVERY_FILE_DEST MANDATORY'
*.LOG_ARCHIVE_DEST_2='service=SID_STBY LGWR ASYNC=20480 valid_for=(online_logfiles,primary_role) db_unique_name=SID_STBY OPTIONAL REOPEN=15 NET_TIMEOUT=30'
*.log_archive_dest_state_2='DEFER'
*.log_archive_dest_state_3='DEFER'
*.LOG_ARCHIVE_FORMAT='%t_%s_%r.dbf'
*.standby_archive_dest='LOCATION=USE_DB_RECOVERY_FILE_DEST'
*.standby_file_management='AUTO'
*.remote_login_passwordfile='EXCLUSIVE'


tns
---
[oratpr@primaryhost SID_primaryhost]$ cat SID_primaryhost_ifile.ora

SID_STBY = (DESCRIPTION=
                (ADDRESS=(PROTOCOL=tcp)(HOST=drhost.cm.charter.com)(PORT=1571))
                (CONNECT_DATA=(SID=SID_stdby))
            )






4. Mount /copy backup on DR and start restore as below

a. startup database with nomount

b.Validate that you able to connect sys/***@sid_primary as sysdba
If not scp password file from primary to standby

c. Connect to rman and run restore


rman target sys/****@sid_stdby auxiliary sys/****@sid_prim
sql 'alter session set optimizer_mode=rule';
DUPLICATE TARGET DATABASE FOR STANDBY DORECOVER NOFILENAMECHECK;



d.  After restore is done it will complain for archives
If required , restore missing archives from backup .
on standby
rman target /
restore archivelog from sequence <.....missing sequenece fro which restore failed >;



5. Enable archive shipping  on primary , restart db if required

*.log_archive_dest_state_2='enable'

6.Initiate redo apply on standby

alter database recover managed standby database disconnect;


7. Check alert log and validate that db/primary are in sync






For opening DR

==================



SQL> RECOVER MANAGED STANDBY DATABASE CANCEL;
Media recovery complete.
SQL> ALTER DATABASE ACTIVATE STANDBY DATABASE;

Database altered.

SQL> shut immediate
ORA-01109: database not open


Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.

Total System Global Area 1073741824 bytes
Fixed Size                  2089336 bytes
Variable Size             427822728 bytes
Database Buffers          629145600 bytes
Redo Buffers               14684160 bytes
Database mounted.
Database opened.

No comments:

Post a Comment