#!/bin/ksh
#############################################################################
#                                                                           #
#   FILENAME:  util_common.ksh                                              #
#   LOCATION:  /oracle/admin/scripts/utilcommon                             #
#                                                                           #
#                      *** DO NOT MODIFY THIS FILE ***                      #
#           IF YOU NEED A CHANGE TO THIS FILER                              #
#              CONTACT : Raju Kakarlapudi or Michael Culp                   #
#############################################################################
#                                                                           #
#  Revision History:                                                        #
#                                                                           #
#  REV   DATE         BY           DESCRIPTION                              #
#  ---  --------  ---------------- ---------------------------------------- #
#  1.0  01252019  Raju Kakarlapudi Common GG Hub help functions scripts     #
#  1.1  01252019  Michael Culp     Common GG Hub help functions scripts     #
#                                                                           #
#############################################################################

# Environment Variables
#####################################################################
export TZ=UTC
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}')


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

# ASM

# GoldenGate common diagnostics functions
##############################################################
# sho_utl_list
# sho_swinv
# sho_hub_envinv
# sho_scan
# sho_assigned_ports - This is a text file of the assignment from GG Hub team
# sho_dev_dirs
# sho_copy

sho_utl_list ()          # List all functions in diag_common.ksh
{

clear
echo
echo
echo

/bin/grep "() " /oracle/admin/scripts/utilcommon/util_common.ksh | /bin/grep -v "*.ksh"

}


sho_swinv ()             # Show GoldenGate Software inventory on the host
{

GG_HOME=/oracle/product
DIRLST=/tmp/orapddir.lst
LOG_FILE=/tmp/ggversion.txt
OUT_HOME=/tmp/outhome.txt
OUT_NOHOME=/tmp/outnohome.txt

ls -d ${GG_HOME}/* | grep "gg*" | grep -v "xag*" | grep -v "ms*"  > $DIRLST

echo $'\t' "GG Home " $'\t\t\t\t'  "GG Version" > ${OUT_HOME}
cat $DIRLST | while read LINE
do

SUB3=`echo $LINE | awk '{print substr($1,19,1)}'`

  if [ ${SUB3} != 1 ]; then

     if [ -f ${LINE}/ggsci ]; then
        ggver=`${LINE}/ggsci -v | grep "Version"`
        echo ${LINE} $'\t' ${ggver} >> ${OUT_HOME}
     else
        echo ${LINE} $'\t' "SW is NOT Installed" >> ${OUT_NOHOME}
     fi

  fi

done

rm $DIRLST

if [ -f ${OUT_NOHOME} ]; then
   cat ${OUT_HOME} ${OUT_NOHOME}
   rm ${OUT_HOME} ${OUT_NOHOME}
else
   cat ${OUT_HOME}
   rm ${OUT_HOME}
fi

}

sho_copy()               # Show all of the copy functions /oracle/admin/scripts/cp_common.ksh
{

echo
echo
echo

/bin/grep "()" /oracle/admin/scripts/cp_common.ksh | /bin/grep -v "*.ksh"

}

sho_dev_dirs()           # Show the development script directories
{

echo "Shows the locations of the various libraries used for GG Hub functions"
echo
# dir
clear
echo
echo
echo
echo "      Common Function Libraries...................................................."
echo "==================================================================================="
echo "Copy                            /oracle/admin/scripts/cp_common.ksh................"
echo "Legacy library                  /oracle/admin/scripts/apex/apex_common.ksh........."
echo "ASM                             /oracle/admin/scripts/asmcommon/asm_common.ksh....."
echo "CRS                             /oracle/admin/scripts/crsdbfs/crs_common.ksh......."
echo "DB generic                      /oracle/admin/scripts/dbcommoni/db_common.ksh......"
echo "DBFS                            /oracle/admin/scripts/dbfscommon/dbfs_common.ksh..."
echo "DataGuard                       /oracle/admin/scripts/dgcommon/dg_common.ksh......."
echo "GoldenGate                      /oracle/admin/scripts/ggcommon/gg_common.ksh......."
echo "Diagnostics                     /oracle/admin/scripts/ggdiagcommon/diag_common.ksh."
echo "GoldenGate Source / Dest only   /oracle/admin/scripts/ggsdcommon/gg_sdcommon.ksh..."
echo "GRID Infr                       /oracle/admin/scripts/gicommon/gi_common.ksh......."
echo "Linux Generic                   /oracle/admin/scripts/linux/linux_common.ksh......."
echo "QA GG Hub                       /oracle/admin/scripts/qacommon/qa_common.ksh......."
echo "TAR Backups                     /oracle/admin/scripts/tars........................."
echo "Utility                         /oracle/admin/scripts/utilcommon..................."
echo "==================================================================================="

}

sho_hub_envinv ()        # Lists all GG Host Inventory for all environments
{
clear
echo "sho_hub_eninv func"
echo "Overview of the environment...."
echo
echo "GoldenGate Version 12.2 installed on 21 nodes"
echo
echo "There are currently 7 Clusters / 21 Servers....."
echo "GoldenGate Hub environment......................"
echo
echo "Texas Dev Cluster"
echo
echo "TX DEV  cluster cowhd050-scan"
echo
echo "...lrdne67mp.usrdnwx"
echo "...lrdne67np.usrdnwx"
echo "...lrdne67op.usrdnwx"
echo

echo
echo "Virginia Dev Cluster"
echo
echo "VA DEV  cluster cormd050-scan"
echo
echo "...lrche1de.usrchve.amrs"
echo "...lrche1di.usrchve.amrs"
echo "...lrche1dj.usrchve.amrs"
echo

echo
echo "Texas CLLE Cluster"
echo
echo "TX CLLE cluster corst050-scan"
echo
echo "...lrdne67pp.usrdncu.amrs"
echo "...lrdne67qp.usrdncu.amrs"
echo "...lrdne67rp.usrdncu.amrs"
echo
echo
echo "Pennslyvania Prod Cluster"
echo
echo "PA PROD cluster copap050-scan"
echo
echo "...lltwa0wy.uslttrr.amrs"
echo "...lltwa0wz.uslttrr.amrs"
echo "...lltwa0x0.uslttrr.amrs"
echo

sho_ait_disk

}

sho_ait_disk()           # Show the AIT / Disk allocation as we know it
########################################################
#
########################################################
{

echo
echo "Current AITs in the HUB with Disk Allocated"
echo
echo "Seed disk for initial environment..."
echo
echo "This was the initial GoldenGate Allocation..."
echo
echo "======================================"
echo "AIT# 63505 (old) / 70873 (new) GG Hub "
echo " - OSRF Request #25449"
echo " - Total Environment Size 26TB"
echo
echo " - DEV TEXAS "
echo "======================================"
echo "   (3) Nodes"
echo "      100GB  /oracle "
echo "      100GB  /oracle_crs"
echo
echo "   DEV TX (8)  x 250GB "
echo "   DEV TX (12) x 5GB   "
echo "==========================="
echo
echo " - DEV VIRGINIA "
echo "==========================="
echo "   (3) Nodes"
echo "      100GB  /oracle "
echo "      100GB  /oracle_crs"
echo
echo "   DEV VA (8)  x 250GB "
echo "   DEV VA (12) x 5GB   "
echo "==========================="
echo
echo " - CLLE TEXAS "
echo "==========================="
echo "   (3) Nodes"
echo "      100GB  /oracle "
echo "      100GB  /oracle_crs"
echo
echo "   CLLE TX (8)  x 250GB "
echo "   CLLE TX (12) x 5GB   "
echo "==========================="
echo
echo " - CLLE VIRGINIA "
echo "==========================="
echo "   (3) Nodes"
echo "      100GB  /oracle "
echo "      100GB  /oracle_crs"
echo
echo "   CLLE VA (8)  x 250GB "
echo "   CLLE VA (12) x 5GB   "
echo "==========================="
echo
echo " - PROD TEXAS "
echo "==========================="
echo "   (3) Nodes"
echo "      100GB  /oracle "
echo "      100GB  /oracle_crs"
echo
echo "   PROD TX (24) x 250GB "
echo "   PROD TX (12) x 5GB   "
echo "==========================="
echo
echo " PROD VA "
echo "==========================="
echo "   (3) Nodes"
echo "      100GB  /oracle "
echo "      100GB  /oracle_crs"
echo
echo "   PROD VA (24) x 250"
echo "   PROD VA (12) x 5"
echo "==========================="
echo
echo
echo " PROD PA "
echo "==========================="
echo "   (3) Nodes"
echo "      100GB  /oracle "
echo "      100GB  /oracle_crs"
echo
echo "   PROD PA (24) x 250"
echo "   PROD PA (12) x 5"
echo "==========================="
echo
echo "AIT# 12395 (old) 71296 (new) CICM "
echo " - OSRF Request #27776"
echo " - Total Environment estimate 50TB"
echo
echo "   CLLE TX (66) x 250GB "
echo "   CLLE VA (66) x 250GB "
echo
echo "   PROD TX (42) x 250GB "
echo "   PROD VA (42) x 250GB "
echo "   PROD PA (42) x 250GB "
echo
echo
echo "AIT# 63505 MDX "
echo " - OSRF Request #27779 "
echo " - Total Environment estimate "
echo
echo "   CLLE TX (10) x 250GB "
echo "   CLLE VA (10) x 250GB "
echo
echo "   PROD TX (4) x 250GB "
echo "   PROD VA (4) x 250GB "
echo "   PROD PA (4) x 250GB "
echo
echo
echo "AIT# 71466 FastTrack "
echo " - OSRF Request #28950"
echo " - Total Environment estimate "
echo
echo "   CLLE TX (20) x 250GB "
echo "   CLLE VA (20) x 250GB "
echo
echo "   PROD TX (7) x 250GB "
echo "   PROD VA (7) x 250GB "
echo "   PROD PA (7) x 250GB "
echo
echo
echo "AIT# 58962 OREE "
echo " - OSRF Request #29019"
echo " - Total Environment estimate "
echo
echo "   CLLE TX (30) x 250GB "
echo "   CLLE VA (30) x 250GB "
echo
echo "   PROD TX (15) x 250GB "
echo "   PROD VA (15) x 250GB "
echo "   PROD PA (15) x 250GB "
echo

}

sho_scan()               # Lists all SCAN hostnames for entire Hub environment
#########################################################################
# List SCAN Hostnames for all 7 GG Hub clusters
#########################################################################
{
echo
echo "TX DEV  cluster cowhd050-scan.bankofamerica.com"
echo
echo "VA DEV  cluster cormd050-scan.bankofamerica.com"
echo
echo "TX CLLE cluster corst050-scan.bankofamerica.com"
echo
echo "VA CLLE cluster cormt050-scan.bankofamerica.com"
echo
echo "TX PROD cluster corsp050-scan.bankofamerica.com"
echo
echo "VA PROD cluster cormp050-scan.bankofamerica.com"
echo
echo "PA PROD cluster copap050-scan.bankofamerica.com"
echo

}


##############################################################
# CRS
##############################################################

# DG
##############################################################
# dg_pri_stat - Show the current failover status for the primary instance
# db_role - Show the databases and role on the cluster
# sho_db_svc  - Show database service status
# sho_dbinst_stat -- Show database instance status

db_role ()               # RDBMS Databases and Roles on the cluster, parameter DBNAME  optional
{

echo " "
space="      "

if [ -n "$1" ]; then
   DBNAME=`echo $1 | tr '[a-z]' '[A-Z]'`
   DBROLE=`$ORACLE_HOME/bin/srvctl config database -d $DBNAME | grep "Database role" | awk '{print $3}'`
   echo "Database Name $DBNAME Current DB Role $DBROLE"
   sho_dbinst_stat $DBNAME
else
   for INST in `ps -ef | grep ora_pmon | grep -v "grep" | awk '{print substr($8,10)}'`
      do
       DBNAME=${INST%?}
       DBROLE=`$ORACLE_HOME/bin/srvctl config database -d $DBNAME | grep "Database role" | awk '{print $3}'`
       echo "Database Name $DBNAME Current DB Role $DBROLE"
       ### $ORACLE_HOME/bin/srvctl status database -d $DBNAME
       sho_dbinst_stat $DBNAME
       echo " "
   done

fi
}

sho_db_svc ()            # RDBMS services, parameter service name is optional
{

echo " "

if [ -n "$1" ]; then
   dbname=`echo $1 | tr '[a-z]' '[A-Z]'`
else
   echo "Database name parameter is required for this function ***  "
fi


if [ -n "$2" ]; then
  svcnm=`echo $2 | tr '[A-Z]' '[a-z]'`
  $ORACLE_HOME/bin/srvctl status service -d $dbname -s $svcnm
else
  svcnm=ALL
  $ORACLE_HOME/bin/srvctl status service -d $dbname
fi

}

sho_dbinst_stat ()       # Database instance status, parameter DBNAME
{

echo " "
if [ -n "$1" ]; then
   dbname=`echo $1 | tr '[a-z]' '[A-Z]'`
else
   echo "Database name parameter is required for this function ***  "
fi

$ORACLE_HOME/bin/srvctl status database -d $dbname

}

sho_db_config ()         # Database configuration and role, parameter DBNAME
{

echo " "
if [ -n "$1" ]; then
   dbname=`echo $1 | tr '[a-z]' '[A-Z]'`
else
   echo "Database name parameter is required for this function ***  "
fi

$ORACLE_HOME/bin/srvctl config database -d $dbname

}

# XAG
##############################################################
### XAG
##############################################################

















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



GG Adapters 12.2

#------------------------------------------------------------------
# HealthCheck for Exadata environment
# Check if RMAN Running & Generate recent RMAN logfiles
# Copy alert logs to common location for review
# Get load average for all hosts
# Get filesystem space in /u01 directory for all hosts
# Get session info for card & deposits, and check if High Number of Active Sessions
# Check FRA space
#-------------------------------------------------------------------

set_parms()
# Set parameters
{ mkdir -p /ora01/tmp/exa_check/logs/rman/proj01
  mkdir -p /ora01/tmp/exa_check/logs/rman/proj02
  mkdir -p /ora01/tmp/exa_check/logs/rman/proj03
  mkdir -p /ora01/tmp/exa_check/logs/alert_logs
  mkdir -p /ora01/tmp/exa_check/logs/fs_space
  export fsdir=/ora01/tmp/exa_check/logs/fs_space
  export aldir=/ora01/tmp/exa_check/logs/alert_logs
  export ldir=/ora01/tmp/exa_check/logs
  export sldir=/ora01/tmp/exa_check/logs/ses_info
  export rldir=/ora01/tmp/exa_check/logs/rman
  export tff=`date +%m%d%y_%H:%M:%S` }


Active-Active replication allows databases actively receive transactions when their data are synchronized by the data replication. The implementation enables you to provide [3]:

Implementing an effective active-active replication configuration is not easy. It requires thorough considerations. One of the considerations is defining the Conflict Detection and Resolution (CDR) rules. The CDR rule decides what to do when active transactions introduce data conflicts. In this blog, let me use some examples to explain the CDR concept, and show you how to configure CDR using Oracle GoldenGate. 

Information: Oracle GoldenGate starts to provides built-in conflict detection and resolution routines in 11.2 to support bi-directional and multi-master configurations. (Source: Oracle GoldenGate 11.2 Release Notes)

1. What is Conflict Resolution and Detection (CDR)? 
Let's use the following example from the Oracle GoldenGate Administration Guide [1] [2] to explain what CDR is:  

MAP fin.src, TARGET fin.tgt,
​ COMPARECOLS (ON UPDATE ALLEXCLUDING (comment)),
 RESOLVECONFLICT (    UPDATEROWEXISTS, (delta_res_method, USEDELTA, COLS (salary, balance)), (max_res_method, USEMAX (last_mod_time), COLS (address, last_mod_time)),    (DEFAULT, IGNORE));

We can divide the CDR configuration into two parts: the conflict detection and the conflict resolution.

1.1 Conflict Detection
Oracle GoldenGate uses key columns to identity the records and then detects conflicts by comparing the data before and after the transaction updates. You need the following configurations for the conflict detection: 

​In the example, Oracle GoldenGate checks the conflicts of all the UPDATE operations on all but the comment column on the fin.src table.  Why do I get the " WARNING OGG-02180  Table xxx.xxx.xxx will use legacy trail format to support parameter UPDATEBEFORES." message? 
In Oracle GoldenGate 12.3, you would use LOGALLSUPCOLS instead of GETBEFOREUPDATES. You might get the following error message for all of your tables: "WARNING OGG-02180  Table xxx.xxx.xxx will use legacy trail format to support parameter UPDATEBEFORES. "

1.2. Conflict Resolution
Oracle GoldenGate provides REOLVECONFLICT to defines the resolutions for each conflict.  The following is the list of conflicts: 

The following is the list of resolution functions: 

You can refer to the Oracle GoldenGate reference guide for the detailed definitions.

Oracle GoldenGate Conflict Resolution Parameters  

In the example, when updating a record with different value on the target database: 

Best Practices: Avoid Conflict First and Make Resolution Rule as Simple as Possible 
Conflict detection and Resolution operates on each rows of your data. Therefore, it's a significant overhead especially when having millions of row to process. Consequently, you would avoid conflict in the first place by controlling transaction operations in your applications such as using application segregation or using different primary keys in different DBs. Then, you would use the simplest resolution rule such as using a transaction timestamp or relying on trusted sources to overwrite inconsistent data. [3]

​2. CDR Design Strategy 
n summary, there are two typical strategies when implementing CDR: 

3. Example using Oracle GoldenGate Hub for Active-Active Replication
Let's explain how CDR works with the following example.

Oracle GoldenGate provides detailed reports of all the CDR operations. You can find them from the GGCSI command, report file or column-conversion functions. 

Edition-based redefinition (EBR) enables online application upgrade with uninterrupted availability of the application. When the installation of an upgrade is complete, the pre-upgrade application and the post-upgrade application can be used at the same time. Therefore, an existing session can continue to use the pre-upgrade application until its user decides to end it; and all new sessions can use the post-upgrade application. When there are no longer any sessions using the pre-upgrade application, it can be retired. In this way, EBR allows hot rollover from from the pre-upgrade version to the post-upgrade version, with zero downtime.

https://docs.oracle.com/en/database/oracle/oracle-database/12.2/adfns/editions.html#GUID-C213A6AA-5427-4426-80B5-D5301386253E

https://www.oracle.com/database/technologies/high-availability/ebr.html


#!/bin/ksh
# This script assigns the user (CFGADM) that will be used in oracle to access tables in APEX
# M. Culp
# 11/06/2010
# 01/04/2010 Made changes to reflect the LS commands
# 02/03/2010
# This should give access to the user in APEX that this is going against
#  
#######################################################################################################

sqlplus -s "/ as sysdba" <<EOF

grant exempt access policy to cfgadm;
grant sysdba to cfgadm;
grant select_catalog_role to cfgadm;
grant create session to cfgadm;
grant select on DBA_HIST_DATABASE_INSTANCE to cfgadm;
grant select on DBA_HIST_SNAPSHOT to cfgadm;
grant select on DBA_HIST_SNAP_ERROR to cfgadm;
grant select on DBA_HIST_BASELINE to cfgadm;
grant select on DBA_HIST_WR_CONTROL to cfgadm;
grant select on DBA_HIST_DATAFILE to cfgadm;
grant select on DBA_HIST_FILESTATXS to cfgadm;
grant select on DBA_HIST_TEMPFILE to cfgadm;
grant select on DBA_HIST_TEMPSTATXS to cfgadm;
grant select on DBA_HIST_SQLSTAT to cfgadm;
grant select on DBA_HIST_SQLTEXT to cfgadm;
grant select on DBA_HIST_SQL_SUMMARY to cfgadm;
grant select on DBA_HIST_SQL_PLAN to cfgadm;
grant select on DBA_HIST_SQLBIND to cfgadm;
grant select on DBA_HIST_OPTIMIZER_ENV to cfgadm;
grant select on DBA_HIST_EVENT_NAME to cfgadm;
grant select on DBA_HIST_SYSTEM_EVENT to cfgadm;
grant select on DBA_HIST_BG_EVENT_SUMMARY to cfgadm;
grant select on DBA_HIST_WAITSTAT to cfgadm;
grant select on DBA_HIST_ENQUEUE_STAT to cfgadm;
grant select on DBA_HIST_LATCH_NAME to cfgadm;
grant select on DBA_HIST_LATCH to cfgadm;
grant select on DBA_HIST_LATCH_CHILDREN to cfgadm;
grant select on DBA_HIST_LATCH_PARENT to cfgadm;
grant select on DBA_HIST_LATCH_MISSES_SUMMARY to cfgadm;
grant select on DBA_HIST_LIBRARYCACHE to cfgadm;
grant select on DBA_HIST_DB_CACHE_ADVICE to cfgadm;
grant select on DBA_HIST_BUFFER_POOL_STAT to cfgadm;
grant select on DBA_HIST_ROWCACHE_SUMMARY to cfgadm;
grant select on DBA_HIST_SGA to cfgadm;
grant select on DBA_HIST_SGASTAT to cfgadm;
grant select on DBA_HIST_PGASTAT to cfgadm;
grant select on DBA_HIST_RESOURCE_LIMIT to cfgadm;
grant select on DBA_HIST_SHARED_POOL_ADVICE to cfgadm;
grant select on DBA_HIST_SQL_WORKAREA_HSTGRM to cfgadm;
grant select on DBA_HIST_PGA_TARGET_ADVICE to cfgadm;
grant select on DBA_HIST_INSTANCE_RECOVERY to cfgadm;
grant select on DBA_HIST_JAVA_POOL_ADVICE to cfgadm;
grant select on DBA_HIST_THREAD to cfgadm;
grant select on DBA_HIST_STAT_NAME to cfgadm;
grant select on DBA_HIST_SYSSTAT to cfgadm;
grant select on DBA_HIST_SYS_TIME_MODEL to cfgadm;
grant select on DBA_HIST_OSSTAT_NAME to cfgadm;
grant select on DBA_HIST_OSSTAT to cfgadm;
grant select on DBA_HIST_PARAMETER_NAME to cfgadm;
grant select on DBA_HIST_PARAMETER to cfgadm;
grant select on DBA_HIST_WAITCLASSMET_HISTORY to cfgadm;
grant select on DBA_HIST_DLM_MISC to cfgadm;
grant select on DBA_HIST_CR_BLOCK_SERVER to cfgadm;
grant select on DBA_HIST_CURRENT_BLOCK_SERVER to cfgadm;
grant select on DBA_HIST_ACTIVE_SESS_HISTORY to cfgadm;
grant select on DBA_HIST_TABLESPACE_STAT to cfgadm;
grant select on DBA_HIST_LOG to cfgadm;
grant select on DBA_HIST_MTTR_TARGET_ADVICE to cfgadm;
grant select on DBA_HIST_TBSPC_SPACE_USAGE to cfgadm;
grant select on DBA_HIST_SERVICE_NAME to cfgadm;
grant select on DBA_HIST_SERVICE_STAT to cfgadm;
grant select on DBA_HIST_SERVICE_WAIT_CLASS to cfgadm;
grant select on DBA_HIST_SNAPSHOT to cfgadm;
grant select on DBA_SEGMENTS to cfgadm;
grant select on DBA_OUTSTANDING_ALERTS to cfgadm;
grant select on DICTIONARY to cfgadm;
grant select on DBA_REGISTRY to cfgadm;
grant select on DBA_HIST_COMP_IOSTAT to cfgadm;
grant select on DBA_HIST_UNDOSTAT to cfgadm;

grant select on DBA_VIEWS to cfgadm;
grant select on DBA_DB_LINKS to cfgadm;

grant select on DBA_TABLES to cfgadm;

grant select on v_\$session to cfgadm;
grant select on v_\$sqlarea to cfgadm;
grant select on v_\$sql_plan to cfgadm;
grant select on v_\$database to cfgadm;
grant select on v_\$instance to cfgadm;
grant select on v_\$datafile_copy to cfgadm;
grant select on v_\$parameter to cfgadm;
grant select on v_\$spparameter to cfgadm;
grant select on v_\$asm_disk to cfgadm;
grant select on v_\$asm_diskgroup to cfgadm;
grant select on v_\$system_fix_control to cfgadm;
grant select on gv_\$parameter to cfgadm;
grant select on gv_\$event_histogram to cfgadm;
grant select on sysman.BHV_SERVER_DETAILS to cfgadm;
grant select on sysman.MGMT_TARGETS to cfgadm;
grant select on sysman.MGMT_TABLE_SIZES to cfgadm;
grant select on sysman.MGMT_TARGET_CREDENTIALS to cfgadm;

EOF


. /oracle/admin/scripts/tar_common.ksh

tar_create /oracle/admin/scripts/apexcommon_10092018.tar /oracle/admin/scripts/apex


. /oracle/admin/scripts/tar_common.ksh

tar_create /oracle/admin/scripts/clle_dbfscommon_10092018.tar /oracle/admin/scripts/clle_dbfscommon

Light In The Box RFID Tags

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