Golden gate v0

 #!/bin/bash


# Source Oracle GoldenGate home

source /path/to/ogg/home


# Check if Oracle GoldenGate home is sourced successfully

if [ $? -eq 0 ]; then

  echo "Oracle GoldenGate home sourced successfully."

else

  echo "Failed to source Oracle GoldenGate home. Please check the path."

  exit 1

fi


# Get information about all processes (including ABENDED)

all_processes=$(ggsci <<EOF

INFO ALL

EOF

)


# Check for ABENDED processes

abended_processes=$(echo "$all_processes" | grep ABENDED)


# Display information about all processes

echo "All Processes:"

echo "$all_processes"


# Check for and report ABENDED processes

if [[ -z "$abended_processes" ]]; then

  echo "No ABENDED processes found."

else

  echo "The following processes are ABENDED:"

  echo "$abended_processes"

fi


# Check if any processes are running (excluding ABENDED)

running_processes=$(echo "$all_processes" | grep -v ABENDED | grep -v 'defunct')


# Stop running processes (excluding ABENDED)

if [[ -n "$running_processes" ]]; then

  echo "Stopping running processes..."

  for process in $(echo "$running_processes" | awk '{print $1}'); do

    ggsci <<EOF

    STOP $process

EOF

  done

  echo "Processes stopped."

fi


# Replace "/path/to/ogg/home" with the actual path to your Oracle GoldenGate home


Comments

Popular posts from this blog

SQL Loader V3

Db Unix

Standby redo log add