In this post, I will cover an automatic online patching scenario.
In this example, we will apply a patch without specifying the arguments and/or our inputs one by one.. That is; we will run one command and our patch will be applied.
Note that: This is not a supported or recommend approach.. I have done this just to satisfy my curiosity and now I can say that it can be done..
Okay.. In order to get this thing work; we will use bash techniques, a pipe and an adop input file.
Lets start with the input file..
Lets start with the input file..
Generally, the Input file is read by adop and adop behaves according to the things written in the input file.
To supply an input file to adop , we create an input file using our favorite editor and use the input_file cmd argument while running the adop utility.
patches=20863040
phase=prepare,apply,finalize,cutover,cleanup
patchtop=/home/applmgr
{ echo appspassword; echo systempassword; echo adminpassword; } | adop
we use {} characters to group the three echo commands into a single output stream.
To supply an input file to adop , we create an input file using our favorite editor and use the input_file cmd argument while running the adop utility.
So we basically, supply our desired worker count , the patch we want to apply, the phases we want adop to complete and the patchtop that our patch directory resides..
Here is an example of the input file :
Following is an input_file for applying patch 20863040 which resides in /home/applmhr/20863040 directory.
workers=12patches=20863040
phase=prepare,apply,finalize,cutover,cleanup
patchtop=/home/applmgr
Okay. Using input_file we supply some mandatory arguments, as well as patch phases to have a continous adop execution , but what about the passwords? Adop requires us to provide 3 password during its run.. So lets see what we can do for this;
In the earlier releases of EBS, the defaultsfile can be used to supply the passwords to adpatch, so we could use defaultsfile to apply patches without a need to supply the passwords during the runtime.
So we need to make something else;
What about echoing and piping the passwords to the adop utility? That's make sense, but it is a little tricky..
In the earlier releases of EBS, the defaultsfile can be used to supply the passwords to adpatch, so we could use defaultsfile to apply patches without a need to supply the passwords during the runtime.
On the other hand in 12.2 , even if the adop utility uses the same adpatch in the backend; it seems we dont have such an option, as stated in "Oracle E-Business Suite Maintenance Guide" -> Only one parameter, patchtop, can currently be defined in the defaultsfile. "
What about echoing and piping the passwords to the adop utility? That's make sense, but it is a little tricky..
I am talking about someting like the following;
So we execute adop only once but make it read the inputs of our 3 echo commands.
The outputs will be read by adop one by one, so it must be in order of Apps password, System password and weblogic admin password just like we supply in a normal adop execution.
So we direct the stdout of these 3 echo commands to the stdin of the adop.
By using bracelets and semiclon we pipe the 3 outputs to the adop and wait it to read it , it reads them one by one, it thinks that it reads it from the stdin from the keyboard, but we actually use a pipe for its stdin..
But in order to apply a patch , we need to supply some more things. At this point; input_file comes into play.. As I have mentioned above, we supply our input file to the adop using input_file argument and that 's it..
Our command will be like the following;
{ echo appspassword; echo systempassword; echo adminpassword; } | adop input_file=/home/applmgr/input_erman
When we cd to it ; cd /u01/install/APPS/fs2/EBSapps/appl/au/12.0.0/perl
Okay, we have our perl modules here.. Adop perl scripts uses them..When we analyze them , we become more familiar with the patching process..
On the other hand; I will stop here :) This blog post is going beyond its objective :)
{ echo appspassword; echo systempassword; echo adminpassword; } | adop input_file=/home/applmgr/input_erman
Our one-liner is ready!
When we execute it, we will have our patch specified in our input_file will be applied.. All the adop phases will be completed ( if there will be no patch related problems)
Current Patching Session ID: 70
Node Name Node Type Phase Status Started Finished Elapsed
--------------- --------------- --------------- --------------- ------------------------------ ------------------------------ ------------
ermansserver master PREPARE COMPLETED 14-APR-15 04:11:19 +03:00 14-APR-15 05:32:38 +03:00 1:21:19
v1
APPLY COMPLETED 14-APR-15 05:33:03 +03:00 14-APR-15 05:35:32 +03:00 0:02:29
FINALIZE COMPLETED 14-APR-15 05:35:42 +03:00 14-APR-15 05:36:07 +03:00 0:00:25
CUTOVER COMPLETED 14-APR-15 05:36:17 +03:00 14-APR-15 05:50:51 +03:00 0:14:34
CLEANUP COMPLETED 14-APR-15 05:50:53 +03:00 14-APR-15 05:51:34 +03:00 0:00:41
File System Synchronization Used in this Patching Cycle: Full
File System Information:
========================
File System: SINGLE NODE INSTANCE
Node Name Node Type Current Base Other Base Non Editioned Base Inst Top
----------- ----------- ------------------------------ ------------------------------ ------------------------------ ------------------------------
ermansserver master /u01/install/APPS/fs1 /u01/install/APPS/fs2 /u01/install/APPS/fs_ne /u01/install/APPS/fs1/inst/app
ppsrv1 s/ORATEST_ermansserver
Custom File System Synchronization script: /u01/install/APPS/fs_ne/EBSapps/appl/ad/custom/adop_sync.drv
Patch Stage Top: /u01/install/APPS/fs_ne/EBSapps/patch
Online Patching Log base: /u01/install/APPS/fs_ne/EBSapps/log/adop/70
=========================================================================
= Patches Applied in the Current Patching Cycle
=========================================================================
Node Name Node Type Patch Status Run ID File System Patch Base File System Applied Base Adpatch Parameters Session Type
------------ --------- ------------- ----------- --------- ------------------------- ------------------------- -------------------- ---------------
ermansserver master 20863040 Y 78344 /u01/install/APPS/fs1 ONLINE
As you see above, there were no problems encountered.. All the phases were completed and the patch was applied.
Okay, we achieved our goal , but before finishing I want to add some more info as follows;
Note that : during the execution, our shell may display something like the following;
stty inappropriate ioctl for device
This is actually an ingorable error, as it is caused by the adop trying to use stty command to set some terminal option and because the stdin is a pipe, stty reports inappropriate ioctl for device..
In detail: adop uses stty -echo to hide our inputs.. As you may recall, when using adop to apply patches, it requires us to supply the passwords, and when we supply them, we dont see the password displayed in the terminal.. This is how adop hides the password inputs and this is why we may see this ignorable error.
This also can be seen if we look at the adop's perl scripts.. The adop file is just wrapper, it calls the adzdoptl.pl , which has a lot of libraries attached to it.
Libraries are coming from the directories present in the $PERL5LIB environment variable.
An example of PERL5LIB can be;
echo $PERL5LIB
/u01/install/APPS/fs2/FMW_Home/webtier/perl/lib/5.10.0:/u01/install/APPS/fs2/FMW_Home/webtier/perl/lib/site_perl/5.10.0:/u01/install/APPS/fs2/EBSapps/appl/au/12.0.0/perl:/u01/install/APPS/fs2/FMW_Home/webtier/ohs/mod_perl/lib/site_perl/5.10.0/x86_64-linux-thread-multi
/u01/install/APPS/fs2/EBSapps/appl/au/12.0.0/perl looks promising;
When we cd to it ; cd /u01/install/APPS/fs2/EBSapps/appl/au/12.0.0/perl
ls
ADOP ADX FND MSI TXK
So , as we see there is an ADOP directory.
So , as we see there is an ADOP directory.
cd ADOP
ls
ls
AdopMain.pm BackupUtil.pm ClonePhase.pm CommonUtil.pm DatabaseManager.pm GlobalVars.pm OtherPhases.pm PreparePhase.pm SessionManager.pm Singleton.pm
ApplyPhase.pm CleanupPhase.pm CommonBusinessRoutines.pm CutoverPhase.pm DefaultsFileUtil.pm MultiTierUtil.pm Phase.pm ServiceManager.pm SessionUtil.pm
On the other hand; I will stop here :) This blog post is going beyond its objective :)
Assalamualikum brother Erman,
ReplyDeleteI need a help, While applying the below patches i am facing difficulty.
18846723
18495036
tart time for file is: Wed Apr 27 2016 09:32:54
sqlplus -s APPS/***** @/u02/NAPEBS/APPLNAP/fs1/EBSapps/appl/ad/12.0.0/patch/115/sql/adsqlwrapper.sql '/u02/NAPEBS/APPLNAP/fs1/EBSapps/appl/ad/12.0.0/admin/sql/adinvrn2.pls &systempwd 30 29 TRUE FALSE'
ERROR:
ORA-12516: TNS:listener could not find available handler with matching protocol
stack
Also I checked the Oracle note ID atch 21624661 Fails Executing Script adinvrn2.pls (Doc ID 2071218.1)
Could not understand how to manually run the ad_invoker.grant_pkgs(21) manually.
Kindly help.
Thanks.
Yeah, document is not accurate
ReplyDeleteConnect to the database using SYSTEM user and execute. (adinvrn2.pls uses system user to connect to the database)
->
sqlplus system/SYSTEM_PASSWORD_OF_YOURS
SQL>exec ad_invoker.grant_pkgs(21);
After exec ad_invoker.grant_pkgs(21);
ReplyDeletecommit and exit
SQL>exec ad_invoker.grant_pkgs(21);
SQL>commit
SQL>exit
Thanks for your support.
ReplyDeleteThe issue fixed with below document and patch successfully applied.
adop fails with "ORA-12516: TNS:listener could not find available handler with matching protocol stack" (Doc ID 2105049.1)
Thank you very much brother.