Showing posts with label script. Show all posts
Showing posts with label script. Show all posts

Wednesday, June 24, 2009

Script For Checking The Environment Before Opatch Operations

The script, “deopatch.bat” is a precheck for the 10.2.0.X.X opatch.
This script will check the environment settings which are required for executing opatch and also provide some recommendations.
This script can be executed as a precheck before performing any of the inventory operations such as patch apply, patch rollback, lsinventory, etc.
This script can also executed to find the problem if opatch fails with any environment settings and will display detailed information about the reason for failure. According to the reason for failure, recommendations are also displayed.
This script also shows the detailed information about how opatch is checking and setting the environment variables, java etc.
This script will not perform the actual inventory operation which opatch is doing, but will do the check if all the settings are correct for opatch to proceed.
Software Requirements/Prerequisites
This script can be invoked from the command prompt in Windows.
Configuring the Script
The name of the batch file is “deopatch.bat”.
You can download and keep the script in any location.
Running the Script
This script will not perform the actual inventory operation which opatch is doing, but will do the check to see if all the settings are correct for opatch to proceed.
This script can run in the same way as opatch is executed. For example: To apply a patch: The opatch command is : “opatch apply”.

So opatch will first check if :
> All the environment variables are set
> Opatch is able to find the location of “java”
> Also if java.exe exists in the java location.

If opatch is able to find java, the opatch will proceed with the java operations for applying the patch. If opatch is not able to do the same the opatch will error out accordingly.
You can execute the script “deopatch” in the same way if opatch fails with above checks or before executing the opatch.


The command is : “deopatch apply”
“deopatch” will do all the above mentioned checks and will display the result if you can proceed with the opatch apply. If any errors found “deopatch” will give recommendations accordingly for rectifying the error

This script will check the following:

All the environment variables are set
If ORACLE_HOME is set in the environment
If ORACLE_HOME is specified using “-oh”
If java location is specified using “-jdk”
If java location is specified using “-jre”
If java location is found under ORACLE_HOME\jdk
If java location is found under ORACLE_HOME\jre
If java location is found under ORACLE_HOME\jre then the version is greater than or equal to 1.4
If java location is found under ORACLE_HOME\oui\oraparam.ini
If java location is found then does “java.exe” exists in the java location.
Also display the version of java.


Script:

=============================================================
@echo off
cls
echo.
echo SCRIPT : DEOPATCH.BAT
echo PURPOSE : OPATCH ENVIRONMENT CHECK
echo.
echo.
echo DISCLAIMER
echo ===========
echo:This script will only check the environment variables in the same way how opatch checks
echo the environment variables before any inventory operation.This script also provides some
echo recomendation before precoeding.
echo.
pause
setlocal
echo.
REM ###################################################################
REM # Set the base path
set BASE=%~DP0%
echo deopatch :is invoked from %BASE%
REM ###################################################################
echo.
REM ####################################################################
REM # Get ORACLE_HOME from environment variable "ORACLE_HOME"
set OH=%ORACLE_HOME%
if "%OH%" == "" goto ORAHOMENOTSET
echo ORACLE_HOME :is set as %ORACLE_HOME% in the Environment
goto DEBUGTEST
:ORAHOMENOTSET
echo ORACLE_HOME :is not set in the Environment
REM ####################################################################
echo.
REM ####################################################################
:DEBUGTEST
REM # Check for OPATCH_DEBUG env variable
set DEBUG=%OPATCH_DEBUG%
if "%DEBUG%" == "" goto DEBUGNOTSET
echo OPATCH_DEBUG :is set as %DEBUG% in the Environment
goto PLATFORMTEST
:DEBUGNOTSET
echo OPATCH_DEBUG :is not set in the Environment
REM #####################################################################
echo.
REM #####################################################################
:PLATFORMTEST
REM # Look for OPATCH_PLATFORM_ID
set PLATFORM=%OPATCH_PLATFORM_ID%
if "%PLATFORM%" == "" goto PLATFORMNOTSET
echo OPATCH_PLATFORM_ID:is set as %PLATFORM% in the Environment
goto PATHTEST
:PLATFORMNOTSET
echo OPATCH_PLATFORM_ID:is not set in the Environment
REM #####################################################################
echo.
REM #####################################################################
:PATHTEST
REM # Preserve the PATH environment variable
set PATHENV=%PATH%
echo PATH is set as :
echo %PATHENV%
REM #####################################################################
echo.
REM #####################################################################
REM getOH: If -oh is specified, use it to over-ride env. var. ORACLE_HOME
REM getJRE,getJDK If -jre or -jdk are specified, use it to launch opatch
REM JDK,JRE :f -jre or -jdk are specified, use it to launch opatch
echo INITILAIZING THE REQUIRED VARIABLES
echo -----------------------------------
set getOH=0
echo getOH is set to %getOH%
set getJRE=0
echo getJRE is set to %getJRE%
set getJDK=0
echo getJDK is set to %getJRE%
set JDK=
echo JDK is set as %JDK%
set JRE=
echo JRE is set as %JRE%
REM #######################################################################
echo.
REM #######################################################################
REM Storing all the parameters passed with the opatch
set PARAMS=%*
echo INVOKING OPATCH WITH THE PARAMETERS : "deopatch %PARAMS%"
REM #######################################################################
echo.
REM #######################################################################
if "%1" == "" goto INVALIDOPTION
if "%1" == "apply" goto PROCEED
if "%1" == "lsinventory" goto PROCEED
if "%1" == "rollback" goto PROCEED
goto INVALIDOPTION
REM #######################################################################
:PROCEED
REM ######################################################################
echo BEGINING THE FOR LOOP
echo ---------------------
:FORLOOP
if "%1" == "" goto DONELOOP
echo.
echo ITRATION STARTED
echo : The parameter is : "%1"
:CHECK1
if NOT "%getOH%" == "1" goto CHECK2
set OH=%1
echo : ORACLE_HOME is specifed as %OH% when invoking Opatch
echo : Setting ORACLE_HOME to %OH%
set getOH=0
:CHECK2
if NOT "%getJRE%" == "1" goto CHECK3
set JRE=%1
echo : JRE location is specifed as -jre %JRE% when invoking Opatch
echo : Setting JRE to %JRE%
set getJRE=0
:CHECK3
if NOT "%getJDK%" == "1" goto CHECK4
set JDK=%1
echo : JDK location is specifed as -jdk %JDK% when invoking Opatch
echo : Setting JDK to %JDK%
set getJDK=0
:CHECK4
if NOT "%1" == "-oh" goto CHECK5
set getOH=1
:CHECK5
if NOT "%1" == "-jre" goto CHECK6
set getJRE=1
:CHECK6
if NOT "%1" == "-jdk" goto FORCHECK
set getJDK=1
:FORCHECK
shift
goto FORLOOP
:DONELOOP
echo.
echo END OF THE FOR LOOP
echo -------------------
REM ########################################################################
echo.
REM ########################################################################
REM # Check for OPATCH_DEBUG env variable
:CHECK7
set DEBUGVAL=false
if NOT "%DEBUG%" == "TRUE" goto CHECK8
set DEBUGVAL=true
:CHECK8
if NOT "%DEBUG%" == "true" goto CHECK9
set DEBUGVAL=true
REM #########################################################################
echo.
REM #########################################################################
:CHECK9
REM # If Oracle Home not set, error out
if NOT "%OH%" == "" goto INVOKEJAVA
echo.
echo DEOPATCH FAILED
echo ===============
echo.
echo REASON
echo ------
echo Oracle Home is not set. OPatch cannot proceed!
echo.
echo SUGGESTION
echo ----------
echo Set the ORACLE_HOME using any of the following and proceed:
echo 1) At the environament level
echo set ORACLE_HOME=[path]
echo eg : set ORACLE_HOME=d:\oracle\product\ora102
echo.
echo 2) Using "-oh" whne invoking opatch
echo opatch apply -oh [path]
echo eg : opatch apply -oh d:\oracle\product\ora102
goto OPATCHDONE
REM #########################################################################
echo.
REM #########################################################################
:INVOKEJAVA
set CP=%OH%\oui\jlib
REM #########################################################################
REM #########################################################################
REM # Use ORACLE_HOME to set Java CLASS_PATH
REM # default location
set JAVA=
REM #########################################################################
echo CHECK FOR JAVA
echo --------------
echo.
REM #########################################################################
echo 1) Checking if java was supplied with "-jdk".
if NOT "%JAVA%" == "" goto CHECKJRE
if "%JDK%" == "" goto CHECKJRE
echo "-jdk" is specifed and the java location is %JDK%
set JAVA=%JDK%\bin\java.exe
goto JAVATEST
REM #########################################################################
echo.
REM #########################################################################
:CHECKJRE
echo "-jdk" is not specifed
echo.
echo 2) Checking if java was supplied with "-jre".
if NOT "%JAVA%" == "" goto CHECKOHJDK
if "%JRE%" == "" goto CHECKOHJDK
echo "-jre" is specifed and the java location is %JRE%
set JAVA=%JRE%\bin\java.exe
goto JAVATEST
REM #########################################################################
echo.
REM #########################################################################
:CHECKOHJDK
echo "-jre" is not specifed
echo.
echo 3) Checking if java is present in ORACLE_HOME\jdk.
if NOT "%JAVA%" == "" goto CHECKOHJRE
if NOT EXIST %OH%\jdk\ goto CHECKOHJRE
echo java location found under ORACLE_HOME\jdk\bin
set JAVA=%OH%\jdk\bin\java.exe
if NOT EXIST %JAVA% goto JAVANOTINJDK
goto JAVATEST
:JAVANOTINJDK
echo But java.exe is missing from %OH%\jdk\bin
goto CHECKOHJRE
REM #########################################################################
echo.
REM #########################################################################
:CHECKOHJRE
set JAVA=
echo java is not present in "ORACLE_HOME\jdk\bin"
echo.
echo 4) Checking if java is present in ORACLE_HOME\jre.
if NOT "%JAVA%" == "" goto CHECKORAPARAM
set JRE_HIGH=
for /F "usebackq tokens=1" %%A in (`dir /ON /B %OH%\jre`) do set JRE_HIGH=%%A
if "%JRE_HIGH%" == "" goto CHECKORAPARAM
set JRE_HIGH_FIRST=
set JRE_HIGH_SECOND=
for /F "tokens=1,2 delims=." %%A in ("%JRE_HIGH%") do set JRE_HIGH_FIRST=%%A
for /F "tokens=1,2 delims=." %%A in ("%JRE_HIGH%") do set JRE_HIGH_SECOND=%%B
if "%JRE_HIGH_FIRST%" LSS "1" goto CHECKORAPARAM
if "%JRE_HIGH_SECOND%" LSS "4" goto CHECKORAPARAM
echo java location found:java %JRE_HIGH% is present under %OH%\jre
set JAVA=%OH%\jre\%JRE_HIGH%\bin\java.exe
if NOT EXIST %JAVA% goto JAVANOTINJRE
goto JAVATEST
:JAVANOTINJRE
echo But java.exe is missing from %OH%\jre\%JRE_HIGH%\bin
goto CHECKORAPARAM
REM #########################################################################
echo.
REM #########################################################################
:CHECKORAPARAM
set JAVA=
echo java is not present under "ORACLE_HOME\jre"
echo.
echo 5) Checking if java is present in ORACLE_HOME\oui\oraparam.ini
REM # Last option is to look inside oraparam.ini for JRE_LOCATION
if NOT "%JAVA%" == "" goto JAVATEST
if NOT EXIST %OH%\oui\oraparam.ini goto NOORAPARAMINI
set JRE_LOCATION=
for /F "usebackq tokens=2 delims==" %%A in (`findstr "JRE_LOCATION=" %OH%\oui\oraparam.ini`) do set JRE_LOCATION=%%A
if "%JRE_LOCATION%" == "" goto NOJREORAPARAM
set ABS_PATH=
for /F "eol=\ tokens=1" %%A in ("%JRE_LOCATION%") do set ABS_PATH=%%A
if "%ABS_PATH%" == "" goto JAVAABSPATH
for /F "tokens=1,2 delims=:" %%A in ("%JRE_LOCATION%") do set ABS_PATH=%%B
if NOT "%ABS_PATH%" == "" goto JAVAABSPATH
echo Relative path for java found under "%JRE_LOCATION%"
set JAVA=%OH%\oui\bin\%JRE_LOCATION%\bin\java.exe
goto JAVATEST
REM #########################################################################
:JAVAABSPATH
set JAVA=%JRE_LOCATION%\bin\java.exe
echo Setting absloute path
echo Absolute path for java found under %ABS_PATH%
goto JAVATEST
REM #########################################################################
:NOORAPARAMINI
echo The file "ORACLE_HOME\oui\oraparam.ini" is not present.
goto JAVATEST
REM #########################################################################
REM #########################################################################
:NOJREORAPARAM
echo "JRE_LOCATION" is not in "ORACLE_HOME\oui\oraparam.ini"
goto JAVATEST
REM #########################################################################
echo.
REM #########################################################################
:JAVATEST
if NOT "%JAVA%" == "" goto JAVATEST1
echo.
echo DEOPATCH FAILED
echo ===============
echo.
echo REASON
echo ------
echo Java could not be located. OPatch cannot proceed!
echo OPATCH failed to find java location from
echo -jdk
echo -jre
echo ORACLE_HOME\jdk
echo ORACLE_HOME\jre
echo ORACLE_HOME\oui\oraparam.ini
echo.
echo SUGGESTION
echo ----------
echo provide java location using any of the following and proceed:
echo 1) Use -jdk when invoking opatch
echo opatch apply -jdk [java_location]
echo eg : opatch apply -jdk c:\jdk14
echo.
echo 2) Use -jdk when invoking opatch
echo opatch apply -jre [java_location]
echo eg : opatch apply -jre c:\jre\1.4.2
echo.
echo 3) Check if the java under ORACLE_HOME\jdk is working
echo ORACLE_HOME\jdk\bin\java -version
echo.
echo 3) Check if the java under ORACLE_HOME\jre\version is working
echo ORACLE_HOME\jre\version\bin\java -version
echo eg : ORACLE_HOME\jre\1.4.2\bin\java -version
goto OPATCHDONE
REM #########################################################################
echo.
REM #########################################################################
:JAVATEST1
if EXIST %JAVA% goto OPATCHDONEPERFECT
echo.
echo DEOPATCH FAILED
echo ===============
echo.
echo REASON
echo ------
echo Java could not be located. OPatch cannot proceed!
echo Java location was specified
echo But "java.exe" does not exist at %JAVA%
echo.
echo SUGGESTION
echo ----------
echo provide a proper loction and use using any of the following and proceed:
echo 1) Use -jdk when invoking opatch
echo opatch apply -jdk [java_location]
echo eg : opatch apply -jdk c:\jdk14
echo.
echo 2) Use -jdk when invoking opatch
echo opatch apply -jre [java_location]
echo eg : opatch apply -jre c:\jre\1.4.2
echo.
echo 3) Check if the java under ORACLE_HOME\jdk is working
echo ORACLE_HOME\jdk\bin\java -version
echo.
echo 3) Check if the java under ORACLE_HOME\jre\version is working
echo ORACLE_HOME\jre\version\bin\java -version
echo eg : ORACLE_HOME\jre\1.4.2\bin\java -version
goto OPATCHDONE
REM #########################################################################
REM #########################################################################
:INVALIDOPTION
echo DEOPATCH FAILED
echo ===============
echo Please invoke patch with appropriate option:
echo Usage: deopatch [ command ]
echo.
echo command := apply
echo lsinventory
echo rollback
echo version
goto OPATCHDONE
REM #########################################################################
:OPATCHDONEPERFECT
echo SUMMARY
echo =======
echo.
echo ALL THE ENVIROMNET VARIABLES ARE SET
echo.
echo 1)deopatch Location : %~DP0%
echo 2)deopatch Invoked as : "deopatch %PARAMS%"
echo 3)ORACLE_HOME is : %OH%
echo 4)DEBUG Is set as : %DEBUGVAL%
echo 5)Java Location : %JAVA%
echo 6)Java Version :
echo ________________________________________________________________________
%java% -version
echo ________________________________________________________________________
:OPATCHDONE

=============================================================

Thursday, May 28, 2009

Script to purge old backups

This script can be used to used to purge backups older than a given number of days (replace the argument after “mtime” with the required number of days). This script can be used in conjunction with the backup script in the previous post.

==========================================================

DATE=`date +%d%b%y_%H_%M_%S`
LOGFILE='/t2/backups/logs/appstech_backup_'${DATE}'.log'
ORACLE_BASE=/t2/oracle
ORACLE_HOME=/t2/oracle/PROD/db/tech_st/10.2.0
ORACLE_SID=PROD
WORK=/t2/scripts
EXEC_DIR=/t2/scripts
LOG_HOME=/t2/backups/logs
APPS_BACKUP_LOC=/t2/backups/appstech
export ORACLE_BASE ORACLE_SID ORACLE_HOME LOG_HOME APPS_BACKUP_LOC
TNS_ADMIN=$ORACLE_HOME/network/admin/PROD_perp
SHELL=/usr/bin/ksh
LD_LIBRARY_PATH=/usr/lib:$ORACLE_HOME/lib
export TNS_ADMIN SHELL LD_LIBRARY_PATH
PATH=$PATH:/usr/bin:/usr/sbin:/usr/local/bin:/usr/lib:/etc:$ORACLE_HOME/bin:$LD_LIBRARY_PATH
export PATH
TERM=vt100
export TERMNLS_LANG=American_America.UTF8
export NLS_LANG
find $LOG_HOME -type f -mtime +7 xargs rm -f
find $APPS_BACKUP_LOC -type f -mtime +6 > $EXEC_DIR/apps_purge.list
if [ -s $EXEC_DIR/apps_purge.list ]
then
for file in `cat $EXEC_DIR/apps_purge.list`
do
rm ${file}
done
for address in `cat $EXEC_DIR/mail_list`
do
if [ "`echo $address cut -c1`" != "#" ]; then
mail -s "${ORACLE_SID} - Apps Purge Success Log" $address < $EXEC_DIR/apps_purge.list
sleep 1
fi
done
else
for address in `cat $EXEC_DIR/mail_list`doif [ "`echo $address cut -c1`" != "#" ]; then
echo "No Files found in backup directory to purge!!" mail -s "${ORACLE_SID} - Apps Purge Failiure Log" $address
fi
done
fi
find $EXEC_DIR/apps_purge.list xargs rm -f
==========================================================

Script to take backup of Apps stack

This script can be used to take a backup of the Apps stack

========================================================
DATE=`date +%d%b%y_%H_%M_%S`

LOGFILE='/t2/backups/logs/appstech_backup_'${DATE}'.log'ORACLE_BASE=/t2/oracle
ORACLE_HOME=/t2/oracle/PROD/db/tech_st/10.2.0
ORACLE_SID=PROD
WORK=/t2/scripts
EXEC_DIR=/t2/scripts
export ORACLE_BASE ORACLE_SID ORACLE_HOME
TNS_ADMIN=$ORACLE_HOME/network/admin/PROD_perpSHELL=/usr/bin/ksh
LD_LIBRARY_PATH=/usr/lib:$ORACLE_HOME/lib
export TNS_ADMIN SHELL LD_LIBRARY_PATH
PATH=$PATH:/usr/bin:/usr/sbin:/usr/local/bin:/usr/lib:/etc:$ORACLE_HOME/bin:$LD_LIBRARY_PATH
export PATH
TERM=vt100
export TERM
NLS_LANG=American_America.UTF8
export NLS_LANG
perl /t1/oracle/PROD/inst/apps/PROD_perp/admin/scripts/adpreclone.pl appsTier >> $LOGFILE # 781539.1
tar -czvf /t2/backups/appstech/PROD_apps_${DATE}.tgz /t1/oracle/PROD >> $LOGFILE
returncode=$?
echo $returncode return code >> $LOGFILE
date >> $LOGFILE
if [ $returncode -ne 0 ];
then
for address in `cat $EXEC_DIR/mail_list`
do
if [ "`echo $address cut -c1`" != "#" ]; then
tail -n 200 $LOGFILE mail -s "TAR Applications Techstack Backup Failure Log" $address echo "TAR Applications Techstack Backup Failure Log" >> $LOGFILE
fi
done
else
for address in `cat $EXEC_DIR/mail_list`
do
if [ "`echo $address cut -c1`" != "#" ]; then
tail -n 200 $LOGFILE mail -s "TAR Applications Techstack Backup Successful Log" $address echo "TAR Applications Techstack Backup Successful Log" >> $LOGFILE
fi
done
fi

========================================================

Thursday, April 9, 2009

SQL suery to find out all errored requests

Use this SQL script to find out all the requests that ended in ERROR, TERMINATED or WARNING state.

===================================================
-- --------------------------------------------------
-- Author : New Generation Consultants
-- Script to find erroring requests
-- --------------------------------------------------
clear columns
set pages 23
set lines 500
col os form A6
col program head "Program Name" form A45 trunc
col shrtnm head "Shortname" format a13
col time head Elapsed form 9999.99
col request_id head "Req Id" form 9999999
col cprogid head "Prg Id" form 999999
col "Started On" format a10
col "Finished On" format a11
col "Submitted By" format a35 trunc
col argument_text head "Arguments" format a50 trunc
col statustxt head Status format a12 trunc
col phasetxt head Phase format a10 trunc
set recsep wrap
set verify off
select a.request_id
,c.concurrent_program_name shrtnm
,c.concurrent_program_id cprogid
,ctl.user_concurrent_program_name "program"
,l2.meaning phasetxt
,l1.meaning statustxt
--,to_char(a.actual_start_date,'hh:mi:ssAM') "Started On"
--,to_char(a.actual_completion_date,'hh:mi:ssAM') "Finished On"
,(nvl(actual_completion_date,sysdate)-actual_start_date)*1440 "Time"
--,a.argument_text
,u.user_name ' - ' u.description "Submitted By"
from fnd_Concurrent_requests a,fnd_concurrent_programs c,fnd_concurrent_programs_tl ctl
,fnd_user u,
(select l1.lookup_code,l1.meaning from fnd_lookup_values l1
where l1.lookup_type = 'CP_STATUS_CODE'
and l1.language = 'US'
and l1.enabled_flag = 'Y'
and (l1.start_date_active <= sysdate AND l1.start_date_active IS NOT NULL)
and (l1.end_date_active > sysdate or l1.end_date_active is null
and l1.meaning in ('Terminated','Warning','Cancelled','Error'))) l1,
(select l2.lookup_code,l2.meaning from fnd_lookup_values l2
where l2.lookup_type = 'CP_PHASE_CODE'
and l2.language = 'US'
and l2.enabled_flag = 'Y'
and (l2.start_date_active <= sysdate AND l2.start_date_active IS NOT NULL)
and (l2.end_date_active > sysdate or l2.end_date_active is null)
and l2.meaning = 'Completed')l2
where trunc(a.actual_start_date) = trunc(sysdate) and a.program_application_id = c.application_id
and a.concurrent_program_id = c.concurrent_program_id and ctl.application_id = c.application_id
and ctl.concurrent_program_id = c.concurrent_program_id
and l1.lookup_code = a.status_code
and l2.lookup_code = a.phase_code
and u.user_id = a.requested_by
order by actual_start_date

===================================================

Monday, March 30, 2009

script for creating soft link for all Custom concurrent programs on target system after cloning

This code snippet helps to create all the soft link for custom concurrent program after clone on a target system.
Prerequisites
=============
Script is invoked from applmgr user account.
Shell Script for soft link creation on target system after cloning.
===================================================================
#!/usr/bin/ksh
doc()
{
cat <<-EOF
# Usage create_soft_link.sh
#
# Used for target System after cloning to take care of soft link
# for all the custom program to the executable $FND_TOP/bin/fndcpesr
#
#----------------------------------------------------------------
# Procedure :
# Should be run manually
# ---------------------------------------------------------------
# Dependencies :
# NO
# Change history :
# ---------------------------------------------------------------
#
EOF
}
#=====================================
# For displaying help and usuage
#=====================================

while getopts h OPT
do
case $OPT in
h) doc
exit 0;;
\?) echo "Usage : $0 "
exit -1;;
esac
done
shift `expr $OPTIND - 1`
#=====================================
# Check for APPL_TOP
#=====================================

if [ t${APPL_TOP} = "t" ]
then echo "Appl Top is not set, Set the appltop and run it again"
exit 0;
fi

cd $APPL_TOP
#=====================================
# Code for soft link creation
#=====================================

for prgName in `ls */11.5.0/bin/*prog`
do
echo "Creating link for - $prgName"
rm `echo $prgName sed 's/\.prog//'`
ln -s $FND_TOP/bin/fndcpesr `echo $prgName sed 's/\.prog//'`
echo "\t\t\t.......created for $prgName"
done

Tuesday, February 17, 2009

Script to find Apache, Java, JRE, Forms version for Oracle E-Business Suite R12

The shell script below can be used to collect Apache, Java, Client JRE, Forms, Perl, PL/SQL versions and Forms communication mode from a Oracle R12 environment. This script should be run only in a *nix environment against a R12 instance only.

The script shows the output on screen, which is also captured in the file "zz_.txt" which is created in the current directory




(
echo "Script Started "
date
## The script shows output on screen and creates file named hostname_date.txt file in current ## directory
## Collect the Apache version
echo "*****Apache Version*****"
$IAS_ORACLE_HOME/Apache/Apache/bin/httpd -v
echo " "
## Collect perl version
echo "*****perl version******"
$IAS_ORACLE_HOME/perl/bin/perl -v|grep built
echo " "
## Collect Java version
echo "******Java Version******"
sh -c "`awk -F= '$1 ~ /^JSERVJAVA.*$/ {print $2}' $ADMIN_SCRIPTS_HOME/java.sh` -version;"
echo " "
## Collect client JRE version
echo "*****Client JRE version*****"
cat $FORMS_WEB_CONFIG_FILE|grep sun_plugin_version| cut -c 1-35
echo " "
## Collect Forms version
echo "*****Forms Version*****"
$ORACLE_HOME/bin/frmcmp_batch|grep Forms| grep Version
echo " "
## Collect PL/SQL Version
echo "*****PL/SQL Version****"
$ORACLE_HOME/bin/frmcmp_batch|grep PL/SQL|grep Version
echo " "
## Collect Forms communication mode
echo "****Forms Communication Mode****"
cat $FORMS_WEB_CONFIG_FILE|grep serverURL=
echo "If the serverURL parameter has no value then Forms is implemented in socket mode else it is servlet"
echo " "
echo "Script Completed Successfully and it has generated the file zz`hostname`_`date +%m%d%y.%H%M`.txt file in current directory"
echo "Script completed "
date
) 2>&1 | tee zz`hostname`_`date +%m%d%y.%H%M`.txt