Friday, 24 January 2014

Datagaurd Syncronization Monitoring

Check Archive Log Sequence:
-------------------------------------

select THREAD#,SEQUENCE#,APPLIED,DELETED,STATUS from v$archived_log where THREAD# = 2 and SEQUENCE# like '1074%';

select thread#,sequence#,applied,deleted,status from v$archived_log where thread# = 1 and deleted ='NO';
 

At Primary side:
--------------------

1.SELECT THREAD#,TO_CHAR(MAX(FIRST_TIME), 'DD/MM/YYYY HH24:MI:SS')
  FROM v$archived_log WHERE applied ='YES' AND standby_dest= 'YES'
  GROUP BY THREAD#

2.select count(*) from v$archived_log where applied='NO';

3.select count(*) from v$archived_log where applied='YES';

4.SELECT THREAD# "Thread",SEQUENCE# "Last Sequence Generated"
  FROM V$ARCHIVED_LOG WHERE (THREAD#,FIRST_TIME ) IN
  (SELECT THREAD#,MAX(FIRST_TIME) FROM V$ARCHIVED_LOG GROUP BY THREAD#)
  ORDER BY 1; 

 5.select max(SEQUENCE#) from v$archived_log where ARCHIVED='YES' and applied='YES';
   execute this on both servers and compare the seq..both should same

6.select THREAD#,SEQUENCE#,APPLIED,DELETED,STATUS from v$archived_log where THREAD#=1 and sequence#='707%';

7.select GROUP#,SEQUENCE#,THREAD#,STATUS,FIRST_CHANGE#,TO_CHAR(FIRST_TIME,'DD/MM/YY HH24:MI:SS') from v$log order by sequence#;

8. get the max sequence number which was applied in the standby
   select thread#,max(sequence#) from v$archived_log where applied ='YES' and REGISTRAR='RFS' group by thread#

At Standby side:
--------------------

1.SELECT PID,PROCESS, STATUS, THREAD#, SEQUENCE#, BLOCK#, BLOCKS FROM V$MANAGED_STANDBY;

2.select count(*) from v$archived_log where applied='NO';
   select THREAD#,SEQUENCE#,NAME,ARCHIVED,APPLIED,DELETED,STATUS from v$archived_log where APPLIED='NO'

3.select count(*) from v$archived_log where applied='YES';

4. 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;

5.SELECT THREAD#, LOW_SEQUENCE#, HIGH_SEQUENCE# FROM V$ARCHIVE_GAP;

6.select SEQUENCE#,ARCHIVED,APPLIED from v$archived_log where
  SEQUENCE#= (select max(SEQUENCE#) from v$archived_log );

Shutdown:

> ALTER DATABASE RECOVER MANAGED STANDBY DATABASE CANCEL;
> SHUTDOWN IMMEDIATE;

Startup:

>startup nomount;
>alter database mount standby database;
>ALTER DATABASE RECOVER MANAGED STANDBY DATABASE DISCONNECT FROM SESSION;
>alter database recover managed standby database using current logfile disconnect;<Real Time Apply>
>alter database set standby database to maximize performance;


Regards,
Vijay.

No comments:

Post a Comment