DOYENSYS Knowledge Portal




We Welcome you to visit our DOYENSYS KNOWLEDGE PORTAL : Doyensys Knowledge Portal




Saturday, September 5, 2015

Step for manual standby database recovery and make standby database to sync with production database


Production Side
============

#Cancel the log shipping from production to standby

$ sqlplus / as sysdba

SQL > alter system set log_archive_dest_state_3='DEFER' scope=both sid='*';


Standby Side
==========

#Cancel the recover manager in standby database

$ sqlplus / as sysdba

SQL > alter database recover managed standby database cancel;

SQL >  select DB_UNIQUE_NAME, OPEN_MODE, DATABASE_ROLE  from v$database;

      DB_UNIQUE_NAME    OPEN_MODE  DATABASE_ROLE   
      ------------------------------     ------------------   --------------------------
       orcldrr                          MOUNTED    PHYSICAL STANDBY 

SQL > select to_char (current_scn) from v$database;
           
            CURRENT_SCN
           -----------------------
            44964958698659

Production Side
============

#Take incremental backup with standby current scn in production database

$ rman target /

RMAN > run {
allocate channel oem_backup_disk1 type disk format '/backup/orcl/rmanfiles/orcldrr6_%d_%U';
BACKUP INCREMENTAL FROM SCN 44964958698659 cumulative filesperset = 2 keep until time 'SYSDATE+1' as COMPRESSED BACKUPSET tag 'ORCLSTANDBYTAG' section size 50M  database ;
backup format '/backup/orcl/rmanfiles/STBYCTL_ORCL6'  tag = 'ORCLSTANDBYTAG' current controlfile for standby;
release channel oem_backup_disk1;
};

#Copy the backup files and control files from production server to standby server.

$ cd '/backup/orcl/rmanfiles

$ scp orcldrr6* oracle@standbysev:/oracle/app/oracle/backup/orcl

$ scp STBYCTL_ORCL6* oracle@standbysev:/oracle/app/oracle/backup/orcl/ctrl

Standby Side
==========

#Manual Standby recovery steps

$ cd /oracle/app/oracle/backup/orcl

$ rman target /

rman > catalog start with '/oracle/app/oracle/backup/orcl';

rman > recover database noredo;

rman > exit;

$ sqlplus / as sysdba

sql > shut immediate

sql > startup nomount

sql > exit;

$ rman target /

rman >  restore standby controlfile from '/oracle/app/oracle/backup/orcl/ctrl/STBYCTL_ORCL6';

rman >  alter database mount;

rman > exit;

Production Side
============

#Enable  the log shipping from production to standby

$ sqlplus / as sysdba

SQL > alter system set log_archive_dest_state_3='Enable' scope=both sid='*';

Standby Side
==========

#Enable the recover manager in standby database

$ sqlplus / as sysdba

SQL >ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;

# Standby sync check query

SQL > SELECT ARCH.THREAD# "Thread", ARCH.SEQUENCE# "Last Sequence Received", APPL.SEQUENCE# "Last Sequence Applied", (ARCH.SEQUENCE# - APPL.SEQUENCE#) "Difference" FROM (SELECT THREAD# ,SEQUENCE# FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)) ARCH, (SELECT THREAD# ,SEQUENCE# FROM V$LOG_HISTORY WHERE (THREAD#,FIRST_TIME ) IN (SELECT THREAD#,MAX(FIRST_TIME) FROM V$LOG_HISTORY GROUP BY THREAD#)) APPL
WHERE ARCH.THREAD# = APPL.THREAD# ORDER BY 1;



No comments: