cr_dbfs_exeprimdb.ksh

echo "RDBMS DB Name            : $DBNAME"
echo "GG Instance Name         : $GGINST"
echo "GG Instance Location     : $GGLOC"
echo "Preferred Instance List  : $DBINSTLST"
echo "SCAN Hostname            : $CSCAN"

### cd /oracle/admin/scripts/proj
### tar -xvf /oracle/admin/scripts/proj/APPGold_20190211.tar
mv /oracle/admin/scripts/proj/appgold /oracle/admin/scripts/proj/$DBFSNM
cd /oracle/admin/scripts/proj/$DBFSNM

### Replace appgold with rvkapp with associated GG instance
find . -name '*appgold*' -exec bash -c ' mv $0 ${0/\appgold/$DBFSNM}' {} \;

### Replace APPNM, GG_INST and GG_LOC in ggini file
sed -i "s/APPNM=?????/APPNM=$DBFSNM/g" *ggini
sed -i "s/GG_INST=?????/GG_INST=$GGINST/g" *ggini
sed -i "s/GG_LOC=?????/GG_LOC=$GGLOC/g" *ggini

## Replace string "ggini" file location in all function scripts
sed -i "s/appgold\/appgold.ggini/$DBFSNM\/$DBFSNM.ggini/g" *.ksh

### Replace mount config file
sed -i "s/appgold/$DBFSNM/g" mount*
sed -i "s/DBFSGOLD/$DBNAME/g" mount*conf

-- Scripts to execute in ONE Instance on RDBMS

. /oracle/admin/scripts/proj/$DBFSNM/$DBFSNM.ggini

### Create Service on Primary, execute on one node of each cluster (Primary and Standby)

$PROJDIR/dbfs_cr_svc_parm_"$APPNM"_fn.ksh $DBNAME $DBFSNM $DBINSTLST

### Create tablespace and username, Execute on Primary DB only

$PROJDIR/dbfs_cr_tblspusr_parm_"$APPNM"_fn.ksh dbfs_$DBFSNM 1G 1G

### Create objects Execute on Primary DB only

$PROJDIR/dbfs_cr_objs_parm_"$APPNM"_fn.ksh $DBFSNM dbfs_$DBFSNM

### Add resource executed one node of each cluster (Primary and Standby)

$PROJDIR/crs_add_res_dbfs_parm_"$APPNM"_fn.ksh $DBFSNM $DBNAME $PROJDIR

### Add dbfs mount to GoldenGate instance, executed one node of each cluster (Primary and Standby)

$PROJDIR/xag_add_proj_fs_parm_"$APPNM"_fn.ksh $GGINST $DBFSNM $DBNAME

cr_dbfs_exestdy.ksh

#!/usr/bin/ksh

export DBFSNM=ftk                                   ### DBFSNM is mount name in lower case without dbfs_ prefix
export DBNAME=DBFSXT02                             ### DBNAME RDBMS database name the mount will be created
export GGINST=ggvat002                              ### GGINST Goldengate instance to which dbfs mount will be assigned to
export GGLOC=VA                                     ### GGLOC  Location of the Goldengate instance (TX/VA/PA)
export DBINSTLST="DBFSXT022,DBFSXT021,DBFSXT023"    ### RDBMS DB Instance list
export CSCAN=CORMT050-SCAN.BANKOFAMERICA.COM        ### SCAN Hostname of the cluser

echo "Application mount        : $DBFSNM"
echo "RDBMS DB Name            : $DBNAME"
echo "GG Instance Name         : $GGINST"
echo "GG Instance Location     : $GGLOC"
echo "Preferred Instance List  : $DBINSTLST"
echo "SCAN Hostname            : $CSCAN"

### cd /oracle/admin/scripts/proj
### tar -xvf /oracle/admin/scripts/proj/APPGold_20190221.tar
mv /oracle/admin/scripts/proj/appgold /oracle/admin/scripts/proj/$DBFSNM
cd /oracle/admin/scripts/proj/$DBFSNM

### Replace appgold with rvkapp with associated GG instance
find . -name '*appgold*' -exec bash -c ' mv $0 ${0/\appgold/$DBFSNM}' {} \;

### Replace APPNM, GG_INST and GG_LOC in ggini file
sed -i "s/APPNM=?????/APPNM=$DBFSNM/g" *ggini
sed -i "s/GG_INST=?????/GG_INST=$GGINST/g" *ggini
sed -i "s/GG_LOC=?????/GG_LOC=$GGLOC/g" *ggini

## Replace string "ggini" file location in all function scripts
sed -i "s/appgold\/appgold.ggini/$DBFSNM\/$DBFSNM.ggini/g" *.ksh

### Replace mount config file
sed -i "s/appgold/$DBFSNM/g" mount*
sed -i "s/DBFSGOLD/$DBNAME/g" mount*conf

-- Scripts to execute in ONE Instance on RDBMS

. /oracle/admin/scripts/proj/$DBFSNM/$DBFSNM.ggini

### Create Service on Standby, execute on one node of each cluster (Primary and Standby)

$PROJDIR/dbfs_cr_svc_parm_"$APPNM"_fn.ksh $DBNAME $DBFSNM $DBINSTLST

### Add resource executed one node of each cluster (Primary and Standby)

$PROJDIR/crs_add_res_dbfs_parm_"$APPNM"_fn.ksh $DBFSNM $DBNAME $PROJDIR

### Add dbfs mount to GoldenGate instance, executed one node of each cluster (Primary and Standby)

$PROJDIR/xag_add_proj_fs_parm_"$APPNM"_fn.ksh $GGINST $DBFSNM $DBNAME

xag_add_proj_fs_parm_appgold_fn.ksh

#!/usr/bin/ksh

##########################################################################
##### This function creates tablespace and username                  #####
##### Parameter :                                                    #####
#####   gginst : GoldenGate Instance for the application             #####
#####   dbfsmt : DBFS Mount FS name                                  #####
#####            root dbfs mount directory                           #####
#####   Note : dbfs_ appends to dbfsmt parameter and                 #####
#####          dbfs for GG instance is dbfs_$gginst                  #####
#####                                                                #####
##########################################################################

. /oracle/admin/scripts/ggcommon/gg_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

clear
if [ -n "$1" ]; then
gginst=`echo $1 | tr '[A-Z]' '[a-z]'`
echo "Goldengate Instance " $gginst | tee -a $LOG
else
echo "Missing Goldengate Instance name ... " | tee -a $LOG
exit 1
fi

if [ -n "$2" ]; then
dbfsmt=`echo $2 | tr '[A-Z]' '[a-z]'`
echo "DBFS Mount FS Name " $dbfsmt | tee -a $LOG
else
echo "Missing Mount FS Name parameter ... " | tee -a $LOG
exit 1
fi

if [ -n "$3" ]; then
cdbnm=`echo $3 | tr '[A-Z]' '[a-z]'`
echo "Database Name " $cdbnm  | tee -a $LOG
else
echo "Missing Database Name parameter ... " | tee -a $LOG
exit 1
fi

xag_add_proj_fs $gginst $dbfsmt $cdbnm | tee -a $LOG

appgold.ggini

# Template ggini file to setup environment
# #####################################################################

##############################################################################
###  This file used to create GG Hub ini file                                 #
###  Revision History:                                                        #
###                                                                           #
###  REV   DATE         BY         DESCRIPTION                                #
###  ---  ------  --------------   ------------------------------------------ #
###  1.0  181106  Raju Kakarlapudi Initial Release                            #
###                                                                           #
###  Note : Modify the following variables for each new application           #
###                                                                           #
###  GG_INST      Instance name associated to application                     #
###  ORACLE_HOME  RDBMS Home                                                  #
###                                                                           #
###############################################################################

export TZ=UTC                                      ### Same for all Hub DB Cluster
export APPNM=?????                                 ### App name
export GG_LOC=?????                                ### Location of GG Hub
export GG_INST=?????                               ### GG Instance for app
export XAG_HOME=/oracle/product/xag_91
export CRS_HOME=`cat /etc/oratab|grep -i '^crs'|awk -F:   '{ print $2}'`
export ORACLE_HOME=$(grep $ORACLE_SID":" /etc/oratab |awk -F: '{print $2}')
export PROJDIR=/oracle/admin/scripts/proj/$APPNM
export LOGDIR=$PROJDIR/LOGS

######################################################################
# GGS_HOME
######################################################################
export GGS_HOME=/oracle/product/$GG_INST

######################################################################
# GG_SITE
# This sets the site, future use
######################################################################
#export GG_SITE=06
#export GG_SITE=05
#export GG_SITE=04
#export GG_SITE=03
#export GG_SITE=02
export GG_SITE=01

######################################################################
# LD_LIBRARY_PATH
# This sets the site geography
######################################################################
export LD_LIBRARY_PATH=$ORACLE_HOME/lib/lib/amd64/server:$GGS_HOME:$ORACLE_HOME/lib:$ORACLE_HOME/jdbc/lib:/usr/lib:/usr/ccs/lib:/opt/SUNWspro/lib:/usr/openwin/lib:/usr/ucblib:/usr/dt/lib:$ORACLE_HOME/oracm/lib:

export PATH=$ORACLE_HOME/bin:/oracle/dba/local:/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/ucb:/etc:/usr/sbin:/sbin:/usr/dt/bin:/usr/lpp/X11/bin:/opt/bin:/usr/lbin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin:/opt/STSssh/bin:/oracle/dba/standard:/oracle/dba/standard/rman:/opt/pb/bin:/opt/UDSssh/bin:/banktools:/banktools/local/bin:/opt/SDSssh/bin/scp:/oracle/dba/foglight/script:/usr/openv/netbackup/bin:$GGS_HOME:/opt/VRTSvmsa/bin/vmsa:/banktools/pbrun/3.2/bin:$ORACLE_HOME/bin:$ORACLE_HOME/oracm/bin:$ORACLE_HOME/OPatch:.

# 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=/bin::/ggate01/product/12.1.2/11.2.0/gg_1:/bin:/oracle/dba/local:/usr/local/bin:/usr/bin:/usr/ccs/bin:/usr/ucb:/etc:/usr/sbin:/sbin:/usr/dt/bin:/usr/lpp/X11/bin:/opt/bin:/usr/lbin:/usr/bin/X11:/usr/X11R6/bin:/usr/openwin/bin:/opt/STSssh/bin:/oracle/dba/standard:/oracle/dba/standard/rman:/opt/pb/bin:/opt/UDSssh/bin:/banktools:/banktools/local/bin:/opt/SDSssh/bin/scp:/oracle/dba/foglight/script:/usr/openv/netbackup/bin:/ggate01/product/12.1.2/11.2.0/gg_1:/opt/VRTSvmsa/bin/vmsa:/banktools/pbrun/3.2/bin:/oracle/product/12.1.0/db_1/bin:/oracle/product/12.1.0/db_1/oracm/bin:/oracle/product/12.1.0/db_1/OPatch:.

# Change the prompt
PS1="\\
\${PWD} \\
\${SNAME} [\${ORACLE_SID}] [\${GG_INST}"_"$GG_LOC]-> "
export PS1

# List of alias
#
alias dirprm='cd $GGS_HOME/dirprm'
alias ggcom='cd /oracle/admin/scripts/ggcommon'
alias dbfsdir='cd /oracle/admin/scripts/dbfscommon'
alias projscr='cd /oracle/admin/scripts/proj/$APPNM'
alias projlog='cd $LOGDIR'
alias ggdir='cd $GGS_HOME'

###### Check scripts curr
alias ggcmd='. /oracle/admin/scripts/ggcommon/sho_gg_cmds_fn.ksh'
alias ggdbr='. /oracle/admin/scripts/ggcommon/gg_init_fn.ksh'
alias showsrv='. /oracle/admin/scripts/ggcommon/sho_srv_fn.ksh'

##### The following two scripts need testing
alias dbfs_lob='. /oracle/admin/scripts/dbfscommon/dbfs_sho_lob_fn.ksh'
alias dbfscmd='. /oracle/admin/scripts/dbfscommon/sho_dbfs_cmds_fn.ksh'

echo "GGS_HOME is : " $GGS_HOME

echo
echo
echo

mount_dbfs_appgold.bsh

#!/bin/bash

### 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
### The start has been modified to work with BOA environment

###############################################
# mount-dbfs.bsh start / stop / check / status
###############################################
#####################################################################
##### Raju Kakarlapudi Notes                                    #####
##### Modify the following as per the requirements              #####
#####                                                           #####
##### CONFIG : Location of mount-dbfs_xxx.conf file             #####
##### nohup dbfs_client command                                 #####
##### nohup $ORACLE_HOME/bin/dbfs_client db_user/passws@conn_string -o $MOUNT_OPTIONS /dbfs_filesystem < passwd_filepath &
##### It's recommended to create password file in same location #####
##### of mount scripts                                          #####
##### DO NOT CHANGE PASSWORD file location                      #####
##### /oracle/admin/scripts/clle_dbfscommon/.gg_password i      #####
##### db_user/passwsd@conn_string                               #####
##### dbfs_filesystem                                           #####
#####     ***  DO NOT CHANGE MOUNT_OPTIONS  ***                 #####
#####                                                           #####
#####################################################################

###########################################
### 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
##############################################################

echo "not4good" > /tmp/.dbfs-passwd_appgold
echo "not4good" > /oracle/admin/scripts/proj/appgold/.gg_password_appgold

CONFIG=/oracle/admin/scripts/proj/appgold/mount-dbfs_appgold.conf

export GRID_HOME=`cat /etc/oratab|grep -i '^crs'|awk -F:   '{ print $2}'`
export ORACLE_HOME=$(grep $ORACLE_SID":" /etc/oratab |awk -F: '{print $2}')

echo $ORACLE_HOME
echo $GRID_HOME

###########################################
### 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 numa 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 dbfs_appgold/not4good@dbfs_appgold -o $MOUNT_OPTIONS /dbfs_appgold < /oracle/admin/scripts/proj/appgold/.gg_password_appgold &

#     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
# 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 (fusermount -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

mount-dbfs_appgold.conf

### This file provides configuration for mount-dbfs.sh.
### Note 1054431.1 provides information about the setup required to use this script

############################################################################
#####              Everyone must set these values                      #####
############################################################################
##### Raju Kakarlapudi Notes ###############################################
##### Modify the following as per the requirements                     #####
#####                                                                  #####
##### DBNAME            : DB Name where DBFS filesystem exists         #####
##### MOUNT_POINT       : mount name                                   #####
##### DBFS_USER         : dbfs username/password                       #####
##### ORACLE_HOME       : RDBMS Oracle Home                            #####
##### GRID_HOME         : CRS Home                                     #####
##### MOUNT_TNS         : TNS names for mount                          #####
##### *** Note password is used for ALL mounts for ease of support *** #####
##### DBFS_PASSWD       : Common for all dbfs not4good                 #####
##### DBFS_PWDFILE_BASE : password file location                       #####
#####    Ex: /tmp/.dbfs-passwd_app                                     #####
#####                                                                  #####
##### Note: Not using wallet and PDBs                                  #####
#####     ***  DO NOT CHANGE MOUNT_OPTIONS  ***                        #####
#####                                                                  #####
###########################################################################
#
### Database name for the DBFS repository as used in "srvctl status database -d $DBNAME"
### If using PDB/CDB, this should be set to the CDB name
# DBNAME=fsdb
DBNAME=DBFSGOLD

### Mount point where DBFS should be mounted
# MOUNT_POINT=/dbfs_direct
MOUNT_POINT=/dbfs_appgold

### Username of the DBFS repository owner in database $DBNAME
# DBFS_USER=dbfs_user
DBFS_USER=dbfs_appgold/not4good

### RDBMS ORACLE_HOME directory path
# ORACLE_HOME=/u01/app/oracle/product/12.1.0.2/dbhome_1
ORACLE_HOME=/oracle/product/12.1.0/db_1

### GRID HOME directory path
# GRID_HOME=/u01/app/12.1.0.2/grid
GRID_HOME=/oracle_crs/product/12.1.0.2/crs_1

### Syslog facility name (default user)
### Changed default from local3 to user for Solaris default support on 17-FEB-2012
### This will allow us to log messages to the syslog
###  (/var/log/messages on Linux, /var/adm/messages on Solaris)
LOGGER_FACILITY=user

### mount options for dbfs_client; these are used for both wallet and non-wallet mounting
# MOUNT_OPTIONS=allow_other,direct_io
# Last working parameter
# MOUNT_OPTIONS=rw,direct_io
MOUNT_OPTIONS=allow_other,rw,direct_io,failover

# M Culp / M Bowen 08/09/2018
# This env variable was created for the following purpose
# This is used on the start section in the script to point to the
# tnsnames.ora entry for the dbfs mount
# the entry should be on all nodes where the mount could exist
# #############################################################################
MOUNT_TNS=dbfs_appgold

### if tracing is required, maybe consider parameter like the example below
### following example is commented out, only uncomment if directed by Oracle Support
#
### for 11.2.0.3 and earlier, fix_control=32 added per bug 13340960 to allow async statfs response
#MOUNT_OPTIONS=allow_other,direct_io,fix_control=32,trace_level=1,trace_file=/tmp/dbfs_client_trace.$$.log,trace_size=100
#
### for 11.2.0.4 and later, remove fix control
#MOUNT_OPTIONS=allow_other,direct_io,trace_level=1,trace_file=/tmp/dbfs_client_trace.$$.log,trace_size=100

### PERL_ALARM_TIMEOUT is number of seconds to wait for response from status command.
### After this, if no respnose, the script will run clean.
### NOTE: If this is longer than the clusterware check interval, bad things may happen.
###       Adjust the CHECK_INTERVAL to ensure it is at least 2x as long as PERL_ALARM_TIMEOUT.
###       Example:
###       $ crsctl status res dbfs_mount -p|grep ^CHECK
###       CHECK_INTERVAL=30
###       $ crsctl modify res dbfs_mount -attr "CHECK_INTERVAL=32"
###       $ crsctl status res dbfs_mount -p|grep ^CHECK
###       CHECK_INTERVAL=32
PERL_ALARM_TIMEOUT=14

###########################################
### If using password-based authentication, set these
###########################################
### This is the plain text password for the DBFS_USER user
# DBFS_PASSWD=welcome1
DBFS_PASSWD=not4good

### The file used to temporarily store the DBFS_PASSWD so dbfs_client can read it
### This file is removed immediately after it is read by dbfs_client
### The actual filename used will have the PID appended to the name for uniqueness
### This variable should be a full pathname including a directory and the first part of a filename.
#
DBFS_PWDFILE_BASE=/tmp/.dbfs-passwd_appgold

###########################################
### If using wallet-based authentication, modify these
###########################################
### WALLET should be true if using a wallet, otherwise, false
WALLET=false

### TNS_ADMIN is the directory containing tnsnames.ora and sqlnet.ora used by DBFS
TNS_ADMIN=$ORACLE_HOME/network/admin

### TNS alias used for mounting with wallets
DBFS_LOCAL_TNSALIAS=fsdb.local

###########################################
### If using PDBs, modify these
###########################################
### Configure the following if this is a Pluggable Database (PDB)
### IS_PDB should be set to "true" or "false"
### PDB should be a TNS alias defined per instructions in Note 1054431.1.
### PDB_SERVICE should be a cluster database service defined per
###   instructions in Note 1054431.1.
IS_PDB=false
PDB=pdbXX
PDB_SERVICE=dbfspdb




dbfs_cr_objs_parm_appgold_fn.ksh

#!/usr/bin/ksh

##########################################################################
##### This function creates DBFS objects in USER Schema              #####
##### Parameter :                                                    #####
#####   dbfsts : DBFS Tablespace Name                                #####
#####   usernm : Username to connect and execute                     #####
#####            $ORACLE_HOME/rdbms/admin/dbfs_create_filesystem.sql #####
#####   Note : dbfs_ appends to dbfsts (Tablespace name) parameter   #####
#####                                                                #####
##########################################################################

. /oracle/admin/scripts/dbfscommon/dbfs_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

clear
if [ -n "$1" ]; then
   dbfsts=`echo $1 | tr '[A-Z]' '[a-z]'`
   echo "DBFS Tablespace name " $dbfsts | tee -a $LOG
else
   echo "Missing DBFS Tablespace parameter ... " | tee -a $LOG
   exit 1
fi

if [ -n "$2" ]; then
   usernm=`echo $2 | tr '[a-z]' '[A-Z]'`
   echo "DBFS USERNAME  " $usernm  | tee -a $LOG
else
   echo "Missing username ... " | tee -a $LOG
   exit 1
fi

echo
echo "Create objects for dbfs ...." | tee -a $LOG
echo
dbfs_cr_objs_parm $dbfsts $usernm | tee -a $LOG




dbfs_cr_tnsname_appgold_fn.ksh

#!/usr/bin/ksh

###########################################################
##### This function added entry into tnsnames.ora in  #####
##### ORACLE_HOME/network/admin                       #####
##### Parameter :                                     #####
#####   cscan : Cluster SCAN Name                     #####
#####                                                 #####
###########################################################

. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

if [ -n "$1" ]; then
   cscan=`echo $1 | tr '[a-z]' '[A-Z]'`
   echo "Cluser SCAN Nmae    " $cscan | tee -a $LOG
else
   echo "Missing Cluster SCAN Name parameter ... " | tee -a $LOG
   exit 1
fi

TMPFILE=/tmp/dbfs_$APPNM_tns.txt

echo $TMPFILE
echo $CDATE

echo "Copying current tnsname.ora file ..." | tee -a $LOG
/usr/bin/cp $ORACLE_HOME/network/admin/tnsnames.ora $ORACLE_HOME/network/admin/tnsnames.ora_$CDATE_$APPNM

echo " " > $TMPFILE
echo "dbfs_$APPNM = " >> $TMPFILE
echo "   (DESCRIPTION = " >> $TMPFILE
echo "     (ADDRESS = (PROTOCOL = TCP)(HOST = $cscan)(PORT = 49125)) " >> $TMPFILE
echo "     (CONNECT_DATA = (SERVER = DEDICATED)(SERVICE_NAME = dbfs_$APPNM.bankofamerica.com))) " >> $TMPFILE
echo " " >> $TMPFILE
echo " " >> $TMPFILE

cat $TMPFILE | tee -a $LOG
cat $TMPFILE >> $ORACLE_HOME/network/admin/tnsnames.ora

$ORACLE_HOME/bin/tnsping dbfs_$APPNM | tee -a $LOG


dbfs_cr_mnt_pnt_parm_appgold_fn.ksh

#!/usr/bin/ksh

###########################################################
##### This function need to run as root on all nodes  #####
##### creates dbfs directory at / and chown           #####
##### Note: function prefix "dbfs_" to parameter      #####
#####                                                 #####
###########################################################

. /oracle/admin/scripts/dbfscommon/dbfs_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

if [ -n "$1" ]; then
   mntpnt=`echo $1 | tr '[A-Z]' '[a-z]'`
   echo "New dbfs mount name " $mntpnt | tee -a $LOG
else
   echo "Missing Mountpint Name parameter ... " | tee -a $LOG
   exit 1
fi

clear
echo
echo "Create mountpoint for $APPNM ....." | tee -a $LOG
echo

dbfs_cr_mnt_pnt $mntpnt | tee -a $LOG





dbfs_cr_svc_parm_appgold_fn.ksh


#!/usr/bin/ksh

###########################################################
##### This function creates service for dbfs mount    #####
##### Parameter :                                     #####
#####     cdbnm : Database Name                       #####
#####     svcnm : Service Name                        #####
#####   prfinst : List preferred Inst name in ","     #####
#####   avlinst : List available Inst name (Optional) #####
#####                                                 #####
###########################################################

. /oracle/admin/scripts/dbfscommon/dbfs_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

clear

if [ -n "$1" ]; then
   cdbnm=`echo $1 | tr '[a-z]' '[A-Z]'`
   echo "Database Name " $cdbnm  | tee -a $LOG
else
   echo "Missing Database Name parameter ... " | tee -a $LOG
   exit 1
fi

if [ -n "$2" ]; then
   svcnm=`echo $2 | tr '[A-Z]' '[a-z]'`
   echo "Service Name  " $svcnm | tee -a $LOG
else
   echo "Missing Service Name parameter ... " | tee -a $LOG
   exit 1
fi

if [ -n "$3" ]; then
   prfinst=`echo $3 | tr '[a-z]' '[A-Z]'`
   echo "List of Preferred instance(s) " $prfinst | tee -a $LOG
else
   echo "Missing preferred instnace parameter ... " | tee -a $LOG
   exit 1
fi

avlinst=$4

echo
echo
echo
dbfs_cr_svc $cdbnm $svcnm $prfinst $avlinst | tee -a $LOG





#!/usr/bin/ksh

###########################################################
##### This function creates tablespace and username   #####
##### Parameter :                                     #####
#####   usernm : Username                             #####
#####   tblsnm : Tablespace Name                      #####
#####   inttsz : Initial tablespace size              #####
#####   toltsz : Total tablespace size                #####
#####                                                 #####
###########################################################


. /oracle/admin/scripts/dbfscommon/dbfs_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

clear
if [ -n "$1" ]; then
   usernm=`echo $1 | tr '[a-z]' '[A-Z]'`
   echo "Username " $usernm | tee -a $LOG
else
   echo "Missing Username parameter ... " | tee -a $LOG
   exit 1
fi

if [ -n "$2" ]; then
   inttsz=`echo $2 | tr '[a-z]' '[A-Z]'`
   echo "Initial Tablespace size " $inttsz | tee -a $LOG
else
   echo "Missing Initial Tablespace size  parameter ... " | tee -a $LOG
   exit 1
fi

if [ -n "$3" ]; then
   toltsz=`echo $3 | tr '[a-z]' '[A-Z]'`
   echo "Total Tablespace size " $toltsz | tee -a $LOG
else
   echo "Missing Total Tablespace size  parameter ... " | tee -a $LOG
   exit 1
fi

echo
echo "Create tablespace and user for dbfs ....." | tee -a $LOG
echo "Script creates tablespace and user names are same"
echo
dbfs_cr_tblspusr $usernm $usernm $inttsz $toltsz | tee -a $LOG





crs_add_res_dbfs_parm_appgold_fn.ksh

#!/usr/bin/ksh

##########################################################################
##### This function adds DBFS mount to cluster resource              #####
##### Parameter :                                                    #####
#####    dbfsts : DBFS mount name without dbfs_ prefix               #####
#####    cdbnam : Database name                                      #####
#####   projscr : mount script name with full path                   #####
##### Note : dbfs_ appends to dbfsts (Tablespace name) parameter     #####
#####                                                                #####
##########################################################################

. /oracle/admin/scripts/crsdbfs/crs_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

clear
if [ -n "$1" ]; then
   dbfsts=`echo $1 | tr '[A-Z]' '[a-z]'`
   echo "DBFS mount name " $dbfsts | tee -a $LOG
else
   echo "Missing DBFS Mount parameter ... " | tee -a $LOG
   exit 1
fi

if [ -n "$2" ]; then
   cdbnam=`echo $2 | tr '[A-Z]' '[a-z]'`
   echo "Database Name " $cdbnam | tee -a $LOG
else
   echo "Missing Database Name parameter ... " | tee -a $LOG
   exit 1
fi

if [ -n "$3" ]; then
   projscr=`echo $3 | tr '[A-Z]' '[a-z]'`
   echo "Mount Script Directory path " $projscr | tee -a $LOG
else
   echo "Missing Mount script Directory ... " | tee -a $LOG
   exit 1
fi


crs_res_stat $dbfsts | tee -a $LOG

crs_res_add_dbfs $dbfsts $cdbnam $projscr | tee -a $LOG

crs_res_stat $dbfsts | tee -a $LOG




dbfs_cr_mount_passwd_appgold.ksh

#!/usr/bin/ksh

. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

if [ -f $PROJDIR/.gg_password_$APPNM ]; then
   echo
   echo "Mount script password file exists validate password " | tee -a $LOG
   cat $PROJDIR/.gg_password_$APPNM | tee -a $LOG
else
  echo
  echo "Create new password file "$PROJDIR/.gg_password_$APPNM | tee -a $LOG
  echo "not4good" > $PROJDIR/.gg_password_$APPNM | tee -a $LOG
  echo
fi

if [ -f /tmp/.dbfs_passwd_$APPNM ]; then
   echo
   echo "Temp  password file exists validate password " | tee -a $LOG
   cat /tmp/.dbfs_passwd_$APPNM | tee -a $LOG
else
  echo
  echo "Create new password file "/tmp/.dbfs_passwd_$APPNM | tee -a $LOG
  echo "not4good" > /tmp/.dbfs_passwd_$APPNM | tee -a $LOG
  echo
fi




xag_relo_ggtxd003_appgold_parm_fn.ksh



#!/usr/bin/ksh

###########################################################
##### This function relocate GG Instance all dbfs     #####
##### mount associated with GG Instance               #####
##### Parameter :                                     #####
#####    gginst : GoldenGate Instance name            #####
#####    ggnode : Target node to relocate             #####
#####    appnam : Application name                    #####
#####                                                 #####
##### Script checks current GG inst node and pause    #####
##### for user input Y|y                              #####
###########################################################

. /oracle/admin/scripts/ggcommon/gg_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

clear
if [ -n "$1" ]; then
   gginst=`echo $1 | tr '[A-Z]' '[a-z]'`
   echo "GoldenGate Instance :" $gginst | tee -a $LOG
else
   echo "Missing Goldengate Instance name ... " | tee -a $LOG
   exit 1
fi

if [ -n "$2" ]; then
   ggnode=`echo $2 | tr '[A-Z]' '[a-z]'`
   echo "GG Relocate Target  :" $ggnode | tee -a $LOG
else
   echo "Missing Target node name ... " | tee -a $LOG
   exit 1
fi

if [ -n "$3" ]; then
   appnam=`echo $3 | tr '[A-Z]' '[a-z]'`
   echo "Application Name    :" $appnam | tee -a $LOG
else
   echo "Missing Application name ... " | tee -a $LOG
   exit 1
fi

currnode=`xag_stat $gginst  | grep  "is running" | awk '{print $7}'`
echo "Current GG Node    :" $currnode

if [ $ggnode = $currnode ]; then
   echo " "
   echo " *** PLEASE CHECK TARGET AND CURRENT NODES ARE SAME *** " | tee -a $LOG
   echo " "
   exit 1
fi

echo "Validate Input Parameters, to continue ENTER Y"
read useresp
useresp=`echo $useresp | tr '[a-z]' '[A-Z]'`

if [ $useresp = 'Y' ]; then
    echo "Continue relocate .." | tee -a $LOG

    if [ $APPNM = $appnam ]; then
       xag_relo_prm $gginst $ggnode | tee -a $LOG
    else
       echo "Please check application name and GG Instance " | tee -a $LOG
    fi

else
    echo "STOPPED relocating GoldenGate Instance" | tee -a $LOG
fi




xag_start_ggtxd003_appgold_fn.ksh

#!/usr/bin/ksh

###########################################################
##### This function start GG Instance and mounts      #####
##### associated DBFS with GG Instance                #####
##### Parameter :                                     #####
#####    gginst : GoldenGate Instance name            #####
#####    ggnode : Target node                         #####
#####    appnam : Application name                    #####
#####                                                 #####
##### Script checks current GG inst node and pause    #####
##### for user input Y|y                              #####
###########################################################

. /oracle/admin/scripts/ggcommon/gg_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

clear
if [ -n "$1" ]; then
   gginst=`echo $1 | tr '[A-Z]' '[a-z]'`
   echo "GoldenGate Instance :" $gginst | tee -a $LOG
else
   echo "Missing Goldengate Instance name ... " | tee -a $LOG
   exit 1
fi

if [ -n "$2" ]; then
   ggnode=`echo $2 | tr '[A-Z]' '[a-z]'`
   echo "GG Inst Start Node  :" $ggnode | tee -a $LOG
else
   echo "Missing Target node name ... " | tee -a $LOG
   exit 1
fi

if [ -n "$3" ]; then
   appnam=`echo $3 | tr '[A-Z]' '[a-z]'`
   echo "Application Name    :" $appnam | tee -a $LOG
else
   echo "Missing Application name ... " | tee -a $LOG
   exit 1
fi


currstat=`xag_stat $gginst | grep  "is not running"`
echo "Current GG status   :" $currstat

if [ -z $currstat ]; then
   echo " "
   echo " *** PLEASE CHECK GG Instance is running " `xag_stat $gginst` | tee -a $LOG
   echo " "
   exit 1
fi

echo "Validate Input Parameters, to continue ENTER Y" | tee -a $LOG
read useresp
useresp=`echo $useresp | tr '[a-z]' '[A-Z]'`
echo "User Response " $useresp | tee -a $LOG

if [ $useresp = 'Y' ]; then
    echo "Continue Starting GG Instance and Mount DBFS ..." | tee -a $LOG

    if [ $APPNM = $appnam ]; then
       xag_start_parm $gginst $ggnode | tee -a $LOG
    else
       echo "Please check application name and GG Instance " | tee -a $LOG
    fi

else
    echo "STOPPED Starting GoldenGate Instance" | tee -a $LOG
fi






xag_stop_ggtxd003_appgold_fn.ksh


#!/usr/bin/ksh

###########################################################
##### This function stop GG Instance and unmounts     #####
##### associated DBFS with GG Instance                #####
##### Parameter :                                     #####
#####    gginst : GoldenGate Instance name            #####
#####    appnam : Application name                    #####
#####                                                 #####
##### Script checks current GG inst node and pause    #####
##### for user input Y|y                              #####
###########################################################

. /oracle/admin/scripts/ggcommon/gg_common.ksh
. /oracle/admin/scripts/proj/appgold/appgold.ggini

LOGFILE=`basename $0 .ksh`
CDATE=`date '+%Y%m%d_%H%M%S'`
LOG=$LOGDIR/${LOGFILE}_${CDATE}.log

clear
if [ -n "$1" ]; then
   gginst=`echo $1 | tr '[A-Z]' '[a-z]'`
   echo "GoldenGate Instance :" $gginst | tee -a $LOG
else
   echo "Missing Goldengate Instance name ... " | tee -a $LOG
   exit 1
fi

if [ -n "$2" ]; then
   appnam=`echo $2 | tr '[A-Z]' '[a-z]'`
   echo "Application Name    :" $appnam | tee -a $LOG
else
   echo "Missing Application name ... " | tee -a $LOG
   exit 1
fi


currstat=`xag_stat $gginst`
echo "Current GG status   :" $currstat | tee -a $LOG
isrun=`echo $currstat | awk '{print $5}'`

if [ "$isrun" = "running" ]; then
   echo " "
   echo " *** GG Instance $gginst is running " `xag_stat $gginst` | tee -a $LOG
   echo " "
else
   echo " "
   echo " Goldengate Instance $gginst is NOT running Check the GG Instance parameter " `xag_stat $gginst` | tee -a $LOG
   exit 1
fi

echo "Validate Input Parameters, to continue ENTER Y" | tee -a $LOG
read useresp
useresp=`echo $useresp | tr '[a-z]' '[A-Z]'`
echo "User Response " $useresp | tee -a $LOG

if [ $useresp = 'Y' ]; then
    echo "Continue Stopping GG Instance and unmount DBFS ..." | tee -a $LOG

    if [ $APPNM = $appnam ]; then
       xag_stop $gginst | tee -a $LOG
       sleep 30
       currstat=`xag_stat $gginst`
       isrun=`echo $currstat | awk '{print $5}'`
       echo "2nd current status " $currstat2 | tee -a $LOG
       if [ "$isrun" = "not" ]; then
          echo " Stop CRS Resources for " dbfs_$appnam | tee -a $LOG
          echo $CRS_HOME
          $CRS_HOME/bin/crsctl stop resource dbfs_$appnam | tee -a $LOG
          #### echo "Unmount DBFS filesystem for APP " | tee -a $LOG
          #### dbfs_unmount_parm_fs $appnam | tee -a $LOG
       fi
    else
       echo "Please check application name and GG Instance " | tee -a $LOG
    fi

else
    echo "User Aborted the Stopping GG Instance" | tee -a $LOG
fi



Ready for Action?

LET'S GO!
Copyright 2024 IT Remote dot com
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram