Monday, August 18, 2014

Compile Oracle EBS forms and/or libraries

1. Use below steps as Applmgr to compile one R12 form in $CUSTOM_TOP/forms/US directory. Note frmcmp_batch.sh shall exist in $ORACLE_HOME/bin.

$ export FORMS_PATH=$FORMS_PATH:$AU_TOP/forms/US:$AU_TOP/resource:$CUSTOM_TOP/forms/US
$ cd $CUSTOM_TOP/forms/US
$ mv FORM_NAME.fmx FORM_NAME.fmx_BK (or delete it)
$ chmod 664 FORM_NAME.fmb (to make it -rw-rw-r--. This step seems optional).

$ frmcmp_batch.sh module=FORM_NAME.fmb userid=apps/XXXpwd output_file=FORM_NAME.fmx module_type=form compile_all=yes

If it works, it shall say "Created form file FORM_NAME.fmx". And new time stamp for two files FORM_NAME.fmb and FORM_NAME.fmx.

2. To compile only library (.pll) files, env variable $FORMS_PATH is not needed. Go to $AU_TOP/resources and run the command:

$ cd $AU_TOP/resource
$ frmcmp_batch.sh module=FORM_NAME.pll userid=apps/XXXpwd module_type=library compile_all=special batch=yes

After it completes, new timestamp will be on FORM_NAME.pll and FORM_NAME.plx without doing anything on .fmb and .fmx files (in $CUSTOM_TOP/forms/US if it is a custom form). The file size on FORM_NAME.pll may become bigger. Use command to check and compare contents:

$ adident Header $AU_TOP/resource/FORM_NAME.pll 

Notes:
(1). If option "batch=yes" is used, progress and error messages will not echo out on the screen when the commend runs. But they will be written to .err file in current directory.
(2). If it gets ORA-12154 error in R12, the workaround is to modify $TNS_ADMIN variable in frmcmp_batch.sh (Doc ID 431324.1).
export TNS_ADMIN=${TNS_ADMIN:-$ORACLE_HOME/network/admin}
(3). For a non-Applmgr user to compile a R12 form, it is necessary to change permission on a set of files (Doc ID 561334.1). Make sure ORACLE_HOME points to 10.1.2 location.
chmod +rx $ORACLE_HOME
chmod +rx $ORACLE_HOME/bin
chmod +rx $ORACLE_HOME/bin/frm*
chmod -R +rx $ORACLE_HOME/lib
chmod +rx $ORACLE_HOME/forms
chmod -R +rx $ORACLE_HOME/forms/mesg
chmod -R +rx $ORACLE_HOME/forms/admin
chmod -R +rx $ORACLE_HOME/oracore
chmod +rx $ORACLE_HOME/nls
chmod -R +rx $ORACLE_HOME/nls/data
chmod +rx $ORACLE_HOME/rdbms
chmod -R +rx $ORACLE_HOME/rdbms/mesg
chmod +rx $ORACLE_HOME/ldap
chmod -R +rx $ORACLE_HOME/ldap/mesg
chmod -R +rx $ORACLE_HOME/ldap/admin
chmod +rx $ORACLE_HOME/network
chmod -R +rx $ORACLE_HOME/network/admin
chmod -R +rx $ORACLE_HOME/jre
chmod -R +rx $ORACLE_HOME/procbuilder

(also go to $CUSTOM_TOP/forms/US, and give 666 to .fmx and .fmb files so that user can re-create the form files.) 
Note: after above grants, sqlplus is still not available to other users but form compile shall work.

3. Use ADADMIN to compile (or re-generate) multiple forms. The steps are documented in very good document: How To Regenerate Forms Library Files Using "adadmin" (11i & R12) (Doc ID 141118.1)
A) Select the "1. Generate Applications Files menu" option.
B) Then select the "2. Generate forms files" option.
C) Choose the number of workers (default is the # of CPUs in the server).
D) Enter "yes" to regenerate PL/SQL library files (.pll extension)
E) Enter "yes" to regenerate Forms Menu files (.mmb -> .mmx extension)
F) Enter "yes" to regenerate Forms Executable files (.fmb->.fmx extension)
G) Enter the list of products, by short name as they are listed in "$APPL_TOP/" (all OR ont, po, fnd, ar, gl)
H) Enter "No" to generate specific files for each product. If you like to generate specific files for each product, you may answer "Yes" here and a list of files will be displayed
I) Enter "all" to generate all the previously selected items for all languages, or only some of the installed languages.
J) Shows your default and/or selected languages
K) Enter "yes" if the languages selected are the desired languages

yes on F) will give new timestamp on .fmx files. After answered yes on D), some .plx files get new timestamp, but no .pll files get new timestamp.  I used adadmin to compile all forms in an instance and got one error:

The following Oracle Forms objects did not generate successfully:
ap      forms/US        APXWCARD.fmx

An error occurred while generating Oracle Forms objects.
Continue as if it were successful [No] :


adadmin log does not give much details on the error. So, I ran the command to compile this form individually:

$ cd $AP_TOP/forms/US
$ mv APXWCARD.fmx APXWCARD.fmx_BK_04292015
$ export FORMS_PATH=$FORMS_PATH:$AU_TOP/forms/US:$AU_TOP/resource:$AP_TOP/forms/US

$ frmcmp_batch.sh module=$AU_TOP/forms/US/APXWCARD.fmb userid=apps/APPS_PWD output_file=APXWCARD.fmx module_type=form compile_all=yes

FRM-30064: Unable to parse statement select distinct full_name, employee_number, date_of_birth, pa.person_id
from per_all_people_f pap,
financials_system_parameters fsp,
per_assignments_f pa
where (trunc(sysdate) between pap.effective_start_date and pap.effective_end_date)
and (trunc(sysdate) between pa.effective_start_date and pa.effective_end_date)
and pap.business_group_id = fsp.business_group_id
and pa.business_group_id = fsp.business_group_id
and pap.person_id = pa.person_id
and pa.assignment_type = 'E'
order by upper(full_name).
ORA-01791: not a SELECTed expression
Record Group FULL_NAME
Form: APXWCARD

FRM-30085: Unable to adjust form for output.
Form not created

To fix the problem, check the file version:
$ strings $AU_TOP/forms/US/APXWCARD.fmb | grep '$Header'
FDRCSID('$Header: APPSTAND.fmb 120.6.12010000.6 2010/03/10 12:58  dbowles ship     $');
FDRCSID('$Header: APXWCARD.fmb 120.16.12010000.14 2010/02/22 22:27  meesubra ship   $');

Doc ID 1314734.1 says it hits a database bug. So, there is always a risk of failures from compiling all forms.

4. Write a script to compile forms file

~~~~~~~~~~~~~~ Script to compile one custom form ~~~~~~~~~~~~~~
# Call:  $ ./script_name.sh forms_name
#
export CUSTOM_TOP=$APPL_TOP/custom     # where the custom form .fmb file is saved under
export FORMS_PATH=$FORMS_PATH:$AU_TOP/forms/US:$AU_TOP/resource:$CUSTOM_TOP/forms/US

Passwd='appsPWD'
custom_top=$CUSTOM_TOP/forms/US

cd $custom_top
custom_form=$1

frmcmp_batch module=$custom_form.fmb userid=apps/${Passwd} output_file=$custom_form.fmx module_type=form compile_all=yes batch=yes

exit 0

~~~~~~~~~~~~~~~~ Compile multiple forms ~~~~~~~~~~~~~~~~~
/path/to/script_name.sh forms_name1
/path/to/script_name.sh forms_name2
/path/to/script_name.sh forms_name3


UPDATES: If frmcmp_batch.sh in R12.1.3 gets ORA-12154 error (or error relates to listener), modify it with workaround described in Dec ID 431324.1 on $TNS_ADMIN:

TNS_ADMIN=${TNS_ADMIN:-$ORACLE_HOME/network/admin}
export TNS_ADMIN

Relinek apps executable file

1. Relink the AutoInvoice Master program (report) as follows: (refer to Doc ID 1209514.1)

a) Log into the Operating System as APPLMGR (on CM node)
b) $ cd $AR_TOP/bin
c) Make a backup copy on file RAXMTR
d) Make sure that Autoinvoice is not running (by checking concurrent jobs)
e) Run the relink script
    $ adrelink.sh force=y ranlib=y "ar RAXMTR"
 
=====log on the screen ==============================
  .....
  Done with link of ar executable 'RAXMTR' on Fri Jul 18 12:51:41 EDT 2014
  Done relinking module RAXMTR in product ar
  Done with link of product 'ar' on Fri Jul 18 12:51:41 EDT 2014
  adrelink is exiting with status 0
  End of adrelink session
  Date/time is Fri Jul 18 12:51:41 EDT 2014

2. To relink 10.1.2 reports executables:
a) $ cd $ORACLE_HOME/reports/lib (or $ORACLE_HOME/reports/lib32)
b) $ make -f ins_reports.mk install

3.To relink 10.1.2 forms executables:
a) $ cd $ORACLE_HOME/forms/lib (or $ORACLE_HOME/forms/lib32)
b) $ make -f ins_forms.mk install

4. Use adadmin to relink all apps programs
   choices:  2 => 1
    If all worked, you will see " adrelink is exiting with status 0 " at the end.
    Log file is $APPL_TOP/admin/${TWO_TASK}/log/adrelink.log

5. Regenerate the jar files with force:
 $ adadmin
   1 => 4. Make sure that you choose force equals Yes.

NOTES/UPDATES
1: Oracle usually suggests "regenerate the jar files with force" after "relink" all form excutables.

2: If below errors exist in the make log file:
    /usr/lib/libXtst.so.6: undefined reference to `__stack_chk_fail@GLIBC_2.4'
    /usr/lib/libXtst.so.6: undefined reference to `__fprintf_chk@GLIBC_2.3.4'
    /usr/lib/libXtst.so.6: undefined reference to `__sprintf_chk@GLIBC_2.3.4'

The fix is to update a required link to a Motif library (as root)
  # unlink /usr/lib/libXtst.so.6
  # ln -s /usr/X11R6/lib/libXtst.so.6.1 /usr/lib/libXtst.so.6

Before the change
$ ls -al /usr/lib/libXtst.so.6
lrwxrwxrwx 1 root root 16 Oct 11  2012 /usr/lib/libXtst.so.6 -> libXtst.so.6.1.0

After the fix, the result shall be
$ ls -al /usr/lib/libXtst.so.6
lrwxrwxrwx 1 root root 29 Jun 18 2014 /usr/lib/libXtst.so.6 -> /usr/X11R6/lib/libXtst.so.6.1
$ ls -al /usr/X11R6/lib/libXtst*
lrwxrwxrwx 1 root root    14 Oct 18  2011 /usr/X11R6/lib/libXtst.so -> libXtst.so.6.1
lrwxrwxrwx 1 root root    14 Oct 18  2011 /usr/X11R6/lib/libXtst.so.6 -> libXtst.so.6.1
-rwxr-xr-x 1 root root 17204 Feb 26  2008 /usr/X11R6/lib/libXtst.so.6.1


3: On Linux RHEL 6 and 7, R12.1 adadmin relink and/or adpatch may hit error
    libgcc_s.so: undefined reference to `__stack_chk_fail@GLIBC_2.4'

The fix is to apply patch 12415211 to 10.1.2 AND 10.1.3 ORACLE HOMES manually (see Doc ID 1525823.1). Below script shall do the job.

#!/bin/ksh
# Steps from Doc ID 761566.1 - search keyword 12415211 (patch number)
# copy file libgcc_s-2.3.2-stub.so from patch folder (
$HOME/RHEL6 in this script) to 
# $ORACLE_HOME/lib/stubs and $IAS_ORACLE_HOME/lib/stubs

echo $ORACLE_HOME
cd $ORACLE_HOME/lib
cp -p -R stubs stubsORIG_`date +%H%M`
pwd
cd stubs
ls -al libgcc_s-2.3.2-stub.so*
cp -p $HOME/RHEL6/libgcc_s-2.3.2-stub.so .
ln -s libgcc_s-2.3.2-stub.so libgcc_s.so.1
ln -s libgcc_s.so.1 libgcc_s.so
ls -al libgcc_s*.*

# -rw-r--r-- 1 id xxx 12246 Jul 27  2011
$ORACLE_HOME/lib/stubs/libgcc_s-2.3.2-stub.so
# lrwxrwxrwx 1 id xxx  13 Jun  2 16:32
$ORACLE_HOME/lib/stubs/libgcc_s.so -> libgcc_s.so.1
# lrwxrwxrwx 1 if xxx  22 Jun  2 16:32
$ORACLE_HOME/lib/stubs/libgcc_s.so.1 -> libgcc_s-2.3.2-stub.so
# ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
echo $IAS_ORACLE_HOME
cd $IAS_ORACLE_HOME/lib

cp -p -R stubs stubsORIG_`date +%H%M`
pwd
cd stubs
ls -al libgcc_s-2.3.2-stub.so*
cp -p $HOME/RHEL6/libgcc_s-2.3.2-stub.so .
ln -s libgcc_s-2.3.2-stub.so libgcc_s.so.1
ln -s libgcc_s.so.1 libgcc_s.so
ls -al libgcc_s*.*


4: One day, after I applied patches to ORACLE HOMEs and applied an AR patch, some AR forms hang and get frozen forever without any error or warning message. The issue was fixed by running steps 3 and 5 above (on each Web node).


Friday, August 8, 2014

R12 Patchset Level, R12 Apps code Level

How to determine R12 Patchset Level (or Module code level) , and module is installed/implemented or not (Doc ID 443699.1)

1. As applmgr or OS environment owner
(a) source environment
(b) login as apps
(c) SQL> @$AD_TOP/sql/adutconf.sql

The adutconf.sql script will create a text file adutconf.lst containing version information and product top information.  There is a section->”Product Installation Status, Version Info and Patch Level”, e.g.
     Product    Appl Status    Version    Patchset Level
     AD           Shared           12.0.0      R12.AD.B.3         

     FND         Installed         12.0.0      R12.FND.B.3       <-- call this "FND code level" also
  • Implemented product has status Installed.
  • Not installed Product has the Status Inactive.
  • Products with status Shared are not fully implemented - only partially installed for dependent Product(s).
  Note: there are exceptions. e.g. WebEDI module (BNE) may be used even its status is Inactive.
           AD = Applications DBA,  FND = Application Object Library (AOL, i.e. Foundation tables). 

2.  Doc ID 550654.1 (for R12.1)
Login to OAM. Choose menu “OAM Support Cart” in upper right hand corner
Navigate to :
(a) Support Cart –> Applications Signature –> Collect –> Check “Product Information” box
(b) Click on “View” (eyeglasses) to get the patchset level report

3.  Script (similar to the one for 11i in Doc ID 443699.1)
SELECT a.application_name, a.application_short_name, a.product_code,  b.patch_level, DECODE (b.status, 'I', 'Installed', 'S', 'Shared', 'Not Installed - N/A') status, b.last_update_date, b.tablespace
FROM  apps.fnd_product_installations b, apps.fnd_application_vl a,
WHERE a.application_id = b.application_id
-- and b.status=’I’
order by a.application_short_name asc;

--  Not sure what is in this table
SELECT app_short_name, MAX(patch_level)
FROM apps.ad_patch_driver_minipks
GROUP BY app_short_name order by app_short_name; 

Applications code level?

SQL> select release_name from apps.fnd_product_groups;
12.1.3