Skip to main content

Primary & Standby Database SYNC Check in Oracle Database

 In Oracle Data Guard, you can check whether the standby database is in sync with the primary database by monitoring the apply lag. The apply lag represents the time delay between when a redo log is generated on the primary database and when it is applied on the standby database. A zero or low apply lag indicates that the standby is relatively up-to-date with the primary, while a high apply lag suggests a potential synchronization delay.

Here are some methods to check whether the standby database is in sync with the primary:

1. Data Guard Broker

If you are using the Data Guard Broker, you can use the DGMGRL command-line interface or Enterprise Manager (Grid Control) to check the status of the Data Guard configuration and monitor the apply lag.
For example, using DGMGRL:

DGMGRL> SHOW DATABASE 'standby_database_name' APPLY_LAG;

2. V$DATAGUARD_STATS View

On the primary database, you can query the V$DATAGUARD_STATS view to check the apply lag and other Data Guard-related statistics. The APPLY_LAG column will show the apply lag in seconds.

SQL> SELECT NAME, VALUE FROM V$DATAGUARD_STATS WHERE NAME = 'apply lag';

##OR##

SQL> Select max(sequence#) from v$log_history;

##Run above query on both primary & standby to check the sync##

3. V$ARCHIVED_LOG View

You can also use the V$ARCHIVED_LOG view on the standby database to check the archived redo logs and their timestamps. By comparing the oldest log timestamp with the current timestamp, you can estimate the apply lag.

SQL> SELECT MIN(FIRST_TIME) AS OLDEST_LOG_TIMESTAMP, CURRENT_TIMESTAMP AS CURRENT_TIMESTAMP FROM V$ARCHIVED_LOG;

4. Log Files on Standby

You can also check the standby database's alert log and Data Guard-specific log files for any messages related to apply lag or synchronization issues.

It's important to monitor the Oracle Data Guard configuration regularly to ensure that the standby database is adequately in sync with the primary. A small apply lag is generally acceptable, but a significant lag may indicate performance issues or network problems. If there are considerable delays, investigate and resolve the underlying causes to maintain a robust Data Guard environment for disaster recovery and data protection.

Comments

Popular posts from this blog

Upgrade Oracle Database 12c to 19c by DBUA Method

  Introduction Upgrade Oracle Database is a crucial step to ensure you're benefiting from the latest features, performance enhancements, and security updates. In this guide, we'll walk you through the process of upgrading your Oracle Database 12c to the latest version, 19c . Follow these steps to ensure a smooth and successful upgrade Environment Hostname : prod.infoinflux.com Database Name : PROD DB VERSION : 12.2.0.1.0 ORACLE_BASE : /u01/app/oracle DB Home Path : /u01/app/oracle/product/12.2.0.1/db_1 Datafile Location : /u01/app/oracle/oradata/PROD Target DB VERSION : 19.0.0.0 Target DB Path : /u01/app/oracle/product/19c/db_1 Upgrade Method : Database Upgrade Assistant Steps For upgrade using Database Upgrade Assistant (DBUA): Take Latest Database backup Make Directory for 19c Home Download and Unzip Software to 19c Home Directory Install 19c Binary or Software Create Pre and Post Upgrade Scripts Run Pre-Upgrade Script Pre-Upgra...

ORA-12012: error on auto execute of job SYS.ORA$AT_OS_OPT_SY_**

  Introduction ORA-12012 error is related to Oracle Database and is part of the Oracle Job Scheduler (DBMS_SCHEDULER) . It usually occurs when an automatic task or job execution encounters an issue. The error message you're seeing, " ORA$AT_OS_OPT_SY_<number> ," is specific to the job causing the problem. During the 12c database creation process, you can see ORA-12012 error in the alert log file when the “ SYS.ORA$AT_OS_OPT_SY_ ” auto job runs. To fix the error, it is necessary to drop the job and recreate it. Errors will be as follows. Errors in file /u01/app/oracle/diag/rdbms/prod/PROD/trace/PROD_j000_14524.trc: ORA-12012: error on auto execute of job "SYS"."ORA$AT_OS_OPT_SY_767" ORA-20001: Statistics Advisor: Invalid task name for the current user ORA-06512: at "SYS.DBMS_STATS", line 47207 ORA-06512: at "SYS.DBMS_STATS_ADVISOR", line 882 ORA-06512: at "SYS.DBMS_STATS_INTERNAL", line 20059 ORA-065...

Install Oracle Database 12.2(12c) on Linux

  Introduction Installing Oracle Database 12.2 on Linux system might seem daunting at first, but with the right guidance, it can be a smooth process. In this guide, we'll take you through the step-by-step procedure to install Oracle Database on a Linux environment. By the end of this tutorial, you'll have a functional Oracle Database instance up and running. Steps for Installation: 1. Prerequisites Automatic Setup 2. Prerequisites Manual Setup 3. Install Oracle Database Binary (Software only) 4. Create Database by DBCA 1. Prerequisites Automatic Setup To perform all your prerequisite setup automatically, issue the following command or you can proceed with manual setup explained in 2nd point. [ root @ prod ] # yum install oracle - database - server - 12cR2 - preinstall - y 2. Prerequisites Manual Setup a) Download and Unzip the oracle 12.2 Setup Download or copy the oracle setup file to any location as per your requirement. In...