oracle basic Linux Commands
Oracle_Sid from process:
ps -ef| grep pmon | grep -v grep | awk "{ print $8 }" | cut -d "_" -f3
Oracle_home from oratab:
grep "$ORACLE_SID" /etc/oratab | grep -v "^#"| cut -f2 -d: -s | awk '!seen[$0]++'
reading oracle_sid from file and setting oracle sid and oracle home:
for hm in $(cat ${1}/backup/DB_instance)
do
export ORACLE_SID=$hm
export ORACLE_HOME=`grep "$hm" /etc/oratab | grep -v "^#"| cut -f2 -d: -s | awk '!seen[$0]++'`
export PATH=$ORACLE_HOME/bin:$PATH
DB_NAME=`echo $ORACLE_SID | sed "s/*[0-9]//g" | sed "s/[0-9]*//g"`
reading only last word in path:
file_name=`cat ${1}/patches/patches_list | grep ${version} | grep -v "p688*"`
filename=`basename $file_name`
running shell script using sudo command:
FUNC1=$(declare -f Opatch_update)
sudo su root bash -c "$FUNC1; Opatch_update $LOGS $hosts"
FUNC=$(declare -f DB_details)
ssh $hosts "bash -c '$FUNC; DB_details $LOGS $hosts'"
FUNC2=$(declare -f Opatch_analyze)
ssh -t $host "sudo su root bash -c '$FUNC2; Opatch_analyze $LOGS $host'"
Comments
Post a Comment