This is a common library for CRS related items
I created a directory called crsdbfs for it, but crscommon would be better


##############################################################################
# CRS Common functions
# MCulp Sept 2018
# Setting up resources against CRS
##############################################################################
crs_init()
{

echo "set common variables...."

}

crs_inst_order()
{

echo
echo "Function name.: crs_inst_order................."
echo "Library file..: crs_common.ksh................."
echo "Directory ....: /oracle/admin/scripts/crsdbfs.."
echo
echo "Shows the installation order for the CRS services..."
echo

echo "Create a service first for GoldenGate"
echo " function - srvctl_add_svc"
echo " add a resource in CRS for DBFS (crs_add_res_dbfs)......"
echo "   naming is dbfs_ gg instance name.."
echo " start the DBFS resource............."
echo " stop the DBFS resource.............."
echo " status of the resource.............."
echo " relocate the resource..............."
echo " "

}



crs_res_add()
{

crs_add_res_dbfs

}
crs_add_res_dbfs()
##############################################################################
# Add CRS resource to for DBFS
##############################################################################
{

# GoldenGate XAG Instance
# gg_inst=$1

# Database for dependencies
# dbnm=$2

# echo $gg_inst
# echo $dbnm

# exit

# echo
# echo "Adding CRS resource for DBFS dbfs_"$gg_inst
# echo "MAKE SURE THE mount_dbfs script is in place before executing this!!!!"
# echo

# /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl add resource dbfs_${gg_inst} -type cluster_resource 
# -attr "ACTION_SCRIPT=/oracle/admin/scripts/crsdbfs/mount_dbfs_${gg_inst}.bsh, CHECK_INTERVAL=30, RESTART_ATTEMPTS=10, 
# START_DEPENDENCIES='hard(ora.$dbnm.db)pullup(ora.$dbnm.db)',STOP_DEPENDENCIES='hard(ora.$dbnm.db)',SCRIPT_TIMEOUT=300"


# GoldenGate XAG Instance
gg_inst=$1

# Database for dependencies
dbnm=$2

# Project Directory
projdir=$3

echo $gg_inst
echo $dbnm
echo $projscr
echo $projdir/mount_dbfs_$gg_inst.bsh

echo
echo "Function name.: crs_res_add_dbfs..............."
echo "Library file..: crs_common.ksh................."
echo "Directory ....: /oracle/admin/scripts/crsdbfs.."
echo
echo "Creating a CRS resource for DBFS..............."
echo

######################################################################
# Check to see if the .bsh script has been created ...."
######################################################################
if [ ! -f "$projscr/mount_dbfs_$gg_inst.bsh" ]; then
 echo
  echo "The mount script does not exist please create and re-run";
  echo
  exit
else
  echo
  echo "The mount script exists and proceeding with CRS resource create"
  echo
fi

######################################################################
# Check to see if the .conf file has been created ...."
######################################################################
if [ ! -f "$projscr/mount-dbfs_$gg_inst.conf" ]; then
  echo
  echo "The mount conf file does not exist please create and re-run";
  echo
  exit
else
  echo "The mount conf file exists and proceeding with CRS resource create"
fi

echo
echo "Adding CRS resource for DBFS dbfs_"$gg_inst
echo "MAKE SURE THE mount_dbfs script is in place before executing this!!!!"
echo

$CRS_HOME/bin/crsctl add resource dbfs_${gg_inst} -type cluster_resource -attr "ACTION_SCRIPT=$projscr/mount_dbfs_${gg_inst}.bsh, CHECK_INTERVAL=30, RESTART_ATTEMPTS=10, START_DEPENDENCIES='hard(ora.$dbnm.db)pullup(ora.$dbnm.db)',STOP_DEPENDENCIES='hard(ora.$dbnm.db)',SCRIPT_TIMEOUT=300"

# /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl add resource dbfs_${gg_inst} -type cluster_resource -attr "ACTION_SCRIPT=/oracle/admin/scripts/crsdbfs/wrap_mount_dbfs_${gg_inst}.bsh, CHECK_INTERVAL=30, RESTART_ATTEMPTS=10, START_DEPENDENCIES='hard(ora.$dbnm.db)pullup(ora.$dbnm.db)',STOP_DEPENDENCIES='hard(ora.$dbnm.db)',SCRIPT_TIMEOUT=300"

}




crs_res_start()
##################################################################
# for the $1 parm only the name after dbfs_ needs to be specified
# Start the dbfs resource
##################################################################
{

dbfsmnt=$1
nodename=$2

clear
echo
echo "Start DBFS resource...."
echo

# /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl start resource dbfs_$dbfsmnt -n lrdne67mp
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl start resource dbfs_$dbfsmnt -n $nodename

# /oracle_crs/product/12.1.0.2/crs_1/bin/crsctl status resource dbfs_ggtxd001

echo
echo "Status of DBFS resource...."
echo

crs_stat_res $dbfsmnt

echo
echo "df -hs or /dbfs_ mountpoints ...."
echo

df -ha |grep dbfs_

}

crs_res_stop()
{

dbfsmnt=$1

clear
echo
echo "Stop DBFS resource...."
echo
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stop resource dbfs_$dbfsmnt

echo
echo "Status of DBFS resource...."
echo

crs_stat_res $dbfsmnt

echo
echo "df -hs or /dbfs_ mountpoints ...."
echo

df -ha |grep dbfs_

}

crs_stat_res()
#########################################
# Resource status
#########################################
{

gg_inst=$1

/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl status resource dbfs_$gg_inst

}

crs_res_relo()
#########################################
# Resource relocate
#########################################
{

gg_inst=$1
to_node=$2

/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl relocate resource dbfs_$gg_inst -node $to_node

}

crs_res_del()
#########################################
# Delete DBFS resource
#########################################
{

gg_inst=$1

/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl delete resource dbfs_$gg_inst

}

crs_stat()
{

###########################################################################################
# The difference on the crs_stat is the directory mismatch on the TX vs VA cluster pair
# Directory needed for TX cluster is 12.1.0.2
###########################################################################################

###########################################################################################
# This should be in the ggini file in order to drive the correct directory for all standard
# scripts
###########################################################################################

bindir="12.1.0.2"

echo
echo "crsctl stat res -t...."
echo
/oracle_crs/product/$bindir/crs_1/bin/crsctl status resource -t

echo
echo "Show services from the resource list...."
echo
/oracle_crs/product/$bindir/crs_1/bin/crsctl status resource -t|grep -a1 .svc

echo
echo "If nothing shows here, there are no dbfs mounts ......"
echo
df -ha|grep dbfs

}

crs_stat_xag()
{

gg_inst=$1

echo
echo "XAG Instance name is $gg_inst / crsctl stat res xag.$gg_inst.goldengate -p all parameters ...."
echo

# /oracle_crs/product/$bindir/crs_1/bin/crsctl stat res xag.ggtxd001.goldengate -p
/oracle_crs/product/$bindir/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p

}

crs_stat_xag_det()
{

bindir="12.1.0.2"

gg_inst=$1

echo
echo "XAG Instance name is $gg_inst / crsctl stat res xag.$gg_inst.goldengate -p specific parameters ...."
echo

/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep DATAGUARD_AUTOSTART
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep DB_SERVICES
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep START_DEP
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep STOP_DEP
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep HOSTING
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep FILESYST
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep GG_HOME
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep PLACEMENT
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep USE_LOCAL_SERVICES
/oracle_crs/product/12.1.0.2/crs_1/bin/crsctl stat res xag.$gg_inst.goldengate -p |grep RELOCATE

}

srvctl_add_svc()
{

gg_inst=$1
dbnm=$2
pfd=$3
avl=$4

echo
echo "SRVCTL add service for svc_$gg_inst when role is primary..."
echo "This adds a GoldenGate resource thru SRVCTL ..............."
echo "-preferred take an instance name as parameter as does -available"
echo

echo
echo "Showing services database "$dbnm
echo
srvctl config service -db $dbnm|grep "Service "

echo
echo "Adding service svc_"$gg_inst
echo
# srvctl add service -db $dbnm -service svc_$gg_inst -role PRIMARY -preferred DBFSXD011 -available DBFSXD012
srvctl add service -db $dbnm -service svc_$gg_inst -role PRIMARY -preferred $pfd -available $avl

# srvctl add service -db $dbnm -service svc_$gg_inst -preferred $pfd -available $avl

echo
echo "Showing services database "$dbnm
echo
srvctl config service -db $dbnm|grep "Service "

}

srvctl_sho_svc()
{

dbnm=$1

clear
echo
echo "Showing services database "$dbnm
echo
srvctl config service -db $dbnm|grep "Service "

}

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