Skip to content
pvmehta.com

pvmehta.com

  • Home
  • About Me
  • Toggle search form
  • How do I get Oracle to automatically start when my server boots up? Oracle
  • Small sample shell program Linux/Unix
  • Find average Row Length and other table size calculation. metalink notes Oracle
  • How to know current SID Oracle
  • Parallel DML Oracle
  • exp syntax in oracle 10g Oracle
  • Oracle Identifiers Oracle
  • DBMS_PROFILER for tuning PLSQL programs. Oracle
  • Jai Shree Ram Oracle
  • Good RAC & Standby Notes Oracle
  • Oracle Internal Good Websites 1 Oracle
  • Standby Database Behavior when a Datafile is Resized on the Primary Database Note:123883.1 Oracle
  • How to connect to Oracle Database with Wallet with Python. Oracle
  • default permission on ~/.ssh/authorized_keys2 or authorized_keys Linux/Unix
  • DBMS_UTILITY.ANALYZE_SCHEMA Oracle

Check_recovery.sh program to run sqlplus and return its values remotely.

Posted on 21-Jul-2008 By Admin No Comments on Check_recovery.sh program to run sqlplus and return its values remotely.

#/bin/ksh -x

NOTIFY_LIST=”pmehta@1800flowers.com”

SOURCE_ARCH_DEST=/db5/archlog/800P

TARGET_SID=UOC

SOURCE_SSH=/usr/local/bin/ssh

TARGET_SSH=/usr/local/bin/ssh

SOURCE_HOST=nyuocdbprod01s

TARGET_HOST=uocdbprod21

TARGET_ORACLE_HOME=/oracle/app/oracle/product/10.1

TARGET_ENVFILE=/oracle/app/oracle/oraprocs/oracle_env_UOC

SOURCE_ORACLE_HOME=/oracle/app/oracle/product/10.1

SOURCE_ENVFILE=/export/home/oracle/oraprocs/oracle_env_10g_UOC

MY_SQL=”select max(SEQUENCE#) from v$log_history;”

MY_SQL1=”select count(1) from v$log_history where first_time >= (sysdate – (45/1440));”

TARGET_SEQ=`$TARGET_SSH $TARGET_HOST “. $TARGET_ENVFILE; $TARGET_ORACLE_HOME/bin/sqlplus -S / as sysdba <set pagesize 0 feedback off verify off heading off echo off

$MY_SQL

END”`

echo “TARGET_SEQ = $TARGET_SEQ”

SOURCE_SEQ=`$SOURCE_SSH $SOURCE_HOST “. $SOURCE_ENVFILE; $SOURCE_ORACLE_HOME/bin/sqlplus -S / as sysdba <set pagesize 0 feedback off verify off heading off echo off

$MY_SQL

END”`

echo “SOURCE_SEQ = $SOURCE_SEQ”

NO_LOGS_45MIN=`$SOURCE_SSH $SOURCE_HOST “. $SOURCE_ENVFILE; $SOURCE_ORACLE_HOME/bin/sqlplus -S / as sysdba <set pagesize 0 feedback off verify off heading off echo off

$MY_SQL1

END”`

echo “NO_LOGS_45MIN = $NO_LOGS_45MIN”

DIFFER=`expr $SOURCE_SEQ – $TARGET_SEQ`

echo “DIFFER=$DIFFER”

if [ $DIFFER -gt 0 ] && [ $NO_LOGS_45MIN -gt 0 ]

then

echo “Recovery of $TARGET_SID STBY on $TARGET_HOST is lagging by $DIFFER logs, But Log generation in last 45 minutes is $NO_

LOGS_45MIN : No Page sent” | mailx -s “$TARGET_SID – Standby Recovery Alert” $NOTIFY_LIST

exit

fi

if [ $DIFFER -gt 18 ]

then

echo “Database $TARGET_SID on $TARGET_HOST IS LAGGING BY $DIFFER LOGS `date`” |mailx $NOTIFY_LIST

fi

Linux/Unix, shell

Post navigation

Previous Post: Running select from V$ views from remote server
Next Post: Find long Running Transaction

Related Posts

  • move_arch_files.ksh /* Good One */ Linux/Unix
  • cold backup scripts to copy locally Linux/Unix
  • get_vmstat.ksh Linux/Unix
  • rm_backup_arch_file.ksh Linux/Unix
  • Small sample shell program Linux/Unix
  • CPU Core related projections AWS

Leave a Reply Cancel reply

Your email address will not be published. Required fields are marked *

Categories

  • Ansible (0)
  • AWS (2)
  • Azure (1)
  • Linux/Unix (149)
  • MYSQL (5)
  • Oracle (392)
  • PHP/MYSQL/Wordpress (10)
  • POSTGRESQL (0)
  • Power-BI (0)
  • Python/PySpark (7)
  • RAC (17)
  • rman-dataguard (26)
  • shell (149)
  • SQL scripts (341)
  • SQL Server (6)
  • Uncategorized (0)
  • Videos (0)

Recent Posts

  • SQL Server Vs Oracle Architecture difference25-Jul-2025
  • SQL Server: How to see historical transactions25-Jul-2025
  • SQL Server: How to see current transactions or requests25-Jul-2025
  • T-SQL Vs PL/SQL Syntax25-Jul-2025
  • Check SQL Server edition25-Jul-2025
  • Checking SQL Server Version25-Jul-2025
  • Oracle vs MYSQL Architecture differences (For DBAs)24-Jul-2025
  • V$INSTANCE of Oracle in MYSQL24-Jul-2025
  • Day to day MYSQL DBA operations (Compared with Oracle DBA)24-Jul-2025
  • MYSQL and Oracle Comparison for Oracle DBA24-Jul-2025

Archives

  • 2025
  • 2024
  • 2023
  • 2010
  • 2009
  • 2008
  • 2007
  • 2006
  • 2005
  • Find Plan Hash value fphv.sql Oracle
  • Export Oracle data and Compress at same time Oracle
  • How to find who is using which Rollback segment and how many rows or blocks in that rollback segments, Oracle
  • sid_wise_sql.sql Oracle
  • Wait.sql Oracle
  • Good notes for shared pool Oracle
  • fdisk -l explaination about Primary-Logical-Extended Partitions Linux/Unix
  • sess_server.sql Oracle

Copyright © 2025 pvmehta.com.

Powered by PressBook News WordPress theme