Monday, February 25, 2008

Instance Information -- Simple Script

# *===============================================================+
# | USAGE
# | instance_info.sh
# |
# |
# +===============================================================+

clear

#================================
#= Variables Declaration=========
#================================

SID=$TWO_TASK
sid=`echo ${SID}|tr "[:upper:]" "[:lower:]"`
SIDC=`echo ${SID}|tr "[:lower:]" "[:upper:]"`
host=`hostname`
xml="${SID}_${host}.xml"
xml_loc=$APPL_TOP/admin
cfile=$CONTEXT_FILE
who=`whoami`
os=`uname`
apps_pwd=`grep password $IAS_CONFIG_HOME/Apache/modplsql/cfg/wdbsvr.app|head -1|awk '{print $3}`

#================================
#= ContextFile Verification =====
#================================

if [[ ! -z $CONTEXT_FILE && -f $CONTEXT_FILE ]]
then
cfile=$CONTEXT_FILE
elif [ -f "${xml_loc}/${xml}" ]
then
cfile=${xml_loc}/${xml}
elif [ -f "${xml_loc}/${SID}.xml" ]
then
cfile=${xml_loc}/${SID}.xml
else
cfile="Autoconfig not Enabled on this Instance."
fi

#================================
#==== Functions Declaration =====
#================================

get_langs()
{
sqlplus -s apps/${apps_pwd}@${SID} << ops
set feedback off heading off pagesize 0
select language_code from fnd_languages where installed_flag in ('I','B');
ops
}

get_appsversion()
{
sqlplus -s apps/${apps_pwd}@${SID} << ops
set feedback off heading off
select release_name from fnd_product_groups;
ops
}

get_dbversion()
{
sqlplus -s apps/${apps_pwd}@${SID} << ops
set feedback off heading off
select * from v\$version;
ops
}

get_dbhost()
{
sqlplus -s apps/${apps_pwd}@${SID} << ops
set feedback off heading off
select host_name from v\$instance;
ops
}

get_midtierhosts()
{
sqlplus -s apps/${apps_pwd}@${SID} << ops
set feedback off heading off
select node_name from fnd_nodes where node_name not in ('AUTHENTICATION');
ops
}

#==================================
#=== Midtier Components Version ===
#==================================

# === Jinitiator ===
jinit_rel=`grep -i s_jinit_ver_dot $cfile | cut -f2 -d ">" | cut -f1 -d "<"`

# === Developer6i ===
if [ -f "$ORACLE_HOME/bin/f60run" ]
then
f60_full=`$ORACLE_HOME/bin/f60run | head -1 | awk '{print $6}'`
f60_reqd=`$ORACLE_HOME/bin/f60run | head -1 | awk '{print $6}' | cut -f4 -d "."`
dev6i_ps=`expr $f60_reqd - 9`
dev6i_rel="PatchSet ${dev6i_ps} (${f60_full})"
else
dev6i_rel="Forms Executable f60run not found in ORACLE_HOME"
fi

# === Discoverer4i ===

if [ -f "$ORACLE_HOME/discwb4/bin/dis4ws" ]
then
disco_rel=`strings -a ${ORACLE_HOME}/discwb4/bin/dis4ws | grep -i 'Discoverer Version' | awk '{print $3}'`
else
disco_rel="Discoverer Component not found."
fi

# === IAS (Apache Version and Rollup Patchset) ===

if [ -f "$IAS_ORACLE_HOME/Apache/Apache/bin/httpd" ]
then
ias_rel=`$IAS_ORACLE_HOME/Apache/Apache/bin/httpd -v | tail -1 | cut -d "(" -f2 | cut -d ")" -f1`
else
ias_rel="Apache Executable not found."
fi


#==================================
#======== Instance Info ===========
#==================================

langs=`get_langs | tr "\n" ":" `
apps_rel=`get_appsversion | tr "\n" " "`
db_rel_full=`get_dbversion | grep -i Release | head -1`
db_hostfull=`get_dbhost | tr "\n" " "`
db_hostname=`echo $db_hostfull | cut -d "." -f1`
mid_hosts=`get_midtierhosts | tr "\n" " "`


echo " ========================================================================================== "
echo " `tput bold`INSTANCE INFORMATION: $SIDC`tput sgr0`"
echo " ========================================================================================== "
echo " This Host : $host "
echo " SID : $SID "
echo " DB Version : $db_rel_full "
echo " APPS Release : $apps_rel "
echo " "
echo " DB Host : $db_hostname "
echo " Mid Tiers : $mid_hosts "
echo " "
echo " Jinitiator Release : $jinit_rel "
echo " Developer6i Release : $dev6i_rel "
echo " Discoverer Release : $disco_rel "
echo " Apache Release : $ias_rel "
echo " "
echo " Languages Installed : $langs "
echo " Context File Location : $cfile "
echo " APPL_TOP Location : $APPL_TOP "
echo " 806 ORACLE_HOME Location : $ORACLE_HOME "
echo " iAS ORACLE_HOME Location : $IAS_ORACLE_HOME "
echo " ========================================================================================== "

1 comment:

Unknown said...

the corruption of various data formats may affect other files, but it can be fixed by the recovery mode in sql server 2005 utility