top of page

Golden Gate Memory Usage

Each and every Golden Gate process takes approx 25 – 50 MB of memory or sometimes more depending upon the transactions. Here is one script which will help you find the total memory usage on the source and target server. This script is written for Linux.


Script to Find Golden Gate Memory Usage

#!/bin/bash
###############################
# determine the OS type
###############################
OSNAME=`uname`
case "$OSNAME" in
  "SunOS")
    echo "OSNAME = $OSNAME"
    ;;
  "Linux")
    echo "OSNAME = $OSNAME"
    ;;
  "*")
    echo "This script has not been verified on $OSNAME"
    exit 1
    ;;
esac
###############################
# set the temp file
###############################
TMPFILE=/tmp/pmem.tmp
if [ -f $TMPFILE ]
then
  rm -f $TMPFILE
fi
################################
# loop over the gg process types
################################
PROCESSES="extract replicat"
for PROCESS in $PROCESSES
do
  FLAG=""
  FLAG=`ps -ef | grep $PROCESS`
  if [ -z "FLAG" ]
  then
    echo "No $PROCESS processes found"
  else
    echo
    echo "#####################################"
    echo "# Individual $PROCESS Process Usage #"
    echo "#####################################"
    case "$OSNAME" in
      "Linux")
        ps -C $PROCESS -O rss > $TMPFILE
        cat $TMPFILE | grep $PROCESS | awk '{print $2/1024, "MB", $12}' | sort -k 2
        ;;
      "SunOS")
        ps -efo vsz,uid,pid,ppid,pcpu,args | grep -v grep | grep $PROCESS > $TMPFILE
        cat $TMPFILE | grep $PROCESS | awk '{print $1/1024, "MB", $8}' | sort -k 2
        ;;
      "*")
        echo "This script has not been verified on $OSNAME"
        exit 1
        ;;
    esac
    rm -f $TMPFILE
    echo
    echo "#####################################"
    echo "#   Total $PROCESS Process Usage    #"
    echo "#####################################"
    case "$OSNAME" in
      "Linux")
        ps -C $PROCESS -O rss > $TMPFILE
        cat $TMPFILE | grep $PROCESS | awk '{count ++; sum=sum+$2; } END \
          { print "Number of processes      =",count; \
          print "AVG Memory usage/process =",sum/1024/count, "MB"; \
          print "Total memory usage       =", sum/1024,  " MB"}'
        ;;
      "SunOS")
        ps -efo vsz,uid,pid,ppid,pcpu,comm | grep -v grep | grep $PROCESS > $TMPFILE
        cat $TMPFILE | awk '{count ++; sum=sum+$1; } END \
          { print "Number of processes      =",count; \
          print "AVG Memory usage/process =",sum/1024/count, "MB"; \
          print "Total memory usage       =", sum/1024,  " MB"}'
        ;;
      "*")
        echo "This script has not been verified on $OSNAME"
        exit 1
        ;;
    esac
    rm -f $TMPFILE
  fi
done
exit


Source server output

[oracle@ggprod gg]$ ./gg_memory_usage.sh
OSNAME = Linux
#####################################
# Individual extract Process Usage #
#####################################
34.5703 MB DP1
49.1172 MB EXT1
#####################################
#   Total extract Process Usage    #
#####################################
Number of processes      = 2
AVG Memory usage/process = 41.8438 MB
Total memory usage       = 83.6875  MB
#####################################
# Individual replicat Process Usage #
#####################################
#####################################
#   Total replicat Process Usage    #
#####################################
Number of processes      =
awk: cmd. line:2: fatal: division by zero attempted

Ignore the error at the end as there are not replicate details available on source server.



Target server output


The same script can be run on target server and it will give you the details of replicat

[oracle@ggdev gg]$ ./gg_memory_usage.sh
OSNAME = Linux
#####################################
# Individual extract Process Usage #
#####################################
#####################################
#   Total extract Process Usage    #
#####################################
Number of processes      =
awk: cmd. line:2: fatal: division by zero attempted
#####################################
# Individual replicat Process Usage #
#####################################
34.3008 MB REP1
#####################################
#   Total replicat Process Usage    #
#####################################
Number of processes      = 1
AVG Memory usage/process = 34.3008 MB
Total memory usage       = 34.3008  MB

Related Posts

Heading 2

Add paragraph text. Click “Edit Text” to customize this theme across your site. You can update and reuse text themes.

bottom of page