#!/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
}
1="lrdne67mp" 2="[DBFSXD011"]-> cat crs_common.ksh
##############################################################################
# CRS Common functions
#
##############################################################################
crs_inst_order()
{
echo
echo "Function name.: crs_inst_order................."
echo "Library file..: crs_common.ksh................."
echo "Directory ....: /oracle/admin/scripts/crsdbfs.."
echo
echo "Shows the installation order for the CRS services..."
echo
echo "Create a service first for GoldenGate"
echo " function - srvctl_add_svc"
echo " add a resource in CRS for DBFS (crs_add_res_dbfs)......"
echo " naming is dbfs_ gg instance name.."
echo " start the DBFS resource............."
echo " stop the DBFS resource.............."
echo " status of the resource.............."
echo " relocate the resource..............."
echo " "
}
crs_res_add_dbfs()
##############################################################################
# Add resource to CRS for DBFS
##############################################################################
{
# GoldenGate XAG Instance
gg_inst=$1
# Database for dependencies
dbnm=$2
# Project Directory
projdir=$3
echo $gg_inst
echo $dbnm
echo $projscr
echo $projdir/mount_dbfs_$gg_inst.bsh
echo
echo "Function name.: crs_res_add_dbfs..............."
echo "Library file..: crs_common.ksh................."
echo "Directory ....: /oracle/admin/scripts/crsdbfs.."
echo
echo "Creating a CRS resource for DBFS..............."
echo
######################################################################
# Check to see if the .bsh script has been created ...."
######################################################################
if [ ! -f "$projscr/mount_dbfs_$gg_inst.bsh" ]; then
echo
echo "The mount script does not exist please create and re-run";
echo
exit
else
echo
echo "The mount script exists and proceeding with CRS resource create"
echo
fi
######################################################################
# Check to see if the .conf file has been created ...."
######################################################################
if [ ! -f "$projscr/mount-dbfs_$gg_inst.conf" ]; then
echo
echo "The mount conf file does not exist please create and re-run";
echo
exit
else
echo "The mount conf file exists and proceeding with CRS resource create"
fi
echo
echo "Adding CRS resource for DBFS dbfs_"$gg_inst
echo "MAKE SURE THE mount_dbfs script is in place before executing this!!!!"
echo
$CRS_HOME/bin/crsctl add resource dbfs_${gg_inst} -type cluster_resource -attr "ACTION_S CRIPT=$projscr/mount_dbfs_${gg_inst}.bsh, CHECK_INTERVAL=30, RESTART_ATTEMPTS=10, START_ DEPENDENCIES='hard(ora.$dbnm.db)pullup(ora.$dbnm.db)',STOP_DEPENDENCIES='hard(ora.$dbnm. db)',SCRIPT_TIMEOUT=300"
# /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl add resource dbfs_${gg_inst} -type clust er_resource -attr "ACTION_SCRIPT=/oracle/admin/scripts/crsdbfs/wrap_mount_dbfs_${gg_inst }.bsh, CHECK_INTERVAL=30, RESTART_ATTEMPTS=10, START_DEPENDENCIES='hard(ora.$dbnm.db)pul lup(ora.$dbnm.db)',STOP_DEPENDENCIES='hard(ora.$dbnm.db)',SCRIPT_TIMEOUT=300"
}
crs_res_start()
##################################################################
# for the $1 parm only the name after dbfs_ needs to be specified
# Start the dbfs resource
##################################################################
{
dbfsmnt=$1
nodename=$2
clear
echo
echo "Function name.: crs_res_start.................."
echo "Library file..: crs_common.ksh................."
echo "Directory ....: /oracle/admin/scripts/crsdbfs.."
echo
echo "Starting CRS resource for DBFS mount "$dbfsmnt
echo
echo "Start DBFS resource...."
echo
# /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl start resource dbfs_$dbfsmnt -n server67mp
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl start resource dbfs_$dbfsmnt -n $nodename
# /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl status resource dbfs_ggtxd001
echo
echo "Status of DBFS resource...."
echo
crs_res_stat $dbfsmnt
echo
echo "df -hs or /dbfs_ mountpoints ...."
echo
df -ha |grep dbfs_
}
crs_res_stop()
{
dbfsmnt=$1
clear
echo
echo "Function name.: crs_add_stop..................."
echo "Library file..: crs_common.ksh................."
echo "Directory ....: /oracle/admin/scripts/crsdbfs.."
echo
echo "Stopping CRS resource for DBFS................."
echo
echo "Stop DBFS resource...."
echo
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stop resource dbfs_$dbfsmnt
echo
echo "Status of DBFS resource...."
echo
crs_res_stat $dbfsmnt
echo
echo "df -hs or /dbfs_ mountpoints ...."
echo
df -ha |grep dbfs_
}
crs_res_stat()
#########################################
# Resource status
#########################################
{
gg_inst=$1
### RVK Change Jan 14th 2019 >>>
### Replaced CRS_HOME hardcode path with $CRS_HOME (Note: CRS_HOME in Dev VA is differen t
### RVK End <<<
$CRS_HOME/bin/crsctl status resource dbfs_$gg_inst
}
crs_res_relo()
#########################################
# Resource relocate
#########################################
{
gg_inst=$1
to_node=$2
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl relocate resource dbfs_$gg_inst -node $to_ node
}
crs_res_del()
#########################################
# Delete DBFS resource
#########################################
{
gg_inst=$1
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl delete resource dbfs_$gg_inst
}
crs_stat()
{
######################################################################################## ###
# The difference on the crs_stat is the directory mismatch on the TX vs VA cluster pair
# Directory needed for TX cluster is 12.1.0.2
######################################################################################## ###
######################################################################################## ###
# This should be in the ggini file in order to drive the correct directory for all stand ard
# scripts
######################################################################################## ###
bindir="12.1.0.2"
echo
echo "crsctl stat res -t...."
echo
/oracle_crs/product/$bindir/crs_1/bin/crsctl status resource -t
echo
echo "Show services from the resource list...."
echo
/oracle_crs/product/$bindir/crs_1/bin/crsctl status resource -t|grep -a1 .svc
echo
echo "If nothing shows here, there are no dbfs mounts ......"
echo
df -ha|grep dbfs
}
crs_stat_xag()
{
gg_inst=$1
dbnm=$2
echo
echo "If XAG resource is not yet setup then this will not work....."
echo
echo "XAG Instance name is $gg_inst / crsctl stat res xag.$gg_inst.goldengate -p all par ameters ...."
echo
# /oracle_crs/product/$bindir/crs_1/bin/crsctl stat res xag.ggtxd001.goldengate -p
/oracle_crs/product/$bindir/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p
echo
echo "Cluster resource cluster resource (dbfs) action script values...."
echo
/oracle_crs/product/$bindir/crs_1/bin/crsctl stat res -w "TYPE = cluster_resource" -p | grep ACTION_SCRIPT
echo
echo "Cluster resource (dbfs) ..."
echo
# /oracle_crs/product/$bindir/crs_1/bin/crsctl stat res ora.dbfsxd01.dbfs_ggtxd001.svc - p
/oracle_crs/product/$bindir/crs_1/bin/crsctl stat res ora.$dbnm.dbfs_$gg_inst.svc -p
}
crs_stat_xag_det()
{
########################################################################################
# Were setting bindir because there is a difference between location of the binaries
# on TX cluster vs VA cluster
########################################################################################
bindir="12.1.0.2"
gg_inst=$1
echo
echo "XAG Instance name is $gg_inst / crsctl stat res xag.$gg_inst.goldengate -p specifi c parameters ...."
echo
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep DATAGUARD_AUTOSTART
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep DB_SERVICES
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep START_DEP
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep STOP_DEP
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep HOSTING
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep FILESYST
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep GG_HOME
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep PLACEMENT
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep USE_LOCAL_SERVICES
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep RELOCATE
}
srvctl_add_svc()
#######################################################
# This is critical for the overall operation
#######################################################
{
gg_inst=$1
dbnm=$2
pfd=$3
avl=$4
echo
echo "Create a service for GoldenGate in the format of svc_$gg_inst..................... ..."
echo "This service is then used for setup through XAG for keying when GoldenGate fails o ver"
echo "SRVCTL add service for svc_$gg_inst when role is primary.......................... ..."
echo "This adds a GoldenGate resource thru SRVCTL ...................................... ..."
echo "-preferred takes an instance name as parameter as does -available................. ..."
echo
echo "Showing before services database "$dbnm
echo
srvctl config service -db $dbnm|grep "Service "
echo
echo "Attempting to add service svc_"$gg_inst
echo
# Example on next line
# srvctl add service -db $dbnm -service svc_$gg_inst -role PRIMARY -preferred DBFSXD011 -available DBFSXD012
srvctl add service -db $dbnm -service svc_$gg_inst -role PRIMARY -preferred $pfd -availa ble $avl
echo
echo "Showing after services database "$dbnm
echo
srvctl config service -db $dbnm|grep "Service "
}
srvctl_svc_mod()
{
dbnm=$1
svcnm=$2
pfd=$3
avl=$4
echo
echo "This modifies the GG service created for XAG triggering "
echo "the service name automatically has svc_ prepended to avoid misconfig for different service"
echo
srvctl modify service -db $dbnm -service svc_$svcnm -modifyconfig -preferred $pfd -avail able $avl -force
}
srvctl_sho_svc()
{
dbnm=$1
clear
echo
echo "Showing services database "$dbnm
echo
srvctl config service -db $dbnm|grep "Service "
}
crs_cr_mount_scrpt()
{
vsn="1.00"
gginst=ggmrct001
flnm="mount_dbfs_mculp_test.bsh"
echo
echo "Create a mount script...."
echo " Version "$vsn
echo
# cat here for create of file
echo "....creating $flnm file......."
cat << EOS > $flnm
### This script is from Note 1054431.1, ensure you have the latest version
### Note 1054431.1 provides information about the setup required to use this script
### MCulp modified 08/01/2018
### The start section has been modified to work with BOA environment
###############################################
# mount-dbfs.bsh start / stop / check / status
###############################################
###############################################################
### All configuration parameters are now in an external file
###############################################################
###########################################
### Ensure that when multiple mounts are used, there are separate copies
### of mount-dbfs.sh that reference separate CONFIG file pathnames
# CONFIG=/etc/oracle/mount-dbfs.conf
# MCulp change location #1
# This should have a conf file unique for each mount
# The location is /oracle/admin/scripts for both the script
# and the config file
##############################################################
# CONFIG=/oracle/admin/scripts/crsdbfs/mount-dbfs_ggtxp002.conf
CONFIG=/oracle/admin/scripts/crsdbfs/mount-dbfs_ggtxp003.conf
###########################################
### No editing is required below this point
###########################################
### date-based versioning YYYYMMDD
VERSION=20160215
### source configuration file
if [ -r $CONFIG ]; then
. $CONFIG
else
echo "$0 ERROR: cannot read config file $CONFIG, aborting"
exit 1
fi
### the DBNAME should be set to the CDB name (from config file)
CDB=$DBNAME
### determine platform
UNAME_S=`uname -s`
if [ $UNAME_S = 'Linux' ]; then LINUX=1; SOLARIS=0;
elif [ $UNAME_S = 'SunOS' ]; then LINUX=0; SOLARIS=1;
fi
GREP=/bin/grep
AWK=/bin/awk
SED=/bin/sed
ECHO=/bin/echo
LOGGER="/bin/logger -t DBFS_${MOUNT_POINT}"
RMF='/bin/rm -f'
TOUCH=/bin/touch
CHMOD=/bin/chmod
PS=/bin/ps
SLEEP=/bin/sleep
KILL=/bin/kill
BASENAME=/bin/basename
STAT=/usr/bin/stat
ID=/usr/bin/id
WC=/usr/bin/wc
SRVCTL=$ORACLE_HOME/bin/srvctl
DBFS_CLIENT=$ORACLE_HOME/bin/dbfs_client
HN=/bin/hostname
PERL=/usr/bin/perl
MOUNT=/bin/mount
### ensure messages are displayed in English for pattern matching
LANG=en_US.UTF-8
NLS_LANG=American_America.AL32UTF8
NUMACTL=/usr/bin/numactl
RPMCTL=/bin/rpm
if [ -z "$STATUS_TIMEOUT" ]; then STATUS_TIMEOUT=0; fi
if [ $LINUX -eq 1 ]; then
MOUNT=/bin/mount
XARGS='/usr/bin/xargs -r'
FUSERMOUNT=/bin/fusermount
LD_LIBRARY_PATH=$ORACLE_HOME/lib:/lib64
elif [ $SOLARIS -eq 1 ]; then
MOUNT=/sbin/mount
XARGS=/usr/bin/xargs
UMOUNT=/usr/sbin/umount
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORACLE_HOME/rdbms/lib:/usr/lib:/lib
fi
DBFS_PWDFILE=$DBFS_PWDFILE_BASE.$$
export ORACLE_HOME LD_LIBRARY_PATH TNS_ADMIN
export STAT MOUNT_POINT PERL_ALARM_TIMEOUT SOLARIS LINUX
export PATH=$ORACLE_HOME/bin:$PATH
export STATUS_TIMEOUT
export LANG NLS_LANG
logit () {
### type: info, error, debug
type=$1
msg=$2
if [ "$type" = "info" ]; then
$ECHO $msg
$LOGGER -p ${LOGGER_FACILITY}.info "$msg"
elif [ "$type" = "error" ]; then
$ECHO $msg
$LOGGER -p ${LOGGER_FACILITY}.error "$msg"
elif [ "$type" = "debug" ]; then
$ECHO $msg
$LOGGER -p ${LOGGER_FACILITY}.debug "$msg"
fi
}
### must not be root
if [ `$ID -u` -eq 0 ]; then
logit error "Run this as the Oracle software owner, not root"
exit 1
fi
### determine how we were called, derive location
SCRIPTPATH=$0
SCRIPTNAME=`$BASENAME $SCRIPTPATH`
$ECHO $SCRIPTPATH | $GREP ^/ > /dev/null 2>&1
if [ $? -ne 0 ]; then
MYDIR=`pwd`
SCRIPTPATH=${MYDIR}/${SCRIPTPATH}
fi
### must cd to a directory where the oracle owner can get CWD
cd /tmp
case "$1" in
##########################################
# Start begins here
##########################################
'start')
echo "Start...."
echo
logit info "$SCRIPTNAME mounting DBFS at $MOUNT_POINT from database $DBNAME"
### check to see if it is already mounted
$SCRIPTPATH status > /dev/null 2>&1
if [ $? -eq 0 ]; then
logit error "$MOUNT_POINT already mounted, use $SCRIPTNAME stop before attempting to start"
$SCRIPTPATH status
exit 1
fi
### set the ORACLE_SID dynamically based on OCR info, if it is running
# if RAC, set SID with following command
export ORACLE_SID=$($SRVCTL status instance -d $DBNAME -n `$HN` | \
$GREP 'is running' | $AWK '{print $2}' )
# if single instance, set ORACLE_SID based on below command instead
if [ -z "$ORACLE_SID" ]; then
export ORACLE_SID=$($SRVCTL config db -d $DBNAME | $GREP 'instance' | $AWK '{print $ 3}')
fi
logit info "ORACLE_SID is $ORACLE_SID"
### further checks required if we are using a PDB
### if the local instance isn't running (because ORACLE_SID is null) don't bother
if [ -n "$ORACLE_SID" -a "$IS_PDB" = 'true' ]; then
logit info "IS_PDB = true"
HOSTNAME=`$HN -s`
### by checking to see if the service is running on the local instance,
### we can deterine whether we should continue or not
PDB_SERVICE_STATE=$($SRVCTL status service -d $CDB -s $PDB_SERVICE | \
$GREP "$ORACLE_SID" )
### if the output from the last command is > 0, service is running locally
if [ -n "$PDB_SERVICE_STATE" ]; then
logit info "PDB service is online"
else
logit error "PDB service is offline. Exiting"
exit 2
fi
fi
### if there's no SID defined locally or it isn't running, stop
if [ -z "$ORACLE_SID" -a "$WALLET" = 'false' ]; then
logit error "No running ORACLE_SID available on this host, exiting"
exit 2
fi
### version comparison function, used in numa section
# Compare string versions
# Returns in stdout and in the err code
# 0 - a equal b
# 1 - a greater than b
# 255(-1) - a less than b
# version should be in format 1.2.3.4.5
# It might be a short version like 1.2.3 or 1.2.3.
version_cmp ()
{
local -a al=(`$ECHO $1 | $SED -e 's/\./ /g'`)
local -a bl=(`$ECHO $2 | $SED -e 's/\./ /g'`)
local -i i=0
for ((i=0; i < ${#al[@]}; i++)); do
# ap is always non-empty. Gap is not possible in both arrays
local ap=${al[$i]}
local bp=${bl[$i]}
# Only $ap defined. $a longer (bigger) then $b
if [ -z "$bp" ] || [ $ap -gt $bp ]; then
$ECHO "1"
return 1
elif [ $ap -lt $bp ]; then
$ECHO "-1"
return -1
fi
done
# Check for the next part from @bl. It means $a shorter (smaller) then $b
if [ -n "${bl[$i]}" ]; then
$ECHO "-1"
return -1
fi
# Both arrays ended at the same time. They are equal
$ECHO "0"
return 0
}
# MCulp commenting out the whole section as we do not need this currently
######################################################################################## ###
# ### if numa system on Linux, update mount_options for bug 10004611
# if [ $LINUX -eq 1 ]; then
# RPMEXA=`$RPMCTL -q --queryformat '%{VERSION}' exadata-base`
# NUMASYS=`$NUMACTL --hardware | $GREP available: | cut -c1-18`
#
# ###Check if an X8 system and image greater than or equal to 11.2.3.3.0 to support n uma mount option
# if [ "$NUMASYS" = 'available: 8 nodes' ]; then
# if [ `version_cmp $RPMEXA 11.2.3.3.0` -eq 0 ] || [ `version_cmp $RPMEXA 11.2.3.3. 0` -eq 1 ]; then
# # MOUNT_OPTIONS=$MOUNT_OPTIONS,numa
# MOUNT_OPTIONS=$MOUNT_OPTIONS
# else
# MOUNT_OPTIONS=$MOUNT_OPTIONS
# fi
#
# ###Check if an X5-2 system to support numa mount option
# elif [ "$NUMASYS" = 'available: 2 nodes' ]; then
# # MOUNT_OPTIONS=$MOUNT_OPTIONS,numa
# MOUNT_OPTIONS=$MOUNT_OPTIONS
# ###Check for all other X2 systems, do not use numa option
# elif [ "$NUMASYS" = 'available: 1 nodes' ]; then
# MOUNT_OPTIONS=$MOUNT_OPTIONS
# ###Exit for errors or unexpected values, post in messages file
# else
# logit error "Unexpected numa value. Exiting."
# logit error "Numa hardware value is: $NUMASYS"
# logit error "RPM version of Exadata base is: $RPMEXA"
# exit 1
# fi
# else
# logit info "skipped numa check for Solaris...not applicable"
# fi
######################################################################################## ###
### if using password-based startup, use this
if [ "$WALLET" = 'false' -a -n "$DBFS_PASSWD" ]; then
$RMF $DBFS_PWDFILE
if [ -f $DBFS_PWDFILE ]; then
logit error "please remove $DBFS_PWDFILE and try again"
exit 1
fi
$TOUCH $DBFS_PWDFILE
$CHMOD 600 $DBFS_PWDFILE
$ECHO $DBFS_PASSWD > $DBFS_PWDFILE
logit info "spawning dbfs_client command using SID $ORACLE_SID"
### if PDB, mount with this command
if [ "$IS_PDB" = 'true' ]; then
(nohup $DBFS_CLIENT ${DBFS_USER}@${PDB} -o $MOUNT_OPTIONS \
$MOUNT_POINT < $DBFS_PWDFILE | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) &
### if not PDB, mount with this command instead
else
echo "Correct command...."
### MCulp changed
# nohup $ORACLE_HOME/bin/dbfs_client ggtxp003/not4good@dbfs_ggtxp003 -o rw,direct_io /dbfs_ggtxp003 < /oracle/admin/scripts/clle_dbfscommon/.gg_password &>/oracle/admin/scr ipts/crsdbfs/nohup.out
# nohup $ORACLE_HOME/bin/dbfs_client ggtxp003/not4good@dbfs_ggtxp003 -o rw,direct_io /dbfs_ggtxp003 < /oracle/admin/scripts/clle_dbfscommon/.gg_password &
nohup $ORACLE_HOME/bin/dbfs_client ggtxp002/not4good@dbfs_ggtxp003 -o $MOUNT_OPTIO NS /dbfs_ggtxp003 < /oracle/admin/scripts/clle_dbfscommon/.gg_password &
# MOUNT_OPTIONS=rw,direct_io
# This is the original mount command unmodified
# MAKE SURE TO MODIFY THE entry after the @ symbol
# The next line is the original line
# (nohup $DBFS_CLIENT ${DBFS_USER}@ -o $MOUNT_OPTIONS \
# $MOUNT_POINT < $DBFS_PWDFILE | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) &
# MOUNT_TNS as added to the conf file that is read in
########################################################################################
echo
echo $DBFS_USER
echo
echo $MOUNT_TNS
echo
echo $MOUNT_OPTIONS
echo
echo
# (nohup $DBFS_CLIENT ${DBFS_USER}@$MOUNT_TNS -o $MOUNT_OPTIONS \
# $MOUNT_POINT < $DBFS_PWDFILE | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) &
fi
### if wallet is true, mount with this command
elif [ "$WALLET" = true ]; then
logit info "doing mount $MOUNT_POINT using SID $ORACLE_SID with wallet now"
(nohup $DBFS_CLIENT /@${DBFS_LOCAL_TNSALIAS} -o $MOUNT_OPTIONS,wallet \
$MOUNT_POINT | $LOGGER -p ${LOGGER_FACILITY}.info 2>&1 & ) &
fi
### allow time for the mount table update before checking it
$SLEEP 1
$RMF $DBFS_PWDFILE
### set return code based on success of mounting
$SCRIPTPATH status > /dev/null 2>&1
if [ $? -eq 0 ]; then
logit info "Start -- ONLINE"
exit 0
else
logit info "Start -- OFFLINE"
exit 1
fi
;;
############################################################
# MCulp Changed
# Added z to the fusermount options as the u by itself
# was not working correctly
############################################################
'stop')
$SCRIPTPATH status > /dev/null
if [ $? -eq 0 ]; then
logit info "unmounting DBFS from $MOUNT_POINT"
if [ $LINUX -eq 1 ]; then
logit info "umounting the filesystem using '$FUSERMOUNT -uz $MOUNT_POINT'"
# $FUSERMOUNT -u $MOUNT_POINT
$FUSERMOUNT -uz $MOUNT_POINT
elif [ $SOLARIS -eq 1 ]; then
logit info "umounting the filesystem using '$UMOUNT $MOUNT_POINT'"
$UMOUNT $MOUNT_POINT > /dev/null 2>&1
fi
$SCRIPTPATH status > /dev/null
if [ $? -eq 0 ]; then
logit error "Stop - stopped, but still mounted, error"
exit 1
else
logit info "Stop - stopped, now not mounted"
exit 0
fi
else
logit error "filesystem $MOUNT_POINT not currently mounted, no need to stop"
fi
;;
'check'|'status')
### check to see if it is mounted
### fire off a short process in perl to do the check (need the alarm builtin)
logit debug "Checking status now"
$PERL <<'TOT'
$timeout = $ENV{'PERL_ALARM_TIMEOUT'};
$SIG{ALRM} = sub {
### we have a problem and need to cleanup
exit 3;
die "timeout" ;
};
alarm $timeout;
eval {
$STATUSOUT=`$ENV{'STAT'} -f -c "%T" $ENV{'MOUNT_POINT'} 2>&1 `;
chomp($STATUSOUT);
### added fuseblk check for Linux 6 output
if ( ( $ENV{'SOLARIS'} == 1 && $STATUSOUT eq 'uvfs' ) ||
( $ENV{'LINUX'} == 1 && $STATUSOUT eq 'UNKNOWN (0x65735546)' ) ||
( $ENV{'LINUX'} == 1 && $STATUSOUT eq 'fuseblk' ) ) {
### status is okay
exit 0;
} elsif ( $STATUSOUT =~ /Transport endpoint is not connected/ ) {
### we have a problem, need to clean up
exit 2;
} else {
### filesystem is offline
exit 1;
}
};
TOT
RC=$?
### process return codes from the perl block
if [ $RC -eq 3 ]; then
STATUS_TIMEOUT=$(( $STATUS_TIMEOUT + 1 ))
logit error "Found timeout while checking status, cleaning mount automatically"
$SCRIPTPATH clean
logit debug "Check -- OFFLINE"
exit 1
elif [ $RC -eq 2 ]; then
STATUS_TIMEOUT=$(( $STATUS_TIMEOUT + 1 ))
logit error "Found error while checking status, cleaning mount automatically"
$SCRIPTPATH clean
logit debug "Check -- OFFLINE"
exit 1
elif [ $RC -eq 1 ]; then
logit debug "Check -- OFFLINE"
exit 1
elif [ $RC -eq 0 ]; then
logit debug "Check -- ONLINE"
exit 0
fi
;;
'restart')
logit info "restarting DBFS"
$SCRIPTPATH stop
$SLEEP 2
$SCRIPTPATH start
;;
##########################################################################
# clean abort
# MCulp 08/01/2018
# Added z to the fusermount option below
##########################################################################
'clean'|'abort')
logit info "cleaning up DBFS nicely using (fusermount -u|umount)"
if [ $LINUX -eq 1 ]; then
$FUSERMOUNT -u $MOUNT_POINT
elif [ $SOLARIS -eq 1 ]; then
$UMOUNT $MOUNT_POINT > /dev/null 2>&1
fi
$SLEEP 1
FORCE_CLEANUP=0
if [ $STATUS_TIMEOUT -gt 1 ]; then
FORCE_CLEANUP=1
else
$SCRIPTPATH status > /dev/null
if [ $? -eq 0 ]; then FORCE_CLEANUP=1; fi
fi
if [ $FORCE_CLEANUP -eq 1 ]; then
logit error "tried (fusermount -u|umount), still mounted, now cleaning with (fuser mount -uz -z|umount -f) and kill"
if [ $LINUX -eq 1 ]; then
$FUSERMOUNT -u -z $MOUNT_POINT
elif [ $SOLARIS -eq 1 ]; then
$ECHO "running umount -f now"
$UMOUNT -f $MOUNT_POINT > /dev/null 2>&1
fi
if [ $LINUX -eq 1 ]; then
PIDS=`$PS -ef | $GREP -w "$MOUNT_POINT" | $GREP dbfs_client| $GREP -v grep | \
$AWK '{print $2}'`
if [ -n "$PIDS" ]; then $KILL -9 $PIDS; fi
PIDS=`$PS -ef | $GREP -w "$MOUNT_POINT" | $GREP mount.dbfs | $GREP -v grep | \
$AWK '{print $2}'`
if [ -n "$PIDS" ]; then $KILL -9 $PIDS; fi
elif [ $SOLARIS -eq 1 ]; then
PIDS=`$PS -ef | $GREP dbfs_client| $GREP -v grep | $AWK '{print $2}'`
REALPIDS=' '
for pid in $PIDS
do
ARGS=`pargs $pid`
$ECHO $ARGS | $GREP "$MOUNT_POINT$" > /dev/null
RET=$?
if [ $RET -eq 0 ]; then REALPIDS="$REALPIDS $pid"; fi
done
if [ -n "$REALPIDS" ]; then $KILL -9 $REALPIDS; fi
### do it a 2nd time to clean up others
if [ -n "$REALPIDS" ]; then $KILL -9 $REALPIDS; fi
PIDS=`$PS -ef | $GREP dbfs_client| $GREP -v grep | $AWK '{print $2}'`
REALPIDS=' '
for pid in $PIDS
do
ARGS=`pargs $pid`
$ECHO $ARGS | $GREP "$MOUNT_POINT$" > /dev/null
RET=$?
if [ $RET -eq 0 ]; then REALPIDS="$REALPIDS $pid"; fi
done
if [ -n "$REALPIDS" ]; then $KILL -9 $REALPIDS; fi
fi
exit 1
fi
;;
'version')
### simply show the version
echo "$VERSION"
;;
*)
$ECHO "Usage: $SCRIPTNAME { start | stop | check | status | restart | clean | abort | version }"
;;
esac
EOS
echo "$flnm has been created please review file and modify file....."
###### end of the file
Description of Services
Consulting assistance
Oracle GoldenGate for Big Data (GGBD)
In order to use GoldenGate in a Golden Gate Hub Configuration
Assistance with creating additional Oracle GoldenGate for Big Data processes needed:
Assumptions
https://docs.oracle.com/en/middleware/goldengate/big-data/12.3.2.1/gbdin/understanding-java-adapter-and-oracle-goldengate-big-data.html#GUID-EDFEF2A7-ADBA-4B1A-87F1-AEFD2061AE9D
Like extract altering, you can also alter the replicat process to reposition to start over replication process from a trail file, Along with reposition with specific extseqno , you can also reposition to specific date and time especially useful when you regenerate extract trail files or replication abended for some reasons.
Start Stop Replicat start replicat rep3
stop replicat rep3 Starting and Stopping Replicat Process
stop replicat r* stop/start replicat process or group that start with r*
start replicat r*
Kill Replicat kill replicat rep3 Kill the replicat process when the stop command does not respond
Lag Replicate lag replicat rep3 Shows how much lag replicat is from the extract.
From particular extract sequence
ALTER REPLICAT rep3, EXTSEQNO 53 Useful when you know which sequence the replicat stop and restart from that point
From particular RBA address
ALTER REPLICAT rep3, EXTRBA 0
ALTER REPLICAT rep3, EXTRBA 1001 Useful when the extrail is available and you want to read from particular place to
avoid duplicity of data
0 - means from header
n - means from particular that point.
From Particular date
ALTER REPLICAT rep3, BEGIN 2011-01-07 08:00:00
Reads and start replicate from particular date and time
Unregister Unregister replicat rep3 Rather delete if you want to unregister the replicat from database, so ti removes the information from the goldengate metadata.
Delete delete replicat rep3 deletes the replicat from process
cleanup cleanup replicate rep3 cleansup records from checkpoint table , does not delete the replicat
Similar to archive log clean up, one should also think about purging goldengate trail files.
By default, Goldengate manager does not purge them unless the purgeoldextracts parameter is not specified in the mgr param file.
Syntax for purging trail files
PURGEOLDEXTRACTS trail [, USECHECKPOINTS | NOUSECHECKPOINT ] [, MINKEEP_rule MINKEEPHOURS|MINKEEPDAYS|MINKEEPFILES]
So now the question is, "how often the manager purges the trail records", by default it is 10 MINS as per CHECKMINUTES default value. Even you do not specify this 10 mins is the default.
For example, in the following the manager process purges the old extracts.
The USECHECKPOINTS parameter tells manager process to check if trail file is already applied or not in Checkpoint table. Do NOT use NOUSECHECKPOINT, since it will delete all the trail files without considering the trail file.
.ggsci
./ggsci
info all
EDIT PARAMS MGR
### Add the bold line to your manager Param file ###
PORT 7809
USERID ggs_owner, PASSWORD ggs_owner
PURGEOLDEXTRACTS /data/ggate/dirdat/ex, USECHECKPOINTS
This is now GoldenGate for Big Data
#!/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_env()
###############################################################################
# Create the ggoraenv.env file
###############################################################################
{
#
# Environment
#
################################################################
# usedate=`date +%a`
################################################################
usedate=`date +%d-%h-%Y`
echo $usedate
echo
echo "...Creating ggoraenv_"$usedate".env...."
echo
# echo > ggoraenv.env
cat << EOS > ggoraenv_$usedate.env
# export ORACLE_HOME=/oracle/product/
# export ORACLE_SID=
# export LD_LIBRARY_PATH=
# GGS_HOME=/oracle/product/gg12.1
# GGS_HOME=/oracle/product/12.2/gg_2
# export GGS_HOME=/u01/app/oracle/product/12.2/gg_2
# export GGS_HOME=$gg_dir
# GGS_HOME=\$gg_dir
# export GGS_HOME=$gg_dir
export GGS_HOME=/oracle/product/gg122
export GG_SITE=01
# export GG_SITE=02
# export GG_SITE=03
# export GG_SITE=04
# export GG_SITE=05
# export GG_SITE=06
# export GG_SITE=07
export GG_LOC=TX
# export GG_LOC=VA
# if there is only one DB related to this GG home,
# set NEW_ORACLE_SID to avoid constant switch between a DB env and its GG env
# export NEW_ORACLE_SID=DBFSXD011; . ~/.std_profile
# otherwise, set NEW_ORACLE_SID to dummy if there are multiple replicated databases related to same GG home
# export NEW_ORACLE_SID=dummy; . ~/.std_profile
# uncomment next three lines if ORACLE_SID is dummy
# export ORACLE_HOME=/oracle/product/11.2.0/db_1
export LD_LIBRARY_PATH=$ORACLE_HOME/lib/$JAVA_HOME/lib/amd64/server:$LD_LIBRARY_PATH
export PATH=$ORACLE_HOME/bin:$PATH
export PATH=$GGS_HOME:$PATH
export LD_LIBRARY_PATH=$GGS_HOME:$LD_LIBRARY_PATH
# for OEM12c GG monitoring
# export JAVA_HOME=/oracle/product/12.1.0/oem_1/agent/core/12.1.0.2.0/jdk/jre
# export PATH=$JAVA_HOME/bin:$PATH
# export LD_LIBRARY_PATH=$JAVA_HOME/lib/amd64/server:$LD_LIBRARY_PATH
TZ=UTC
export TZ
#############################################
## For GI Agent (XAG)
##############################################
# export XAG_HOME=/oracle/product/xag71
# export XAG_HOME=/oracle/product/xag81b
# export XAG_HOME=/oracle/product/xag91
# export PATH=$XAG_HOME/bin:$PATH
##############################################
# Change the prompt
##############################################
PS1="\\
\${PWD} \\
\${SNAME} [\${ORACLE_SID}] [GG_site$GG_SITE"_"$GG_LOC]-> "
export PS1
# alias ggsora12='. $HOME/.ggsora12_env;cd $GGS_HOME'
# alias ggsora12='. /ora_rman/ora013/mrc/gg/ggoraenv.env;cd $GGS_HOME'
# alias xag='. $HOME/.ggsora12_env;cd $XAG_HOME'
# alias ggstatus='$XAG_HOME/bin/agctl status goldengate piperd01_oggapp'
echo "GGS_HOME is : " $GGS_HOME
# export TMPLT=/oracle/product/11.2.0/db_1/assistants/dbca/templates
export TMPLT=/oracle/product/12.1.0/db_1/assistants/dbca/templates
export ADMSCR=/oracle/admin/scripts
export APXSCR=/oracle/admin/scripts/apex
export GGADMSCR=/oracle/admin/scripts/ggcommon
export APXADMSCR=/oracle/admin/scripts/apex
alias admscr='cd $ADMSCR'
alias apxscr='cd $APXADMSCR'
alias tmplt='cd $TMPLT'
alias ggadmscr='cd $GGADMSCR'
alias gi='cd /oracle_crs/product/11.2.0/crs_2/log/$HOST'
alias ocssd='cd /oracle_crs/product/11.2.0/crs_2/log/$HOST/cssd'
alias crsd='cd /oracle_crs/product/11.2.0/crs_2/log/$HOST/crsd'
GGS_HOME=/oracle/product/12.2/gg_2
alias gh='cd $GGS_HOME'
alias gd='cd /ggate'
#############################################
# For GoldenGate
#############################################
export GGS_HOME=/oracle/product/12.2/gg_2
export PATH=$GGS_HOME:$PATH
export LD_LIBRARY_PATH=$GGS_HOME:$LD_LIBRARY_PATH
EOS
}
Here are some good GoldenGate scripts I have found
https://www.dropbox.com/s/grewqwmna0hlvl1/GoldenGate_Monitoring_Scripts_v1.06.zip?dl=0&file_subpath=%2Fgg_mon