[code language=”sql”]

#!/bin/ksh
############################################################################
# Script Name..: gg_common.ksh
# Description..: Common GG Hub functions for inclusion to all driver scripts
# Author…….: Michael Culp
# Date………: 04/23/2010
# Version……: .65
# Modified By..: Michael Culp
# Date Modified: 06/07/2017
# Comments…..: Change this library to make mods to all functions
# Schema owner.: N/A
# Dependent on.: N/A
# Script type..: function library
# Function list:
############################################################################

############################################################################
#
############################################################################

gg_init()
##########################################################
# These variables should be set prior to setup
# Call this function anytime the variables need to be
# set for values that will be utilized in other functioons
# gg_init should be used to determine which environment
# needs to be setup
#########################################################
{

# Take a parameter for the instance
gginst=$1

# Do not change the following 2 variables
#########################################################
ggcomver=".92"
ggcomdt="10/18/2018"

#########################################################
# set -xv
# This will set the ggini file based on the hostname
#########################################################
initflnm=`hostname -a`".ggini"

echo "Display the init file name"
echo $initflnm

# Test to see if the is an init file first
# if so read it, otherwise set these variables

# future enhancement check for various scripts standard names
echo
echo
echo "Checking for the existance of the ggini initialization file.."
echo

# if [ -f /oracle/admin/scripts/ggcommon/`hostname -a`.ggini ]; then
if [ -f /oracle/admin/scripts/ggcommon/`hostname -a`.gginix ]; then
echo "….file exists…."
echo
echo " The ggini file was read ….Y"
echo
echo "….reading variables from the .ggini file….."
echo
# . ./`hostname -a`.ggini
. /oracle/admin/scripts/ggcommon/`hostname -a`.ggini
else
echo "….file does not exist"
echo
echo " The ggini file was not read …."
echo
echo "….reading variables from the gg_init function….."
echo
#########################################################
# Set the Oracle inventory location
#########################################################
orainv="/oracle/oraInventory"

echo
echo "Running gg_init function()……."
echo

#######################################################
# GoldenGate operational directory
# This needs to be set during build of additional
# GoldenGate instances
#######################################################
# gg_dir="/oracle/product/gg123"
# gg_dir="/oracle/product/gg123ms"
# gg_dir="/oracle/product/gg122"

# gg_dir="/oracle/product/ggvad001"
# gg_dir="/oracle/product/ggvad001"
# gg_dir="/oracle/product/ggvad001"
# gg_dir="/oracle/product/ggtxd003"
# gg_dir="/oracle/product/ggtxd002"
# gg_dir="/oracle/product/ggtxd001"
# gg_dir="/oracle/product/ggtxd006"
# gg_dir="/oracle/product/ggtxd007"
gg_dir="/oracle/product/ggvat004"

# gg_dir="/oracle/product/gg121"

export GGS_HOME=$gg_dir

export OGG_HOME=$GGS_HOME

#######################################################
# GoldenGate version
# We support GG 12.1, 12.2, 12.3 currently
#######################################################
ggver="12.3"
# ggver="12.2"
# ggver="12.1"

# export DBFS_MNT=/dbfs

#######################################################
# GoldenGate source version
#######################################################
ggsrcver="12.1"

#######################################################
# ggflnm – is the zip file name of the GG distro
# This is the name of the goldengate zip files
#######################################################
# File below is 12.3.0.1.2
ggflnm="123014_fbo_ggs_Linux_x64_shiphome.zip"

# File below is 12.3.0.1.2
# ggflnm="123012_fbo_ggs_Linux_x64_shiphome.zip"

# File below is 12.2
# ggflnm="V100692-01.zip"

# File below is 12.3 Micro Service Architecture
# ggflnm="123010_fbo_ggs_Linux_x64_shiphome.zip"
#######################################################

#######################################################
# ggdir_dist – directory of the distro zip file
# This is the name of the directory where the distribution GoldenGate software is stored
# Choose one and uncomment it
#######################################################
##### GoldenGate ver. 12.3
# ggdir_dist="/ora01/Oracle_SW/gg123/"
##### GoldenGate ver. 12.3.0.1.4
ggdir_dist="/ora01/Oracle_SW/gg123/123014/"
##### GoldenGate ver. 12.3 MicroService Architecture
# ggdir_dist="/ora01/Oracle_SW/gg123ms/"
# ggdir_dist="/ora01/Oracle_SW/gg122/"
# ggdir_dist="/ora01/Oracle_SW/gg121/"

#######################################################
# gginstdir – Location of the installer
# GoldenGate installer directory
#######################################################
gginstdir=$ggdir_dist"fbo_ggs_Linux_x64_shiphome/Disk1"

#######################################################
# ggrspfldir – Response file directory
# Response file directory
#######################################################
ggrspfldir=$ggdir_dist"fbo_ggs_Linux_x64_shiphome/Disk1/response"

#######################################################
# ggrspfl – response file name
# Response file name for install of the GG binaries
#######################################################
ggrspfl="oggcore_mrc.rsp"

#######################################################
# XAG version
#######################################################
# xagver="7.1b"
# xagver="8.1b"
xagver="9.1"

#######################################################
# This is the name of the directory where the XAG software is stored
#######################################################
# xagdir_dist="/ora01/Oracle_SW/xag71/"
# xagdir_dist="/ora01/Oracle_SW/xag81b/"
xagdir_dist="/ora01/Oracle_SW/xag91/"

#######################################################
# XAG Ops directory
# This is the operational directory for XAG
#######################################################
# xagdir="/oracle/product/xag_71"
# xagdir="/oracle/product/xag_81b"
xagdir="/oracle/product/xag_91"

#######################################################
# XAG home directory
#######################################################
XAG_HOME=/oracle/product/xag_91
XAG_LOG=/oracle/product/xag_91/log/nodename

#######################################################
# This is the name of the xag zip file
#######################################################
# xagflnm="xagpack81b.zip"
xagflnm="xagpack91.zip"

# Read the GG environment files
# . ./ggoraenv.env

fi

XAG_SD=/oracle/admin/scripts/ggcommon

CRS_SD=/oracle/admin/scripts/crsdbfs
DBFS_SD=/oracle/admin/scripts/clle_dbfscommon
GG_SD=/oracle/admin/scripts/ggcommon
ASM_SD=/oracle/admin/scripts/asmcommon
DG_SD=/oracle/admin/scripts/dgcommon

############################################################################
# Show the variable status dashboard, comment this line to not display it
############################################################################
gg_init_dbrd

}

gg_init_dbrd()
########################################################
# This is a display dashboard that shows the values of
# Environmental variables
# used in various functions
########################################################
{

echo
echo "Change variables in gg_common.ksh gg_init…."
echo "Display with gg_init_dbrd function ………."
echo

echo
echo "..gg_common.ksh ver. $ggcomver Date $ggcomdt"
echo "….Oracle Inventory location…………….: " $orainv
echo "….GoldenGate Version…………………..: " $ggver
echo "….GoldenGate Source Version supported……: " $ggsrcver
echo
echo "================= Installation Parameters ======================="
echo "….GoldenGate Filename………………….: " $ggflnm
echo "….GoldenGate software distribution dir…..: " $ggdir_dist
echo "….GoldenGate Response File Dir………….: " $ggrspfldir
echo "….GoldenGate Response File …………….: " $ggrspfl
echo "….GoldenGate Installer directory………..: " $gginstdir
echo "….GoldenGate Ops Directory…………….: " $gg_dir
echo "….GoldenGate Home..GGS_HOME…………….: " $GGS_HOME
echo "….GoldenGate Home..OGG_HOME…………….: " $OGG_HOME
echo
echo "….XAG Version…………………………: " $xagver
echo "….XAG Filename………………………..: " $xagflnm
echo "….XAG Dist directory…………………..: " $xagdir_dist
echo "….XAG Ops directory……………………: " $xagdir
echo "….XAG Home directory…………………..: " $XAG_HOME
echo "…….XAG scripts directory……………..: " $XAG_SD
echo "….XAG Log Directory……………………: " $XAG_LOG
echo
echo "================= DBFS Parameters =============================="

echo "================= Scripts Directoriess ========================="
echo "…….CRS……………..: " $CRS_SD
echo "…….DBFS…………….: " $DBFS_SD
echo "…….GoldenGate……….: " $GG_SD
echo "…….XAG……………..: " $XAG_SD
echo "…….DataGuard………..: " $DG_SD
echo "================================================================"

echo
echo "….LD_LIBRARY_PATH……………………..: " $LD_LIBRARY_PATH
echo
echo "….PATH……………………………….: " $PATH
echo

echo "Installation directories………………….."
echo
ls -lt /oracle/product/

# echo "Show ldd for libraries……………………."
# ldd -d extract
# echo "….end transmission………………………"

}

gg_cr_inst_init()
{

echo
echo "Create Install INIT file….."
echo
cat << EOS > gg_inst_init_$gginst.env

export GGS_HOME=/oracle/product/gg122

EOS

}

gg_unzip()
##############################################
# Unzip the GG distribution file
# See gg_init function for the variables:
# ggdir_dist
# ggflnm
##############################################
{

ggdir_dist=$1
ggflnm=$2

echo
echo "Unzip function…."
echo

cd $ggdir_dist
unzip $ggflnm

}

[/code]