Showing posts with label check. Show all posts
Showing posts with label check. 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

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

Wednesday, June 17, 2009

Applications 11i Health Check After Maintenance

1. Verify Maintenance Mode is disabled (applicable to 11.5.10 and customers with AD I patchset level (Patch 3180816(AD I) or Patch 4038964 (AD I1))).

2. Personal Home Page: Use http://hostname.domain:port
2.1. Login into Personal Home page as Sysadmin User
2.2. Choose Application Adminsitrator Responsibility to log into core applications.
2.3. Check whether User/Responsibility Administrator Screen is coming up without errors.
2.4. Submit "Generate Concurrent Processing Environment Information" Concurrent Request and "Active Users" report. Once completed normally then use export function (MainMenu/File/Export). If errors check your APPS_LISTENER is up and running else further debugging is needed.
2.5 Select “Concurrent Manager Administer” and check the status of “Service Manager”. If Service Manager is not running, Shutdown concurrent managers, run cmclean.sql and restart concurrent managers.


3. SSP Products: Login to applications using step 1 and select Sales Online, iExpenses or iProcurement responsibility. Check whether pages are coming up or not, If customer is licensed for it.

4. Reports Server and Discoverer: To be tested only in the case the customer is licensed for any Business Intelligence Modules
4.1. Report Server: Login to applications using step 1 and select responsibility like Financial Intelligence. Run report Earnings per Share and ensure that graphs are displayed without any errors.
4.2. Discoverer Viewer:http://hostname.domain:port/discoverer4i/viewer (in case of failure, run $ORACLE_HOME/discwb4/util/checkdiscoverer.sh to check status of each component)
4.3. Discoverer Plus:
http://hostname.domain:port/discwb4/html/english/welcome.htm(in case of failure, run $ORACLE_HOME/discwb4/util/checkdiscoverer.sh to check status of each component)

5. Check Jserv is Up and running :
5.1.
http://hostname.domain:port/servlets/Hello 5.2 For Multi-MT instances, perform the following check using machine name URL for each MT and make sure the page comes uphttp://hostname:domain:port/OA_HTML/AppsLocalLogin.jsp

6. JTF Login Page for customers using CRM (Check for each MT using real host names) http://hostname.domain:port/OA_HTML/jtflogin.jsp

7. Workflow: Login to OAM. Navigate to “Workflow Manager” and make sure “Notification Mailers” and “Agent Listeners” are up.

8. Ensure Database is in archive log mode ( If it was disabled for patching/upgrade)
$sqlplus " / as sysdba"
SQLarchive log list


9. Optional: Check multiple JVM's have come up if configured. Only if autoconfig was run, check that number of JVMs configured is same as it was before change.

10. Check the invalid object count and make sure that there is no additional invalid objects after the maintanence

11.Run apps diagnostics testsLogin to Personal Home Page using http://hostname.domain:port
Click on System Administration responsibility
Run below tests under Diagnostics page
a) PL/SQL ping
b) JSP Ping
c) AOL/J Database Connection Pool Status
d) Servlet ping

These checks will make sure all necessary components of oracle applications functioning well.

Wednesday, February 25, 2009

How To Check The inventory.xml/comps.xml Or Any Oracle XML File Is Correct


You can check the inventory.xml/comps.xml ( any XML file) using the "LoadXML" option in Opatch utility.
The command is :

> opatch util LoadXML -xmlInput "xml_file"

For example :
If the xml file to be checked is "/u01/oracle/visndb/10.2.0/inventory/ContentsXML/comps.xml "
then the command will be

opatch util LoadXML -xmlInput /u01/oracle/visndb/10.2.0/inventory/ContentsXML/comps.xml

The Opatch output will be:

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

opatch util LoadXML -xmlInput comps.xml
Invoking OPatch 10.2.0.2.0

Oracle interim Patch Installer version 10.2.0.2.0
Copyright (c) 2005, Oracle Corporation. All rights reserved..

UTIL session

Oracle Home : /u01/oracle/visndb/10.2.0
Central Inventory : /etc/oraInventory
from : /u01/oracle/visndb/10.2.0/oraInst.loc
OPatch version : 10.2.0.2.0
OUI version : 10.2.0.2.0
OUI location : /u01/oracle/visndb/10.2.0/oui
Log file location : /u01/oracle/visndb/10.2.0/cfgtoollogs/opatch/opatch-2009_Feb_25_05-34-19-CST_Wed.log

Invoking method loadxml
Please enter the complete path to the XML file to load:
(enter both the dir. path and the file name)"

You entered: "comps.xml".
XML file is OK.

OPatch succeeded.

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

If the XML file is incorrect, Opatch will chow an error like:

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

opatch util LoadXML -xmlInput D:\11G\db_1\inventory\ContentsXML\comps.xml
Invoking OPatch 10.2.0.2.0

Oracle interim Patch Installer version 10.2.0.2.0
Copyright (c) 2005, Oracle Corporation. All rights reserved..

UTIL session

Oracle Home : /u01/oracle/visndb/10.2.0
Central Inventory : /etc/oraInventory
from : /u01/oracle/visndb/10.2.0/oraInst.loc
OPatch version : 10.2.0.2.0
OUI version : 10.2.0.2.0
OUI location : /u01/oracle/visndb/10.2.0/oui
Log file location : /u01/oracle/visndb/10.2.0/cfgtoollogs/opatch/opatch-2009_Feb_25_05-34-19-CST_Wed.log

org.xml.sax.SAXParseException: : XML-20125: (Fatal Error) Attribute value should start with quote.
at oracle.xml.parser.v2.XMLError.flushErrorHandler(XMLError.java:417)
at oracle.xml.parser.v2.XMLError.flushErrors1(XMLError.java:286)
at oracle.xml.parser.v2.NonValidatingParser.parseAttrValue(NonValidatingParser.java:1616)
at oracle.xml.parser.v2.NonValidatingParser.parseAttr(NonValidatingParser.java:1521)
at oracle.xml.parser.v2.NonValidatingParser.parseAttributes(NonValidatingParser.java:1454)
at oracle.xml.parser.v2.NonValidatingParser.parseElement(NonValidatingParser.java:1293)
at oracle.xml.parser.v2.NonValidatingParser.parseRootElement(NonValidatingParser.java:339)
at oracle.xml.parser.v2.NonValidatingParser.parseDocument(NonValidatingParser.java:306)
.
.
.
.
.
.
UtilSession failed: OracleHomeInventory gets a null Vector of installed products

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