Here's the second part of the discussion begun in my last post. No big reason for the split, other than putting both parts together made the post feel too long, and at some point laziness prevailed and I couldn't bring myself to edit things down any more.
I define the following environment variables after sourcing the Apps environment file. These shortcuts allow me to navigate to frequently-used directories a bit faster. Not surprisingly, they relate to concurrent managers and patching:
export CM_LOG=$APPLCSF/$APPLLOG export CM_OUT=$APPLCSF/$APPLOUT export PATCH_BASE=/opt/oracle/stage/patch export EBS_PATCH=$PATCH_BASE/ebs export PATCH_LOG=$APPL_TOP/admin/$TWO_TASK/log export WORKER_LOG=$PATCH_LOG
Yes, those last two are duplicates, which is more an indicator of my laziness (um, I mean, reluctance to context-switch unnecessarily) than anything else.
More fun with aliases: adpatch and adctrl
The following aliases save some typing at patch time. The first invokes adpatch in a the typical way, with the benefit of not having to answer all of the startup prompts. The second, as the name of the alias suggests, allows "hot patching" for those really small patches when you don't want to put the system in maintenance mode (only for use in test systems, though, right? Of course right).
alias patch_this='adpatch patchtop=`pwd` driver=`ls u*.drv` logfile=`ls u*.drv` defaultsfile=$DEFAULTSFILE workers=$WORKERS' alias hotpatch_this='patch_this options=hotpatch'
A few things to note about using these adpatch aliases:
- It is necessary to be in the directory containing the patch driver before invoking one of the aliases, for example:
applr12@jpr12:~> cd $EBS_PATCH/6510214 applr12@jpr12:/opt/oracle/stage/patch/ebs/6510214> patch_this
- The aliases will only work on patches with 'universal' drivers, not the old-style individual copy, generate, and database patch drivers.
- The patch log file generated by using the aliases will have a .drv extension instead of .log. I've elected to live with the limitation rather than make the alias more complicated.
- Finally, it's necessary to define a WORKERS variable prior to using the aliases, either by exporting it in the .profile or defining it in an individual session.
During the patching process, the following aliases help to monitor and manage workers via adctrl:
alias adctrl_base='adctrl defaultsfile=$DEFAULTSFILE' alias show_workers='adctrl_base menu_option=SHOW_STATUS' alias start_addist='adctrl_base distributed=y worker_range=$WORKER_RANGE'
Update 04 Dec 2008: Lon White over at the Triora Group has a great (and more detailed) description of automated patching that is worth reading if you're unfamiliar with the idea of running adpatch non-interactively.
Interactive or non-interactive?
When setting up aliases for the AD utilities, I avoid using the
interactive=n option. It's a useful option in the right circumstances, but I do not place it in my aliases by default, because it interferes with my primary goal in creating the shortcuts: typing less. Consider the following, after an AutoConfig run that reset the value of the APPLSYS password in the defaults file:
applr12@jpr12:~> adadmin defaultsfile=$DEFAULTSFILE menu_option=DISABLE_MAINT_MODE interactive=n (adadmin startup stuff snipped, until...) *** Enter the ORACLE password of Application Object Library : *** AD Administration could not find a response to the above prompt or found an incorrect response in the defaults file.
If I had run adadmin in normal, interactive mode, I would have been given a chance to enter the correct password the first time around. Instead, I now have to re-run adadmin in interactive mode to provide the password. More typing, not less. Bah!
Closing notes and annoying preachiness
- I've called this short series of posts is "Enhance your applmgr .profile," but it also could have been titled "Fun with AD utility command-line options." Refer to the Oracle Applications Maintenance Utilities guides for 11i and R12 for more information, or run the various commands (adadmin, adpatch, adctrl) with the
help=yoption to see what's possible.
- I've compiled a sample applmgr .profile that incorporates the ideas presented in these posts. Feel free to copy it and revise as necessary to suit your environment.
- And now for the preachy part: As fun as it can be to devise shortcuts for your favorite administrative tasks, resist the temptation to overdo it. Remember, this is primarily about saving time and reducing errors. For example, while having an alias to bounce Apache services can be useful, assigning an alias to adstpall.sh is probably overkill.