Database Reference
In-Depth Information
# --------------------------------------------------------------------------------------------------
# Calling script must provide the database name as thisSID
# --------------------------------------------------------------------------------------------------
emcli set_credential \
-target_type=oracle_database \
-target_name=${thisSID} \
-credential_set=DBCredsNormal \
-columns="username:dbsnmp;password:${SysmanPassword};role:Normal"
}
function SetUserCredential {
# --------------------------------------------------------------------------------------------------
# This function will execute the SetDBUserCredential from the command line
# --------------------------------------------------------------------------------------------------
# You could supplement the failure logic with a read statement to prompt
# for the database name
# --------------------------------------------------------------------------------------------------
if [ ${#1} -gt 0 ]; then
thisSID=${1}
SetDBUserCredential
else
echo "The database name was not set on the command line"
echo " syntax: SetDBUserCredential [database name]
exit 1
fi
}
Function-Related Shell Scripts
The scripts in this section call or rely on the function described earlier. In each case, the function library is sourced,
input values from the command line are evaluated, and key input parameters needed by the functions are set. Notice
the simplicity of these scripts. All of the “serious” logic exists in the function library, so when a new script is created
you can limit your debugging to just the new code.
Sample Script: emcli_start_blackout.ksh
#!/bin/ksh
# Thus script is written for Korn shell. You must adapt the 'read' statements to use Bash
#
# ==============================================================================
# File: emcli_start_blackout.ksh
# Purpose: Create and initiate an OEM blackout
# Parameters: Database name
# ==============================================================================
# Enter the path to your shell script repository for OEM
FUNCTION_LIB=< Your shared script directory>/emcli_functions.lib
# WORKFILE is one of several file name variables cleaned up by the function library
export WORKFILE=/tmp/create_em_blackout_$PPID.lst
 
Search WWH ::




Custom Search