You are on page 1of 3

Profile Option: Initialization SQL Statement Custom

Oracle Applications 11i provides a profile option that allows to execute custom code at the
beginning of every database session. These sessions can be linked to an online Form, a
Concurrent Program, or any other piece of code that requires accessing the database.

The most common use of this profile option is to generate detailed raw SQL Trace files including
the values of the bind variables used by SQL statements. This profile is also used to report on
raw SQL Trace, all database waits, used to determine gaps between elapsed and CPU times.

Values of bind variables are necessary when a bad performing SQL is found on TKPROF, and
the Explain Plan shows only zeros on its Rows column. The display of the number of rows in
the explain plan from TKPROF, is needed in order to narrow the area in which the SQL
statement is retrieving a large volume of data.

For both, values of bind variables and database waits, an RDBMS Event is used (Event 10046).
This document describes how to set the profile option Initialization SQL Statement Custom
for one USER, in order to generate detailed raw SQL Traces to troubleshoot Apps Performance
issues. Use this profile wisely.

1. Verify that profile option Initialization SQL Statement Custom is accessible to users
and programs. Login with a USER that has access to the Application Developer
Responsibility. Navigate to Profiles Form (choose Profile option on menu for
Application Developer responsibility). Query profile FND_INIT_SQL.
User and Program Access check boxes should be checked, as well as System
Administrator Access Visible and Updateable, at the User level as shown on screen
shot below.


Oracle Support Carlos Sierra
Apps AOL-BDE Perf Page 1 of 3 December, 2001
Profile Option: Initialization SQL Statement Custom


BEGIN FND_CTL.FND_SESS_CTL ('','','TRUE','TRUE','LOG',
2. Switch Responsibility to System Administrator and create a new USER. Suggested name
is TRACE. Assign to this new user TRACE the Responsibility that contains the
transaction (Form or Concurrent Program) that you wish to trace with Event 10046.

3. Using System Administrator Responsibility, navigate to System Profile Values Form
(Profile System from Navigator). Query profile option Initialization SQL Statement
Custom for user TRACE and update the value with string below:

'ALTER SESSION SET EVENTS=''10046 TRACE NAME CONTEXT
FOREVER, LEVEL 12'''); END;

Oracle Support Carlos Sierra
Apps AOL-BDE Perf Page 2 of 3 December, 2001
Profile Option: Initialization SQL Statement Custom

4. Use the Logon as a Different User menu option to login with user TRACE. As soon as
you login with user TRACE, all database sessions opened with this user TRACE will
generate one raw SQL Trace with detailed information produced by Event 10046. As
soon as you are done with your transaction, logoff from user TRACE and recover all raw
SQL Trace files produced. Do not use user TRACE for anything else but tracing with
this profile.

Notes:
1. All quotes used on FND_CTL.FND_SESS_CTL are single quotes. Where it looks like
double quotes it is actually two single quotes. After LEVEL 12 it has 3 single quotes.
Exact syntax is very important.
2. Set this profile ONLY at the USER level. Do not set to your own USER. Create always
a dedicated USER.
3. When using this profile, DO NOT turn trace on the menu, as doing so would actually turn
off Event 10046. Turning Event 10046 to any level, turns trace automatically.
4. Event 10046 level 1 is regular trace, level 4 is tracing with bind variables, level 8 is with
database waits and level 12 with both, bind variables and database waits.
Oracle Support Carlos Sierra
Apps AOL-BDE Perf Page 3 of 3 December, 2001

You might also like