Wednesday, May 30, 2007

Configurng 10g R2 RAC for Database and 11i Systems

Last year during Collaborate - 2006 at Nashville, I presented this paper on configuring 10g R2 RAC for database and 11i E-Business Suite systems .

You can download the presentation at http://www.japhi.com/dbsig/presentations/Oracle10gRAC_Collaborate%2006.ppt

Listener Creation error while doing 10g R2 RAC on 11i

Issue with 10gR2 RAC Listener while creating 11.5.10.2 on 10g R2 RAC cluster.

Couple of weeks back while we were creating 11i instances on 10g R2 RAC cluster, we encountered this interesting issue. We were following note 362135.1 and were cruising smoothly until we hit this bug when we were enabling Autoconfig on the DB tier. The AutoConfig would error out consistently failing to connect to the DB.

We saw the following error stack in the logfile

TNSLSNR for Linux: Version 10.2.0.3.0 - ProductionSystem parameter file is /u02/oracle/dev1/10.2.0.3/network/admin/dev11_ordev01/listener.ora

Log messages written to /u02/oracle/dev1/10.2.0.3/network/log/dev11.logTNS-01151: Missing listener name, dev11, in LISTENER.ORAListener failed to start.

See the error message(s) above...


It was clear that the listener was looking for listener named dev11 which in this case is SID in the RAC environment.

As per the Autoconfig template adlsnr10RAC.ora in $ORACLE_HOME/appsutil/template directory , it should look for LISTENER_%s_dbhost% which translates to LISTENER_ordev01

We struggled for couple of days while we worked with Oracle Support on Sev1 TAR on this issue.We even thought of creating a custom template to work around the issue.

Finally it turned out that we hit Bug# 5936694. We had to get new version for ApplyDatabase.java . Incidentally this bug was being worked on for Release 12, but we hit as well. More over this is DB tier related bug, so Apps version wouldnt matter anyways.


So the solution was to get ApplyDatabase.class to 115.98. It comes with version 115.97 in 11.5.10.2 and Release 12 builds.

Refer to Metalink note 421121.1

Error using Context Editor in OAM

Error when using OAM Context editor

Recently encountered a bug while updating the config values using OAM context editor

Failed when writing Context Configuration files back to file system. Possible causes: Non supported SQL92 token at position:1:

My environment was 2 node shared Application File system. This symptom was supposed to happen when you have services split across nodes. For example database, Concurrent Manager and Admin are on one node and Forms and Apache on the other node, and the error would occur writing to the CM node.


The Bug 5280086 causes update to fail on the concurrent Manager node.

But in my case, both nodes are identical and both support all services except DB. But the writing back to the file system failed on one of the nodes.

Anyways, the fix will be in ATG.PH.RUP5 (Patch 5473858 )

But meanwhile the workround is to update the FND_OAM_CONTEXT_FILES

As a precaution take a backup of this table before doing the update
create table FND_OAM_CONTEXT_FILES_BKP as select * from FND_OAM_CONTEXT_FILES;

update FND_OAM_CONTEXT_FILESset status='S' where status='F' and name='name of the context file'

Customizing AutoConfig

Customizing AutoConfig Environment

Customizing an AutoConfig enabled environment used to be cumbersome. If you have edited the final configuration files directly, they were overwritten each time AutoConfig was run.

The way to do customization was to insert custom code between the Begin Customization and End Customization blocks in the XML file. It was difficult to document and keep track of the customizations that were made. Now Oracle has come up with a better way to manage and maintain customizations.

As you have noted from the earlier discussion, AutoConfig uses template files to generate final files. So the logical place would be to create a custom template file in the same location and tell AutoConfig process to look at this custom template file rather than the normal template file that comes out of the box.

Customization Steps

First find out the corresponding AutoConfig template file for the configuration file to be customized

For example, if you want to customize $COMMON_TOP/html/bin/appsweb_$CONTEXT_NAME.cfg, execute: $AD_TOP/bin/adtmplreport.sh contextfile=$APPL_TOP/admin/$APPL_TOP/admin/(CONTEXT_NAME).xml \ target=$COMMON_TOP/html/bin/appsweb_$CONTEXT_NAME.cfg

The adtmplreport utility returns the name and location of the AutoConfig template file. For the above example it would return: $FND_TOP/admin/template/appsweb.cfg.

If you need to customize something on the Database side, you can use similar command structure $ORACLE_HOME/appsutil/bin/adtmplreport.sh contextfile= \ $ORACLE_HOME/appsutil/(CONTEXT_NAME).xml target= (Configuration File with Full Path)

Note: You cannot customize all AutoConfig template files. The AutoConfig template file cannot be customized if the "LOCK" keyword appears in the template file's entry in the product driver file.
AutoConfig ignores custom template files that are marked with "LOCK".

For example, the following entry in /admin/driver/adtmpl.drv would prevent customization of the file adconfig.txt:

ad admin/template adconfig.txt INSTE8 /admin adconfig.txt 600 LOCK


Create the custom template directoryCreate a directory named "custom" at the location where the AutoConfig template file resides.

For example, if you want to customize $FND_TOP/admin/template/appsweb.cfg, execute the following command as the applmgr user: mkdir $FND_TOP/admin/template/custom

Copy the AutoConfig template fileCopy the AutoConfig template file to the custom template file.

Execute the following command as the applmgr user: cp -i For example: cp -i $FND_TOP/admin/template/appsweb.cfg \ $FND_TOP/admin/template/custom/appsweb.cfg

Edit the custom template file Edit the custom template file with a text editor with required customizations.

Note: Do not edit the original template files. It will violate your support contract with Oracle support

Other useful features in AutoConfig

Reviewing and migrating existing customizations

If you implemented customizations between "Begin/End customization" blocks in the past, then you have to migrate those settings now. Execute the following command:

Application Tier /bin/adcustomizer.sh contextfile=$APPL_TOP/dmin/.xml
Database Tier /appsutil/bin/adcustomizer.sh contextfile=$APPL_TOP/admin/(CONTEXT_NAME).xml

This utility :
  • Detects all configuration files that have "Begin/End customizations" blocks.
  • Copies the corresponding AutoConfig template files to custom template files.
  • Appends the contents between "Begin/End customizations" blocks at the end of the custom template files.
  • Removes the "Begin/End customizations" blocks from the configuration file.

Review the logfile generated by the adcustomizer script. Ensure that all your customizations were successfully migrated to the custom template file(s) by examining the generated custom template file(s).

Adding New context variable to the context file


You can add a new context variable to be managed by AutoConfig. You can use AutoConfig context editor that comes up Oracle Applications Manager to accomplish this. Note that this is available from OAM.H patch level


Creating templates for your Custom Application

This is different from customizing an existing template. When you have a custom application developed and use CUSTOM_TOP , you can create template files in the similar directory structure as the other PRODUCT_TOPs to let AutoConfig manage the configuration process.

Tuesday, May 29, 2007

AutoConfig Internals

AutoConfig Internals

So what happens when you run adconfig.sh script? Remember it uses the XML file generated using adbldxml command. This XML file itself is build based upon the environment settings. You should ensure that the environment is set correctly by executing (CONTEXT_NAME).env script.

So one half of the equation comes from the XML file that we generated. The other half is the templates for each of the configuration file the AutoConfig process ultimately generates.

For each of the configuration file that gets generated as a result of running AutoConfig, Oracle uses a template file that come with the initial install process.

For example, if you review the adalnctl.sh file in the $AD_TOP/admin/template directory, you will see the template in action. Following is the extract from the template file adalnctl.sh located in $AD_TOP/admin/template directory

# FILENAME
# adalnctl.sh
# # DESCRIPTION
# Start / Stop Applications RPC Listener process for %s_dbSid%
# Make sure the logfile directory exists
#
if [ ! -d "%s_com%/admin/log/%s_dbSid%" ];
then mkdir -p %s_com%/admin/log/%s_dbSid%
fi;
# # Set up the logfile for this instance #
if [ -n "$SRVLOG" ];
then LOGFILE=$SRVLOG
else
LOGFILE="%s_com%/admin/log/%s_dbSid%/adalnctl.txt"
fi;
touch $LOGFILE

Notice the s_dbSid variable being used in this script. The value for this variable will be read from the XML file generated when we ran the perl script adbldxml.pl.

Following the excerpt from the actual (CONTEXT_NAME).xml file located under $APPL_TOP/admin directory. Note that I have removed <> tags to enhance readability.

oa_system
oa_system_name oa_var="s_systemname"SND1/oa_system_name global_db_name oa_var="s_dbSid"snd1/global_db_name
global_db_name oa_var="s_dbGlnam">SND1/global_db_name
db_name_lower oa_var="s_dbSidLower"snd1/db_name_lower
PRINTER oa_var="s_printer"noprint/PRINTER
!oa_system_config

Now see the extract from actual adalnctl.sh in the $COMMON_TOP/admin/scripts/ directory.

As you can see, the actual file is created as copy from the template with values replaced from XML file.

# FILENAME
# adalnctl.sh
# # DESCRIPTION
# Start / Stop Applications RPC Listener process for snd1

# # Make sure the logfile directory exists #

if [ ! -d `dirname /u10/apps/snd1/comn/admin/log/snd1_ebdev03/adalnctl.txt` ];
then mkdir -p `dirname /u10/apps/snd1/comn/admin/log/snd1_ebdev03/adalnctl.txt`
fi;
# # Set up the logfile for this instance #

if [ -n "$SRVLOG" ]; then LOGFILE=$SRVLOG
else LOGFILE="/u10/apps/snd1/comn/admin/log/snd1_ebdev03/adalnctl.txt" fi;
touch $LOGFILE

Conclusion

We have seen how AutoConfig creates the configuration files from template files.

Friday, May 25, 2007

Autoconfig Indepth

Background

Autoconfig is one of the central components of the 11i Architecture. AutoConfig is a process in which several key configuration files are managed centrally by Oracle. If you understand how Oracle uses Autoconfig process to maintain numerous configuration files such as init.ora, listener.ora, tnsnames.ora etc.., maintaining and administering 11i E-Business suite will be more fun and less stressful.
If your current system is not AutoConfig enabled, you can migrate it to start using AutoConfig.

This post is introduction to AutoConfig. My other posts discuss internals of AutoConfig and Customizing AutoConfig.

Key Terms and their meaning

CONTEXT_NAME
Logical name for your Context. Default: _In earlier versions the default was set to

AutoConfig template file
An AutoConfig template file contains named tags, which are replaced with instance-specific information when AutoConfig runs. AutoConfig template files should not be edited.For example:$FND_TOP/admin/template/appsweb.cfg

Custom template file
To customize AutoConfig-managed configuration files, copy the AutoConfig template file to the custom template file and edit the custom template file. When AutoConfig detects a custom template file, AutoConfig instantiates this file in place of the AutoConfig template file.For example:$FND_TOP/admin/template/custom/appsweb.cfg

AutoConfig template directory
Directory where Oracle delivers AutoConfig template files. There is an AutoConfig template directory for every product.Location:/admin/template /appsutil/template
For example:$FND_TOP/admin/template $ORACLE_HOME/appsutil/template

Custom template directory
Directory where you keep customized AutoConfig template files.Location:/admin/template/custom /appsutil/template/custom
For example:$FND_TOP/admin/template/custom $ORACLE_HOME/appsutil/template/custom

Configuration file
The instantiated configuration file created when AutoConfig runs.For example:$COMMON_TOP/html/bin/appsweb_$CONTEXT_NAME.cfg


Autoconfig process reads an XML file ( CONTEXT_NAME.xml located under $APPL_TOP/admin in the application tier and $ORACLE_HOME/appsutil on the Database Tier) containing parameters and values, instantiates a template, replaces the place holders with actual values from the XML file to create an actual configuuration file.

Creating an AutoConfig enabled environment on the Application Tier involve as following steps


  • Setting the environment correctly by sourcing the relevant .env file
  • Generate an XML file containing parameters and values
  • Run the AutoConfig process to create the configuration files

Lets look at the detailed steps

AutoConfig on Application Tier

  • If you have an existing xml file in the directory /admin/(CONTEXT_NAME).xml, take the backup of the file. The perl script adbldxml.pl file during this process will overwrite this file.
  • Make sure you source the environment correctly by running .env file located under $APPL_TOP. If the environment is not sourced correctly, i.e COMMON_TOP, APPL_TOP,IAS_ORACLE_HOME, ORACLE_HOME are not established correctly, the xml file being generated in this step will contain incorrect values. That would generate incorrect configuration files in the AutoConfig run phase in step
    Generate the xml file using adbldxml.pl perl script
  • cd $AD_TOP/bin
  • perl adbldxml.pl tier=apps appsuser= appspasswd= (apps password )
  • Review the xml file generated in the above step to ensure all parameters and values are set correctly.
  • Run adautocfg.sh using the above generated XML file as an input to generate the required configuration files such as tnsnames.ora, Listener.ora, etc.
    $AD_TOP/bin/adconfig.sh contextfile= appspass=


    AutoConfig on Database Tier

    Creating an AutoConfig enabled environment on the Database Tier is a similar process
  • Generate appsutil.zip file on the Application Tier
  • Ftp the appsutil.zip to the DB tier
  • Unzip and run the AutoConfig on the DB Tier

Now lets see those steps in detail


On the Application Tier (as the APPLMGR user):

  • Log in to the APPL_TOP environment (source the environment file)
  • cd $AD_TOP/bin
  • perl admkappsutil.pl
  • This will create appsutil.zip in $APPL_TOP/admin/out directory
  • Ftp the appsutil.zip created in the step 1 to the $RDBMS ORACLE_HOME on the Database Tier
  • Unzip appsutil.zip in the $ORACLE_HOME on the Database Tier.
  • cd $ORACLE_HOME on the DB Tier
  • unzip -o appsutil.zip
  • If there is (CONTEXT_NAME).xml file in $RDBMS ORACLE_HOME/appsutil, review the file and take a backup.
  • cd $ORACLE_HOME on DB Tier
  • . (CONTEXT_NAME) .env to source the environment
  • cd $ORACLE_HOME/appsutil/bin
  • perl adbldxml.pl tier=db appsuser= appspasswd=
    Review the xml file generated in the step above. Ensure that all parameters and values are set correctly.
  • Enable AutoConfig by running adconfig.sh using the above generated XML file as an input to generate the required configuration files such as tnsnames.ora, Listener.ora, etc..
    cd $ORACLE_HOME/appsutil/bin
  • adconfig.sh contextfile= ( XML file name with full path) appspass= (apps Password)





    Reviewing AutoConfig Log files

AutoConfig logfiles are stored under the following directories:

Application Tier

(APPL_TOP)/admin/(CONTEXT_NAME)/log/(MMDDhhmm)

Database (
RDBMS ORACLE_HOME)/appsutil/log/(CONTEXT_NAME)/(MMDDhhmm)


There will be one log file per AutoConfig session, and it will contain exact information for every action that AutoConfig performed.


Rolling back an AutoConfig session

Each execution of AutoConfig creates a rollback script in case you need to revert to the previous configuration settings. The script and all backup configuration files from each AutoConfig session are stored in:

Application
(APPL_TOP)/admin/(CONTEXT_NAME)/out/(MMDDhhmm)
Database
(RDBMS ORACLE_HOME)/appsutil/out/(CONTEXT_NAME)/(MMDDhhmm)
where::(MMDDhhmm) = (month, day, hour, minute of AutoConfig run)


To roll back an AutoConfig session:
restore.sh

References
Refer to Metalink Notes 165195.1 and 270519.1 for requisite patch levels