/build/static/layout/Breadcrumb_cap_w.png

Cannot find the file specified - Oracle Opatch

I've done a script to install Oracle 11g runtime then apply a patch at the end. It works up until the patching when I get a "The system cannot find the file specified" error at Line 45 Char 1.

Applying the patch with the same lines of code in a separate vbs doesn't produce this problem?

My script is:


Dim oShell, fso, sCurPath, i, varPath, oShell1
Dim objWSH, objUserVariables, objSystemVariables

'On Error Resume Next

Set fso = WScript.Createobject("Scripting.FileSystemObject")
Set oShell = CreateObject("WScript.Shell")

' Install Oracle Client 11g Release 2
sCurPath = CreateObject("Scripting.FileSystemObject").GetAbsolutePathName(".")
sCmdLine = sCurPath + "\Client\setup.exe -waitforcompletion -noconsole -silent -force -responseFile " + sCurPath + "\client\response\Oracle_11g_Release_2_Client_P1.0.rsp"

i = oShell.Run(sCmdLine, 1 ,True)

' Copy the updated Opatch to the installation
fso.CopyFolder sCurPath & "\OPatch", "C:\oracle\product\11.2.0\client_1\", True

' Copy the patch to ORACLE_HOME
fso.CopyFolder sCurPath & "\12429528", "C:\oracle\product\11.2.0\client_1\", True

' Create Opatch log folder
fso.CreateFolder "C:\oracle\product\11.2.0\client_1\cfgtoollogs\opatch"

' Rename oci.dll to allow for patch application
fso.MoveFile "C:\oracle\product\11.2.0\client_1\BIN\oci.dll" , "C:\oracle\product\11.2.0\client_1\BIN\oci.old"

' Set required Environment Variables
Set objWSH = CreateObject("WScript.Shell")
Set objSystemVariables = objWSH.Environment("SYSTEM")
varPath = objSystemVariables("PATH")
objSystemVariables("PATH") = varPath & ";C:\oracle\product\11.2.0\client_1\OPatch"
objSystemVariables("ORACLE_HOME") = "C:\oracle\product\11.2.0\client_1"
objSystemVariables("ORACLE_BASE") = "C:\oracle"

' Apply patch
'WScript.sleep 10000
Set oShell1 = CreateObject("WScript.Shell")
oShell1.CurrentDirectory="C:\oracle\product\11.2.0\client_1\12429528"
oShell1.Run "opatch apply -silent -force -ocmrf C:\oracle\product\11.2.0\client_1\OPatch\ocm.rsp",1,True

WScript.Quit(i)


Can anyone point out what's wrong here?

Thanks

0 Comments   [ + ] Show comments

Answers (4)

Posted by: Matias M Andersen 13 years ago
Senior Yellow Belt
0
"opatch apply -silent -force -ocmrf C:\oracle\product\11.2.0\client_1\OPatch\ocm.rsp"

This is the name of the file you are about to run.

An easy way to spot these kinds of errors are to store your command line in a variable and run your script with a "MSGBOX variableName" instead of Run, to check if the commandline looks as intended.

/Matias
Posted by: tmpamlrs 13 years ago
Senior Yellow Belt
0
Hi Matias,

when I run a script with just these lines of code:


' Apply patch
'WScript.sleep 10000
Set oShell1 = CreateObject("WScript.Shell")
oShell1.CurrentDirectory="C:\oracle\product\11.2.0\client_1\12429528"
oShell1.Run "opatch apply -silent -force -ocmrf C:\oracle\product\11.2.0\client_1\OPatch\ocm.rsp",1,True


it works fine. These have just been copied and pasted from my original script which gives the error?
Posted by: tmpamlrs 13 years ago
Senior Yellow Belt
0
Having had a dig around it seems that the Environment Variables are set but not available to the running wscript process. There are ways to broadcast the changes with VB but too complex for my needs. I'll stick with a separate script.
Posted by: anonymous_9363 13 years ago
Red Belt
0
As you've probably discovered, VBS sets System environment variables OK, just not for the current session. If you make the environment variables "User" instead of "System", it should work fine.
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ