Blog dedicated to Oracle Applications (E-Business Suite) Technology; covers Apps Architecture, Administration and third party bolt-ons to Apps

Monday, June 30, 2008

Database scripts for estimating growth

One of the simplest scripts is based on addition of datafiles and is described in metalink note 135294.1

=======
Script:
=======

select to_char(creation_time, 'RRRR Month') "Month",
sum(bytes)/1024/1024
"Growth in Meg"
from sys.v_$datafile
where creation_time > SYSDATE-365
group by to_char(creation_time, 'RRRR
Month');


==============================
Sample Output from the script:
==============================

Month
Growth in
-------------------------------- ----------
2000 December 1068.625
2001 February 70

Using Big IP hardware load balancers with 11i and R12

All our Production instances are load balanced on web tier. We have multiple app tiers for each instance on which Apache and forms is running. The user point of entry is the load balancer URL which further redirects the traffic to the individual app servers. Oracle uses BigIP load balancer on their internal Global Single Instance also. Here are some very good metalink notes which give you a good overview:


380489.1 Using Load-Balancers with Oracle E-Business Suite Release 12 (Relevant for 11i too)
217368.1 Advanced Configurations and Topologies for Enterprise Deployments of E-Biz Suite 11i
601694.1 How To Check Session Persistence On a BigIP F5 Load Balancer
456906.1 11i/R12 How to Debug "Transaction Context Is Lost"
387306.1 Random error Your login session has expired when using Load Balancing

When a hardware load balancer is used, the context file variables which need to be changed are:

s_webentryurlprotocol http or https
s_webentryhost load balancer hostname
s_webentrydomain load balancer domain name
s_active_webport load balancer port
s_login_page load balancer url
s_external_url load balancer url

Load balancer settings:

persistence timeout = 1 day
persistence type = cookie based persistence

Friday, June 27, 2008

Does Autoconfig modify init.ora ?

Autoconfig or adconfig does not modify the database initialization parameters. Metalink Note 377398.1 says:

QUESTION 2: Is Autoconfig modifying init.ora?
ANSWER 2: No. Autoconfig is not modifying the init.ora file. Autoconfig will generate a new init.ora just in the case it is not finding the init.ora in the expected location. So all the changes in init.ora shoud be made by the DBA.

Thursday, June 26, 2008

FND_STATS and DBMS_STATS

Automatic collection of statistics is a new feature introduced from 10g. However, this should be disabled in case of Apps instances as FND_STATS is used to collect statistics instead of DBMS_STATS. This is stated in Metalink Note 368252.1:

6) 10g has a new feature that gather statistics automatically, using the GATHER_STATS_JOB. Can the automatic statistics gathering job be used in 10G databases for Apps 11i?

No. The GATHER_STATS_JOB job collects stats using DBMS_STATS and should be disabled for Apps 11i.

If it is currently running, the automatic statistics gathering job should be disabled by running the following command:
dbms_scheduler.disable(''GATHER_STATS_JOB'');

Note: Normally, it is not necessary to disable this job, because this should be done by the script adstats.sql, which runs during the DB upgrade process.

Metalink Note :556121.1 says that "ORA-08103: object no longer exists" would occur if the GATHER_STATS_JOB is left enabled in an 11i/10g instance.

I went through the code inside FND_STATS and DBMS_STATS. DBMS_STATS code is encrypted and can't be read. FND_STATS code is readable. In many metalink notes, FND_STATS is described as a wrapper over DBMS_STATS package.

I gave this query to cross check:

1 select line,text
2 from dba_source
3 where text like '%DBMS_STATS%'
4* and name='FND_STATS'
SQL> /
249
DBMS_STATS.CREATE_STAT_TABLE(fnd_statown,fnd_stattab);

267
DBMS_STATS.CREATE_STAT_TABLE(schemaname,tabname,tblspcname);

359
DBMS_STATS.EXPORT_SCHEMA_STATS(schemaname, fnd_stattab, statid,

363
DBMS_STATS.EXPORT_SCHEMA_STATS(c_schema.sname, fnd_stattab, statid,

429
DBMS_STATS.EXPORT_TABLE_STATS(schemaname,

449
DBMS_STATS.IMPORT_SCHEMA_STATS(schemaname, fnd_stattab, statid,

453
DBMS_STATS.IMPORT_SCHEMA_STATS(c_schema.sname, fnd_stattab, statid,

517
DBMS_STATS.IMPORT_TABLE_STATS(ownname,tabname,partname,

532
DBMS_STATS.IMPORT_INDEX_STATS(ownname,indname,partname,fnd_stattab,

548
DBMS_STATS.IMPORT_COLUMN_STATS(ownname, tabname, colname, partname,

587
DBMS_STATS.IMPORT_COLUMN_STATS(c_rec.ownname,c_rec.tabname,

640
DBMS_STATS.GATHER_TABLE_STATS( ownname => ownname ,

655
l_tmp_str:= 'BEGIN DBMS_STATS.GATHER_TABLE_STATS( ownname => :ownname ,'||

712
DBMS_STATS.GATHER_INDEX_STATS( ownname => ownname ,

718
l_tmp_str:= 'BEGIN DBMS_STATS.GATHER_INDEX_STATS( ownname => :ownname ,'||

1030
EXECUTE IMMEDIATE 'BEGIN DBMS_STATS.FLUSH_DATABASE_MONITORING_INFO; END;' ;

1226
dlog('Please use DBMS_STATS package to gather stats on SYS objects.');

1294
DBMS_STATS.EXPORT_INDEX_STATS( ownname, indname, null,

1465
DBMS_STATS.EXPORT_TABLE_STATS(ownname, tabname, partname,

1544
-- Due to the limitations of in DBMS_STATS in 8i we need to call

1707
DBMS_STATS.EXPORT_COLUMN_STATS(list_ownname(i),

2048
DBMS_STATS.EXPORT_COLUMN_STATS ( ownname,

2099
DBMS_STATS.SET_TABLE_STATS(ownname,

2143
DBMS_STATS.SET_INDEX_STATS(ownname,


24 rows selected.


As per eTRM:

APPS.FND_STATS references the following:

SchemaAPPLSYS
TableFND_HISTOGRAM_COLS
TableFND_ORACLE_USERID
TableFND_PRODUCT_INSTALLATIONS
TableFND_STATS_HIST
SequenceFND_STATS_HIST_S
SchemaAPPS
PL/SQL PackageFND_FILE - show dependent code
PL/SQL PackageFND_GLOBAL - show dependent code
SynonymFND_HISTOGRAM_COLS
PL/SQL PackageFND_INSTALLATION - show dependent code
SynonymFND_ORACLE_USERID
SynonymFND_PRODUCT_INSTALLATIONS
PL/SQL PackageFND_STATS - show dependent code
SynonymFND_STATS_HIST
SynonymFND_STATS_HIST_S
SchemaPUBLIC
SynonymDBA_HISTOGRAMS
SynonymDBA_INDEXES
SynonymDBA_IND_COLUMNS
SynonymDBA_TABLES
SynonymDBA_TAB_COLUMNS
SynonymDBA_TAB_PARTITIONS
SynonymDBMS_OUTPUT
SynonymDBMS_SPACE
SynonymDBMS_STATS
SynonymDUAL
SynonymPLITBLM
SynonymV$INSTANCE
SynonymV$PARAMETER
SchemaSYS
ViewDBA_INDEXES
ViewDBA_IND_COLUMNS
ViewDBA_TABLES
ViewDBA_TAB_COLUMNS
ViewDBA_TAB_HISTOGRAMS
ViewDBA_TAB_MODIFICATIONS
ViewDBA_TAB_PARTITIONS
PL/SQL PackageDBMS_OUTPUT - show dependent code
PL/SQL PackageDBMS_SPACE - show dependent code
PL/SQL PackageDBMS_STANDARD - show dependent code
PL/SQL PackageDBMS_STATS - show dependent code
TableDUAL
PL/SQL PackagePLITBLM - show dependent code
PL/SQL PackageSTANDARD - show dependent code
ViewV_$INSTANCE
ViewV_$PARAMETER
Some more details about FND_STATS are given in Metalink Note 419728.1 which describes 3 ways of collecting statistics in 11i: concurrent process, temp tables and manually.

FND_STATS also collects Histograms automatically which is not done by DBMS_STATS. Metalink Note 429002.1 has more details:

Goal

How to collect histograms in Apps Ebusiness Suite using FND_STATS

Solution

Histograms are useful when a column has skewed data. The CBO (Cost Based Optimizer) may use that information when trying to find the best plan to retrieve the requested data.
If no histograms are present, the CBO assumes an even distribution of data. Histograms tell the CBO when data is not evenly distributed, and can help the CBO to estimate the number of rows returned from a table join (called "cardinality"). Having histograms on skewed column may aid the optimizer in making a proper decision.

FND_STATS collects histograms information if a column is listed in FND_HOSTOGRAM_COLS.

To create histogram on columns using FND_STATS you can use the procedure FND_STATS.LOAD_HISTOGRAM_COLS, like in the example:

1.sqlplus apps/
set lines 200;
set pagesize 35;
set trim on;
set trims on;
alter session set nls_date_format = 'MON-DD-YYYY HH24:MI:SS';
alter session set timed_statistics = true;
set feedback on;
select to_char(sysdate) time from dual;

2. After finding which column should have a histogram, use the procedure 'load_histogram_cols' to update the table 'fnd_histograms_cols, like:

execute fnd_stats.load_histogram_cols(action => 'INSERT', appl_id => '', tabname => '', colname => '', hsize => '');

Example:

exec fnd_stats.load_histogram_cols(action => 'INSERT', appl_id => 274, tabname => 'FEM_NAT_ACCTS_HIER', colname => 'LAST_UPDATED_BY', hsize => '100');


4. Check that the data was inserted in fnd_histogram_cols:

Select column_name, hsize from applsys.fnd_histogram_cols where table_name =
'FEM_NAT_ACCTS_HIER';

5. Check the current data :

select * from dba_tab_histograms where table_name = 'FEM_NAT_ACCTS_HIER' and owner = 'FEM';


6. Gather new statistics

exec fnd_stats.gather_table_stats('FEM','FEM_NAT_ACCTS_HIER');


7. Check the new data collected:

select * from dba_tables where table_name = 'FEM_NAT_ACCTS_HIER' and owner = 'FEM';
select * from dba_tab_histograms where table_name = 'FEM_NAT_ACCTS_HIER' and owner = 'FEM';
select * from dba_tab_columns where table_name = 'FEM_NAT_ACCTS_HIER' and owner = 'FEM';


Notes :

1) Manually inserting into FND_HOSTOGRAM_COLS is not supported in Oracle applications.

2) Once a column was added to FND_HISTOGRAM_COLS, there is no way to distinguish between seeded histograms and the custom created histograms (make sure to take note of that).

3) Make sure that you really need histogram in a particular column. If you added a histogram and it did not help in the problem that you were investigating, drop it.

References

Note 122371.1 - How To Gather Statistics For Oracle Applications 11i

However FND_STATS can not be used to gather statistics for SYS schema:

1 select line,text
2 from dba_source
3 WHERE TEXT LIKE '%SYS%'
4* AND NAME='FND_STATS'
SQL> /

LINE
TEXT
--------------------------------------------------------------------------------
16 fnd_statown varchar2(30) := 'APPLSYS'; -- Owner of the backup table
939 if (upper(schemaname) <> 'SYS') then
1224 else -- schema is SYS, print message in log.
1225 dlog('Gathering statistics on the SYS schema using FND_STATS is not allowed.');
1226 dlog('Please use DBMS_STATS package to gather stats on SYS bjects.');
1227 end if; -- end of schema<> SYS

6 rows selected.

So, you should run this command once daily on your instance to be current on SYS statistics as collection of SYS statistics is mandatory in 10g:

execute dbms_stats.gather_dictionary_stats();

I have asked Oracle in an SR about how often this should be run. Will update the post once I learn.

Wednesday, June 25, 2008

The 13th OATM tablespace APPS_TS_TOOLS

APPS_TS_TOOLS is a new tablespace added in OATM for 11i. If you search for APPS_TS_TOOLS in Metalink, you'll find references to it in all ATG_PF.H RUPs after RUP4:

Customers who have migrated to the new Oracle Applications Tablespace Model and have applied Oracle Applications Technology Family Pack 11i.ATG_PF.H Rollup 4 may encounter the following error when running the AD Splicer to introduce a new product schema:

alter user xxx quota unlimited on APPS_TS_TOOLS

AD Splicer error:
The following ORACLE error:

ORA-00959: tablespace 'APPS_TS_TOOLS' does not exist

To correct this error, create the APPS_TS_TOOLS tablespace, either manually through SQL*Plus or by invoking the Tablespace Migration Utility menu. For more information, see: Understanding the Tablespace Migration Utility Main Menu, Oracle Applications System Administrator's Guide - Configuration.

The default initial size for the APPS_TS_TOOLS tablespace is 500 MB, with auto segment management enabled. If you create the APPS_TS_TOOLS tablespace through SQL*Plus, outside of the OATM utility, you can use the following statement:

CREATE TABLESPACE APPS_TS_TOOLS DATAFILE
'datafile_name.dbf' SIZE 500M
EXTENT MANAGEMENT LOCAL AUTOALLOCATE;

You can override these storage recommendations with storage parameters to suit the expected size required for objects that will be in the Tools tablespace at your site.

APPS_TS_TOOLS is used to store objects from several tools components like SSO , OID , LDAP, Portal , Discoverer, etc.

This tablespace must exist before using the Release 12 patching tools like adpatch.

Originally there were 12 tablespaces in OATM as per OATM FAQ:

How many tablespaces are introduced in OATM? ?

OATM contains twelve consolidated tablespaces for all products, including temporary tablespace, system tablespace, and undo segments:

Tablespace Type

Tablespace Name

Contents

Transaction Tables

APPS_TS_TX_DATA

Tables that contain transaction data.

Transaction Indexes

APPS_TS_TX_IDX

Indexes on transaction tables.

Reference

APPS_TS_SEED

Reference and set-up data and indexes.

Interface

APPS_TS_INTERFACE

Interface and temporary data and indexes.

Summary

APPS_TS_SUMMARY

Summary management objects, such as materialized views, and other objects that record summary information.

Nologging

APPS_TS_NOLOGGING

Materialized views not used for summary management and temporary objects.

Advanced Queuing/AQ

APPS_TS_QUEUES

Advanced Queuing and dependent tables and indexes.

Media

APPS_TS_MEDIA

Multimedia objects, such as text, video, sound, graphics, and spatial data.

Archive

APPS_TS_ARCHIVE

Archive-purge-related objects

Undo

UNDO

Automatic Undo Management (AUM) tablespace. UNDO segments are identical to ROLLBACK segments when AUM is enabled.

Temp

TEMP

Temporary tablespace for global temporary table, sorts, and hash joins.

System

SYSTEM

System tablespace.

How are objects classified in OATM?

OATM relies on specific explicit and implicit classification rules. These rules are deternined based on storage considerations for the object type in question. Quite obviously, Tablespace classifications are not relevant for code objects and other objects without storage implications such as View, Policies, Context, triggers, etc. Objects like tables are explicitly classified based on their I/0 characteristics.

What object typesare implicitly classified in OATM?

OATM classifes the following object types:

Object type

Tablespace Type

Index Organized Tables

Transaction_tables

Global Temporary Tables

The database automatically always creates these objects in the TEMP tablespace.

Advanced Queuing tables

Advanced Queuing/AQ

Materialized View

Summary

Materialized View Logs

Transaction_tables

Domain Indexes

Transaction_indexes

Indexes

With the exception of indexes on Tables classified as 'Transaction_Tables', all indexes will share the same tablespace type as the base object (table/mv).

Tuesday, June 24, 2008

Verifying existance of the table: ADX_PRE_AUTOCONFIG

Recently I came across this error at the end of an adconfig session in $APPL_TOP/admin/$CONTEXT_NAME/log/timestamp/adconfig.log:

ERROR
Verifying existance of the table: ADX_PRE_AUTOCONFIG
Table does not exist. Exiting RestoreProfile...

-------------------ADX Database Utility Finished---------------

Verifying connection to the Database : Established
Restore Profile Feature : Disabled

No Restore Profile file created.

This is due to unpublished Bug 4604710. They are trying to test a new feature for restoring profiles which requires ADX_PRE_AUTOCONFIG table. However the warning message looks like an error. This was fixed in ADX.F (Patch 3453499) which has been superseded by TXK Rollup S (patch 6372396). So if you apply the latest TXK Rollup patch the message changes to :


Restore Profile utility ran successfully
===========================================================================

AutoConfig is exiting with status 0