Sunday, June 12, 2016

Recovering Standby database for log synchronization with Primary DB

SQL>  startup nomount pfile='/p01/prod/db/tech_st/11.2.0.4/dbs/initPRODRPT.ora';
ORACLE instance started.

Total System Global Area 5.1310E+10 bytes
Fixed Size                  2265224 bytes
Variable Size            5502930808 bytes
Database Buffers         4.5768E+10 bytes
Redo Buffers               36069376 bytes
SQL> Alter database mount standby database;

Database altered.

SQL>
SQL> alter database open read only;

Database altered.

SQL> alter database recover managed standby database using current logfile disconnect from session;

Database altered.

SQL>  select process "MRP PROCESS Status" ,status,sequence#
  from v$managed_standby where PROCESS like '%MRP%';
  2
MRP PROCE STATUS        SEQUENCE#
--------- ------------ ----------
MRP0      APPLYING_LOG      67465

SQL> select  almax "Last Seq Received from PROD", lhmax "Last Seq Applied on PRODRPT"
  2  from (select thread# thrd, max(sequence#) almax
  3        from v$archived_log
  4        where resetlogs_change#=(select resetlogs_change# from v$database)
  5        group by thread#) al,
  6       (select thread# thrd, max(sequence#) lhmax
  7        from v$log_history
  8        where first_time=(select max(first_time) from v$log_history)
  9        group by thread#) lh
 10  where al.thrd = lh.thrd;

Last Seq Received from PROD Last Seq Applied on PRODRPT
--------------------------- ---------------------------
                      67464                       67464

SQL> SELECT database_role, open_mode FROM v$database;

DATABASE_ROLE    OPEN_MODE
---------------- --------------------
PHYSICAL STANDBY READ ONLY WITH APPLY


Note: You could stop the listener on the standby database server before putting into recovery mode and start it once you start the recovery/log apply process.

No comments: