Sunday, February 28, 2021

Apply CUP & merged patches, and run Rapid Install to configure R12.2.0

After Rapid Installation worked,  the next is to follow steps in Section 3 of Doc ID 1320300.1 to apply R12.2 Consolidated Upgrade Patch (CUP) & merged patches, and then configure R12.2.0 upgrade using Rapid Install (see EBS Upgrade Guide Release 12.0 and 12.1 to 12.2. Part No. E73540-09).

1. Pre-steps: 

a) download 2 patches to and merge them
$ cd /u01/app/patchR122/AD_source
$ ls
p10117518_R12_LINUX.zip                     
p30370733_R12.AD.C_R12_LINUX.zip   <== It includes patches 21670164 and 21833257
$ unzip p10117518_R12_LINUX.zip
$ unzip p30370733_R12.AD.C_R12_LINUX.zip
$ cd ..
$ admrgpch -s /path/to/AD_source -d /path/to/10117518_CUP11 -merge_name 10117518_cup11 -admode

Executing the merge of the patch drivers
 -- Processing patch: /path/to/AD_source/10117518
 -- Processing file: /path/to/AD_source/10117518/u10117518.drv
 -- Done processing file: /path/to/AD_source/10117518/u10117518.drv
 -- Done processing patch: /path/to/AD_source/10117518
 -- Processing patch: /path/to/AD_source/30370733
 -- Processing file: /path/to/AD_source/30370733/u30370733.drv
 -- Done processing file: /path/to/AD_source/30370733/u30370733.drv
 -- Done processing patch: /path/to/AD_source/30370733
Copying files...
5% complete. Copied 47 files of 925...
10% complete. Copied 93 files of 925...
15% complete. Copied 139 files of 925...
20% complete. Copied 185 files of 925...
25% complete. Copied 232 files of 925...
30% complete. Copied 278 files of 925...
35% complete. Copied 324 files of 925...
40% complete. Copied 370 files of 925...
45% complete. Copied 417 files of 925...
50% complete. Copied 463 files of 925...
55% complete. Copied 509 files of 925...
60% complete. Copied 555 files of 925...
65% complete. Copied 602 files of 925...
70% complete. Copied 648 files of 925...
75% complete. Copied 694 files of 925...
80% complete. Copied 740 files of 925...
85% complete. Copied 787 files of 925...
90% complete. Copied 833 files of 925...
95% complete. Copied 879 files of 925...
100% complete. Copied 925 files of 925...
Character-set converting files...
  2 unified drivers merged.
Patch merge completed successfully
Please check the log file at ./admrgpch.log.

$ cd 10117518_CUP11     <= created by admrgpch. It can be zipped up and used by other instances
$ ls 
$ find . -name adgrants.sql
./admin/adgrants.sql
$ grep Header ./admin/adgrants.sql
REM $Header: adgrants.sql 120.67.12020000.69 2020/03/20 00:56:38 jwsmith ship $

$ cp -p ./admin/adgrants.sql /to/path/for/DBA
$ ls -al /to/path/for/DBA/adgrants.sql
-rw-r--r--  1 user group  108545 Xxx 20 12:09 adgrants.sql

b) DBA work

- runs adgrants.sql (It is from patch 30370733:R12.AD.C above).
sqlplus / as sysdba @adgrants.sql APPS

- Check nothing is enabled or the view dba_audit_policies does not exist:
SQL> select distinct enabled from dba_audit_policies;

- make sure database Profile options are good to avoid below error from installing merged patch:
ORA-28003: password verification for the specified password failed
ORA-20001: Password contains the username. (GHG)
ORA-28007: the password cannot be reused

SQL> select profile,resource_name,limit from dba_profiles
where profile in ('DEFAULT','TRUSTED_ID_NO_EXPIRE')
and  resource_type = 'PASSWORD'  order by 1,2;

c) Apply patch 6767273 asked by README of 10117518 (if it has not been applied)

d) Apply two AD patches

$ cd /path/to/$TWO_TASK/fs1/EBSapps/appl
$ . ./APPS*.env
$ which adadmin
~/$TWO_TASK/fs1/EBSapps/appl/ad/12.0.0/bin/adadmin
$ adadmin 
to enable maintenance mode. Or, run SQL statement to do that. Confirm it:

SQL> select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;
FND_PROFILE.VALUE('APPS_MAINTENANCE_MODE')
--------------------------------------------------------------------------------
MAINT

$ which adpatch
~/$TWO_TASK/fs1/EBSapps/appl/ad/12.0.0/bin/adpatch

$ cd /path/to/10117518_CUP11
$ adpatch logfile=10117518.log
… … Your default directory is '/u02/app/$TWO_TASK/fs1/EBSapps/appl'
... ...
No of records processed =415053 Updating Snapshot Tables...Start time:Mon XXX 28 2021 13:09:13
Done Updating Snapshot Tables for the above rows...End Time:Mon XXX 28 2021 13:09:14
... ...
No of records processed =654892
   Updating Snapshot Tables...Start time:Mon Jun 28 2021 13:09:43
      Done Updating Snapshot Tables for the above rows...End Time:Mon XXX 28 2021 13:09:43
Preseeded snapshot import completed successfully.
... ...
The default directory is [/path/to/10117518_CUP11] :
Please enter the name of your AutoPatch driver file : u_10117518_cup11.drv

It takes about 15 minutes. The log file is saved in $APPL_TOP/admin/$TWO_TASK/log. 
 
Confirm two database accounts APPS_NE and GHG are created, and 5 patches were applied.

SQL> select * from dba_users where username in ('GHG', 'APPS_NE');
SQL> select bug_number, to_char(creation_date,'DD-MON-RRRR HH24:MI:SS') date_applied
from apps.ad_bugs
where bug_number in ('6767273', '21670164','21833257', '10117518', '30370733' );

Post-step: compile APPS schema

$ adadmin
  a. Run adadmin => Compile/Reload Applications Database Entities menu 
                            => Compile APPS schema.
  b. Enter "No" when prompt for Run Invoker Rights processing in incremental mode [No] ?

SQL> set lines 333 pages 123;
 col owner for a20;
 col object_name for a45;
 col object_type for a20;
SQL> SELECT owner, substr(object_name,1,30) object_name, object_type, status
          FROM dba_objects where status = 'INVALID'
        ORDER BY owner, object_type, object_name;

2. Preinstall 3 patches
Apply the pre-upgrade patches that were released after the Consolidated Upgrade Patch 30399970. See Doc ID 1448102.2. In January 2021, the document added patch 31745734.  We did not hit problem in upgrading R12.1.3 to R12.2 without applying patch 31745734, prior to January 2021.

$ echo $ORACLE_HOME
/u02/app/$TWO_TASK/fs1/EBSapps/10.1.2
$ echo $FILE_EDITION
run

$ ls -al $AU_TOP/patch/115/driver
-rwxr-xr-x 1  user group      233 Nov 24  2012 augenmsg.drvx
-rwxr-xr-x 1  user group      755 Nov 24  2012 ausstats.drvx
-rw-r--r-- 1 user group 83457868 Nov 25  2012 u10124646.drv
-rw-r--r-- 1 user group 14305818 Nov 25  2012 u10201000.drv

$ cd /path/to/preinstall
$ unzip p30399970_12.2.0_R12_LINUX.zip
$ cd 30399970
$ ls
$ adpatch preinstall=y
(Or, $ adpatch preinstall=y defaultsfile=$APPL_TOP/admin/$TWO_TASK/adalldefaults.txt logfile=30399970.log driver=u30399970.drv )

Take default answer to all questions. It does not ask for db passwords. 
It does make, relink, etc. New files are created in folder: 
$ ls -al $APPL_TOP/admin/$TWO_TASK

$ cd ../
$ unzip p31219447_R12.PA.C_R12_GENERIC.zip
$ cd 31219447
$ ls
$ adpatch preinstall=y

$ cd ..
$ unzip p31745734_R12.FND.C_R12_GENERIC.zip
$ cd 31745734
$ adpatch preinstall=y logfile=u31745734.log driver=u31745734.drv
$ egrep -i "Error|Failed|ORA-" ... /log/u31745734.log

By now, two patches are saved to $APPL_TOP/admin/$TWO_TASK/preinstall
$ ls -al $APPL_TOP/admin/$TWO_TASK/preinstall

-rw-r--r-- 1 user group 342037 Jan 27 15:46 u30399970.drv
-rw-r--r-- 1 user group   1323   Jan 27 15:48 u31219447.drv
-rw-r--r-- 1 user group   1292   Jan 27 16:54 u31745734.drv

3. Merge 4 patches 

$ echo  $ORA_NLS10
$RUN_BASE/EBSapps/10.1.2/nls/data/9idata
$ cd $AU_TOP/patch/115/driver
$ ls -al $AU_TOP/patch/115/driver
-rwxr-xr-x 1  user group      233 Nov 24  2012 augenmsg.drvx
-rwxr-xr-x 1  user group      755 Nov 24  2012 ausstats.drvx
-rw-r--r-- 1 user group 83457868 Nov 25  2012 u10124646.drv
-rw-r--r-- 1 user group 14305818 Nov 25  2012 u10201000.drv

$ admrgpch -d . -preinstall -master u10124646.drv
Executing the merge of the patch drivers
 -- Processing file: /fsahu01/app/FAHPROD/fs1/EBSapps/appl/admin/FAHPROD/preinstall/u30399970.drv
 -- Done processing file: /fsahu01/app/FAHPROD/fs1/EBSapps/appl/admin/FAHPROD/preinstall/u30399970.drv
 -- Processing file: /fsahu01/app/FAHPROD/fs1/EBSapps/appl/admin/FAHPROD/preinstall/u31219447.drv
 -- Done processing file: /fsahu01/app/FAHPROD/fs1/EBSapps/appl/admin/FAHPROD/preinstall/u31219447.drv
 -- Processing file: /fsahu01/app/FAHPROD/fs1/EBSapps/appl/admin/FAHPROD/preinstall/u31745734.drv
 -- Done processing file: /fsahu01/app/FAHPROD/fs1/EBSapps/appl/admin/FAHPROD/preinstall/u31745734.drv
 -- Processing file: u10124646.drv
 -- Done processing file: u10124646.drv
4 unified drivers merged.
Patch merge completed successfully
Please check the log file at ./admrgpch.log.

$ ls -altr    <== to see new file u_merged.drv
-rwxr-xr-x 1 user group      755      Nov 24  2012 ausstats.drvx
-rw-r--r-- 1 user group 83457868   Nov 25  2012 u10124646.drv
-rw-r--r-- 1 user group 14305818   Nov 25  2012 u10201000.drv
-rwxr-xr-x 1 user group      242      Jan  27  11:30 augenmsg.drvx
-rw-rw-r-- 1 user group 83855365 Jan  27  11:38 u_merged.drv
-rw-rw-r-- 1 user group     1595      Jan 27  11:38 admrgpch.log

4. Apply the merged patch (with 10124646). Note: it may take more than 4 hours.

Database pre-steps by SYSTEM (in my instance to avoid error during patching):
a. SQL> drop index AP.AP_LIABILITY_BALANCE_N4;   
    If it exists, drop it to avoid error on aplbupgind.sql

b SQL> SELECT RULE_ID , LEVEL_ID , LEVEL_VALUE , LEVEL_VALUE_APPLICATION_ID , COUNT(*) 
FROM APPLSYS.FND_FORM_CUSTOM_SCOPES 
GROUP BY RULE_ID , LEVEL_ID , LEVEL_VALUE , LEVEL_VALUE_APPLICATION_ID 
HAVING COUNT(*) > 1;
If duplicate row exists, delete it to avoid error "Index FND_FORM_CUSTOM_SCOPES_U1 does not exist in APPLSYS" (Doc ID 1591975.1)

c. SQL> GRANT DROP ANY PROCEDURE TO APPS;     
    To avoid privilege error from gldrpzfa.sql, gldrpzsa.sql

d. Confirmed Service Contracts (OKS) is not being used. See Doc ID 741800.1 about errors on OKSCVTIM.sql,  OKSCTIMZ.sql, OKSRTIME.sql on table OKC.OKC_TIMEVALUES_B.

e. SQL> select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;
FND_PROFILE.VALUE('APPS_MAINTENANCE_MODE')
------------------------------------------------------
MAINT

Apply the merged patch:
$ echo $FILE_EDITION
run
$ cd $AU_TOP/patch/115/driver
$ adpatch options=nocopyportion,nogenerateportion logfile=merge_10124646.log driver=u_merged.drv

The default directory is [$AU_TOP/patch/115/driver]:

AutoPatch will not execute the following actions in your patch driver file
because you requested this using the keyword argument 'options='.
  libout
  copy
  forcecopy
  jcopy
  genform
  libin
  link
  genrep
  genrpll
  genfpll
  genmenu
  genmesg
  genwfmsg
  makedir
  gengpll
  genogd
Do you want to run AutoPatch with these actions turned off [Yes] ?   <= Enter to accept Yes

It takes totally 3 hours or more than 4 hours (depending on the database size). It may spend long time on adobjcmp.sql (twice) and on other sql scripts.  After more than 2 hours (running db scripts), I had to use adctrl to skip (#8) OKS scripts 3 times.

Logs are in $APPL_TOP/admin/$TWO_TASK/log. Files *_preenv.lst & *postenv.lst in  $APPL_TOP/admin/$TWO_TASK/log list invalid objects.

By now, steps in Section 3 of Doc ID 1320300.1 are completed. Below query returns 6 rows:

SQL> select * from ad_bugs
where bug_number in ('10117518','30370733','30399970','31219447','31745734','10124646')
order by creation_date desc;

Disable maintenance mode by adadmin, or run
SQL> @$RUN_BASE/EBSapps/appl/ad/12.0.0/patch/115/sql/adsetmmd.sql DISABLE

$ cd $TWO_TASK
$ du -sh fs*
31G     fs1
28G     fs2
32K     fs_ne 

Backup apps file system and database (Recommended!)

5. Prepare and Run Rapid Install to configure and finish the 12.2.0 Upgrade 
(page 111 (4-49), Oracle® EBS Upgrade Guide Release 12.0 and 12.1 to 12.2. Part No. E73540-09)

$ cd $TWO_TASK/fs1/EBSapps/appl
$ . ./APPS*.env

$ grep s_dbhost $CONTEXT_FILE
         <dbhost oa_var="s_dbhost">db_nodename</dbhost>

a) Clean up old node information. 
SQL> exec fnd_conc_clone.setup_clean;
SQL> select * from fnd_nodes;

Notes: This is a very important and necessary step. Without it, it may hit error on finding adop_valid_nodes when applying R12.AD.C.Delta.12 patch (30628681) later and other strange errors. If so, it is better to start the upgrade again from the beginning.

b) Create appsuil.zip file for db node
$ cd $AD_TOP/bin
$ perl admkappsutil.pl
Copy $INST_TOP/admin/out/appsutil.zip to database node

c) Run autoconfig on db node
$ perl adbldxml.pl jtop=$ORACLE_HOME/jdk
Starting context file generation for db tier..
Enter the value for Display Variable: aebsw1d:0.0
The context file has been created at: $ORACLE_HOME/appsutil/<CONTEXT_FILE>.xml
$ ./adconfig.sh 
Enter the full path to the Context file:

d) Make sure FAILED_LOGIN_ATTEMPTS is 'UNLIMITED' for database profile used by APPS account.
SQL> select profile, resource_name, limit  from dba_profiles where profile in (
select profile from dba_users where username = 'APPS')
and resource_type = 'PASSWORD'
order by resource_name;

Notes: Without this setting, Rapid Install on completing the process of configuring R12.2.0 will fail with "Database Availability" on the last GUI screen because APPS account will be locked. If this happens, do not click on "Retry" after APPS account is unlocked as it will skip some important steps, such as creating entire folder user_projects under $FMW_HOME. You have to launch Rapid Install to run configuration from beginning until it completes successfully.

e) Drop table ADX_PRE_AUTOCONFIG from APPS schema (which will be created by autoconfig in APPLSYS schema)
$ cd $AD_TOP/patch/115/sql
$ sqlplus apps/appsPWD 
SQL> select owner, object_type from dba_objects 
  where object_name in ('ADX_PRE_AUTOCONFIG') ;
SQL> @txkDropAdxPreAutoConfig.sql
SQL> select * from dba_objects where object_name in ('ADX_PRE_AUTOCONFIG') ;
no rows selected

f) Make sure database accounts APPS and SYSTEM are not locked, and verify other info:
SQL> select SERVICE_ID,NAME from dba_services where name='ebs_patch';
SERVICE_ID NAME
---------- -----------------
         8 ebs_patch
SQL> select fnd_web_sec.validate_login('GUEST','ORACLE') valid from dual;
VALID
------------------------------------------------------
Y
SQL> select fnd_profile.value('APPS_MAINTENANCE_MODE') from dual;
FND_PROFILE.VALUE('APPS_MAINTENANCE_MODE')
------------------------------------------------------
NORMAL


g) run Rapid Install to configure R12.2.
$ echo $FILE_EDITION
run
$ echo $RUN_BASE
/u02/app/$TWO_TASK/fs1
$ echo $ORACLE_HOME
$RUN_BASE/EBSapps/10.1.2
$ export DISPLAY=123.45.678:0.0

$ cd /path/to/rapidSTARTCD/startCD/Disk1/rapidwiz
$ ./rapidwiz

choose Upgrade to Oracle E-Business Suite Release 12.2.0
            "Configure Updated Release 12.2.0 Instance" => use $CONTEXT_FILE
enter password for apps, applsyspub, guest and WebLogic Admin
System check marks on GUI shall all be green.

It stays at 0% for a log time. By the end, a final GUI shall show all green check marks and say "This instance passed all of the post-install tests". It writes some error message from autoconfig and others to log files at $INST_TOP/logs. The log file size on /sf1 shall be about 190k. If the log size is much smaller, most likely it skipped some steps due to a problem. The end of it shall have:
… … 
riwTDBup.sh exiting with status 0
Apps ORACLE_HOME connection test has succeeded
Environment File
-----------------
   ADOVARS environment file passes instantiated variables test:
      File = $RUN_BASE/EBSapps/appl/admin/adovars.env
   APPSCONFIG passes instantiated variables test:
      File =
$RUN_BASE/EBSapps/appl/admin/adconfig.txt
DBC File
---------
   DBC file passes instantiated variables test: File = $FND_TOP/secure/${TWO_TASK}.dbc
OS Password is null.  SSH is disabled.
WLS Domain Validation
----------------------
EBS Domain validation Successful for RUN filesystem.
-------------------------------------------------
EBS Domain validation Successful for PATCH filesystem.
-------------------------------------------------
DoInstallPanel - Summary Text
The Rapid Install Wizard will now run AutoConfig to configure this node:


The end of log file on /sf2 shall have:
… … 
AutoConfig completed successfully.
FINISHED INSTALL PHASE : APPLTOP : Web MMM 6 12:23:34 EDT 2021
… …  
stty: standard input: Inappropriate ioctl for device
ConfigAppNode :Please refer to the remaining logs on applications node at - $INST_TOP/logs/xxxx1143.log

$ grep s_dbhost $CONTEXT_FILE
         <dbhost oa_var="s_dbhost">db_nodename</dbhost>          (without "domain.com")

$ grep -i APPLPTMP $CONTEXT_FILE
         <APPLPTMP oa_var="s_applptmp" osd="UNIX">/usr/tmp</APPLPTMP>
SQL> select value from v$parameter where name='utl_file_dir';
VALUE
------------------------------------------------------------------------
/path/to/EBSDEV/utl_dir

Ensure that the $APPLPTMP environment variable is set to the first database directory
defined for PL/SQL file I/O. See Doc ID 2525754.1 for more on UTL_FILE_DIR. Concurrent job uses $APPLPTMP (and this can be done later).
$ vi $CONTEXT_FILE   (to make s_applptmp use /path/to/EBSDEV/utl_dir)

At this stage, adadmin and adautocfg.sh all work.  I did run adautocfg.sh to confirm no error.
$ cd $ADMIN_SCRIPTS_HOME
$ ./adautocfg.sh
… …  AutoConfig completed successfully.

If AutoConfig failed because of table APPLSYS.ADX_PRE_AUTOCONFIG, drop it. When autoconfig is re-run, table ADX_PRE_AUTOCONFIG will be created with the correct number of columns (Doc ID 1912332.1).
SQL> drop table APPLSYS.ADX_PRE_AUTOCONFIG;

$ cd $FMW_HOME
$ ls -al user_projects        <= to confirm it exists. If not, Configuration ran wrong.
$ cd 
$ cd $TWO_TASK
$ du -h --max-depth=1    ( or, $ du -sh fs* )
33G     ./apps
3.0G    ./inst
32G     ./fs1
29G     ./fs2
32K     ./fs_ne

After Rapid Install configuration completed, do not run ADSplice for CUSTOM TOPs now. If run it, ADOP later may have problem on FS_CLONE. EBS Upgrade Guide page 130 says:
Do not run adsplice when you are at the Oracle E-Business Suite Release 12.2.0 level. Before running adsplice, you must upgrade to R12.AD.C.Delta.5 and R12.TXK.C.Delta.5 Release update packs or higher for AD and TXK. (They will be applied by using adop).