gi_common.ksh


##########################################################
#
# MCulp 06/2019
# gi_common.ksh
# Author: Michael Culp mike.culp@gmail.com
#       : 864-630-2118
#
##########################################################

gi_init()          # Set parameters here for other functions to use
{

clear
echo
echo "Test..."
echo
GRID_HOME=/manh/oracle_crs/product/18.1.0/crs_1a

}


gi_net_test()
{

scnm=$1

clear
echo
echo "Testing "$scnm" 6 times"
echo

# nslookup fadmanh18-scan
nslookup $scnm
nslookup $scnm
nslookup $scnm
nslookup $scnm
nslookup $scnm
nslookup $scnm

#ping 10.0.0.22
#ping 10.0.0.40
#ping 10.0.0.61


}


gi_cr_dirs()
###########################################
# Execute as root
###########################################
{

echo
echo "Creating directories applicable for RAC 18c..."
echo

# Create grid dirs

# Inventory location
mkdir -p /manh/oraInventory

# mkdir -p /u01/app/18.0.0/grid
mkdir -p /manh/18.0.0/grid

# mkdir -p /u01/app/grid
mkdir -p /manh/grid

# mkdir -p /u01/app/oracle
mkdir -p /manh/oracle

# This for the GRID software
mkdir -p /manh/oracle_crs/product/18.1.0/crs_1a
mkdir -p /manh/oracle_crs/product/18.1.0/crs_1b

# This for the DB software
mkdir -p /manh/oracle/product/18.4.0/db_1a
mkdir -p /manh/oracle/product/18.4.0/db_1b

# chown -R grid:oinstall /u01
chown -R grid:oinstall /manh

# chown oracle:oinstall /u01/app/oracle
chown -R oracle:oinstall /manh/oracle

# chmod -R 775 /u01
chmod -R 775 /manh

echo
echo "Directories created...."
echo

}

gi_cpy_rsp_fl()
{

echo
echo "test cp..."
echo

cp /ora01/Oracle_SW/fd_response_files/fd_fadmanh_180_grid_setup.rsp /manh/oracle_crs/product/18.1.0/crs_1a/install/response
chown grid:oinstall /manh/oracle_crs/product/18.1.0/crs_1a/install/response/fd_fadmanh_180_grid_setup.rsp

}

gi_inst()
##########################################################
# Install GRID via response file
##########################################################
{

GRID_HOME=/oracle_crs/

# Copy response file to Grid installation folder
cp /ora01/Oracle_SW/fd_response_files/fd_fadmanh_180_grid_setup.rsp /manh/oracle_crs/product/18.1.0/crs_1a/install/response

chown grid:oinstall /manh/oracle_crs/product/18.1.0/crs_1a/install/response/fd_fadmanh_180_grid_setup.rsp

# Set GRID_HOME first in gi_init or
# here before executing

cd $GRID_HOME

unset ORACLE_BASE
cd /manh/oracle_crs/product/18.1.0/crs_1a


$GRID_HOME/gridSetup.sh -silent -responseFile /ora01/Oracle_SW/fd_response_files/fd_fadmanh_180_grid_setup.rsp

# Install Grid software
$GRID_HOME/gridSetup.sh -silent -responseFile /manh/oracle_crs/product/18.1.0/crs_1a/install/response/fd_fadmanh_180_grid_setup.rsp

}

gi_extr_sw_fn()
#####################################################
# unzip the distribution files
#####################################################
{

# Could do this next in one step
# gi_cr_dirs

unzip -u -o /ora01/Oracle_SW/gi180/LINUX.X64_180000_grid_home.zip -d /manh/oracle_crs/product/18.1.0/crs_1a
chown -R grid:oinstall /manh/oracle_crs/product/18.1.0/crs_1a

}

gi_deinst()
############################################################
# Login as grid
############################################################
{

cd /manh/oracle_crs/product/18.1.0/crs_1a/deinstall
./deinstall

rm -fr /manh/oraInventory
rm /etc/oraInst.loc

}

gi_symlink()
############################################################
# Create symlinks to bounce between versions
# use crs_1 to install
############################################################
{

ln -s /manh/oracle_crs/product/18.1.0/crs_1a /manh/oracle_crs/product/18.1.0/crs_1

ln -s /manh/oracle_crs/product/18.1.0/crs_1a /manh/oracle_crs/product/18.1.0/crs_1

tar -cvf

}


gi_cv_hwos()
###############################################
# Cluster Verify Network Verification
# su to grid user prior to run
# Can run as the oracle user
###############################################
{

#
ndlist=$1

echo
echo "Cluster verify output..."
echo "Nodes : "$ndlist
echo

cd /ora01/Oracle_SW/gi180
# ./runcluvfy.sh stage -post hwos -n fd-dcomsdev1t,fd-dcomsdev2t -verbose > hwos.log
# ./runcluvfy.sh stage -post hwos -n fd-dcomsdev1t,fd-dcomsdev2t -verbose
./runcluvfy.sh stage -post hwos -n $ndlist -verbose

}


gi_cv_crsinst()
{

#
ndlist=$1

echo
echo "Cluster verify output...pre crsinst...."
echo "Nodes : "$ndlist
echo

cd /ora01/Oracle_SW/gi180
# ./runcluvfy stage -pre crsinst -n fd-dcomsdev1t,fd-dcomsdev2t -verbose
./runcluvfy.sh stage -pre crsinst -n $ndlist -verbose

}