Here’s a simple script to look at the v$recovery_process view:

The following dg_check_lag.ksh script can be leveraged to monitor a Data Guard environment and to send alerts if the apply lag or transport lag exceeds a specified threshold in the dg_check_lag.conf file. In our example, the dg_check_lag.conf file specifies a threshold of three hours. If we encounter a lag in redo transport or apply lag that exceeds 3 hours, we send an alert to our DG DBAs.

Contents of the dg_check_lag.ksh script:


Contents of dg_check_lag.conf:

Contents of .ORACLE_BASE

This file must exist in the $HOME directory for Oracle. We source the .ORACLE_BASE file because some companies have crazy standards to where they place ORACLE_BASE and where they place all their shell scripts. We keep it simple by leveraging our own configuration file which points to where ORACLE_BASE is located and where all the shell scripts reside in.