Wednesday, August 24, 2022

Automatic Workload Repository (AWR) Reports - Main Information Sources (Doc ID 1363422.1)

  this Document

Purpose
Scope
 Automatic Workload Repository (AWR) Overview
Details
 Frequently Asked Questions
 Collecting AWR reports
 AWR Interpretation
 AWR setup and Troubleshooting setup Issues
 AWR Setup
 AWR Troubleshooting
 AWR Storage Management
 Common Issues
 If awrinfo.sql hangs, use following script:
 Community Discussions
References

APPLIES TO:

Oracle Database Cloud Exadata Service - Version N/A and later
Oracle Database Exadata Express Cloud Service - Version N/A and later
Oracle Database Cloud Service - Version N/A and later
Oracle Database - Enterprise Edition - Version 10.1.0.2 and later
Oracle Database Cloud Schema Service - Version N/A and later
Information in this document applies to any platform.

PURPOSE

This document outlines the primary information sources regarding all aspects of AWR reports.

SCOPE

Automatic Workload Repository (AWR) Overview

Automatic Workload Repository (AWR) is a licensed feature that allows information to be recorded on a database for multiple purposes including detection and elimination of performance issues.

 

For a general overview of Performance Advisors and Manageability Features, see:

Document 276103.1 PERFORMANCE TUNING USING 10g ADVISORS AND MANAGEABILITY FEATURES

Assuming you have the appropriate licenses for AWR, you may gather and examine Automatic Workload Repository (AWR) reports for the system.

Document 1490798.1 AWR Reporting - Licensing Requirements Clarification

Without the appropriate licenses, Statspack provides a legacy solution:

Document 94224.1 FAQ- Statspack Complete Reference

DETAILS

Frequently Asked Questions

Document 1599440.1 FAQ: Automatic Workload Repository (AWR) Reports

Document 1628089.1 AWR Report Interpretation Checklist for Diagnosing Database Performance Issues
Document 1359094.1 How to Use AWR reports to Diagnose Database Performance Issues

Collecting AWR reports

Document 748642.1 How to Generate an AWR Report and Create Baselines

AWR Interpretation

A video entitled: "Introduction to Performance Analysis Using AWR and ASH" is available here providing a comprehensive guided tour using an actual problem.

Document 1628089.1 AWR Report Interpretation Checklist for Diagnosing Database Performance Issues
Document 1359094.1 How to Use AWR reports to Diagnose Database Performance Issues

Document 786554.1 How to Read PGA Memory Advisory Section in AWR and Statspack Reports
Document 754639.1 How to Read Buffer Cache Advisory Section in AWR and Statspack Reports.

Document 762526.1 How to Interpret the OS stats section of an AWR report
Document 1466035.1 How to Interpret the "SQL ordered by Physical Reads (UnOptimized)" Section in AWR Reports (11.2 onwards)

AWR setup and Troubleshooting setup Issues

This section covers the setup of AWR and troubleshooting of problems related to that:

AWR Setup

Document 782974.1 How to Recreate The AWR ( AUTOMATIC WORKLOAD ) Repository ?

AWR Troubleshooting

Document 1301503.1 Troubleshooting: AWR Snapshot Collection issues

Document 296765.1 Solutions for possible AWR Library Cache Latch Contention Issues in Oracle 10g
Document 560204.1 MMON TRACE SHOWS KEWRAFC: FLUSH SLAVE FAILED, AWR ENQUEUE TIMEOUT

AWR Storage Management

Document 1399365.1 Troubleshooting Issues with SYSAUX

Document 287679.1 Space Management In Sysaux Tablespace with AWR in Use
Document 329984.1 Usage and Storage Management of SYSAUX tablespace occupants SM/AWR, SM/ADVISOR, SM/OPTSTAT and SM/OTHER

Common Issues

Document 459887.1 ORA-13516 AWR Operation failed: SWRF Schema not initialized ORA-06512 SYS.DBMS_WORKLOAD_REPOSITORY

If awrinfo.sql hangs, use following script:

Document 733655.1 AWR diagnostic collection script

Community Discussions

Still have questions? Use the communities window below to search for similar discussions or start a new discussion on this subject.

Click here to open in main browser window.

REFERENCES

NOTE:94224.1 - FAQ- Statspack Complete Reference
NOTE:1301503.1 - Troubleshooting: Missing Automatic Workload Repository (AWR) Snapshots and Other Collection Issues
NOTE:782974.1 - How to Recreate the Automatic Workload Repository (AWR)?
NOTE:1399365.1 - Troubleshooting Issues with SYSAUX Space Usage
NOTE:329984.1 - Usage and Storage Management of SYSAUX tablespace occupants SM/AWR, SM/ADVISOR, SM/OPTSTAT and SM/OTHER
NOTE:754639.1 - How to Read Buffer Cache Advisory Section in AWR and Statspack Reports.
NOTE:560204.1 - MMON Trace Shows: "*** KEWRAFC: Flush slave failed, AWR Enqueue Timeout"
NOTE:1490798.1 - AWR Reporting - Licensing Requirements Clarification
NOTE:1359094.1 - How to Use AWR Reports to Diagnose Database Performance Issues
NOTE:748642.1 - How to Generate an AWR Report and Create Baselines
NOTE:276103.1 - Performance Tuning Using Advisors and Manageability Features: AWR, ASH, ADDM and SQL Tuning Advisor
NOTE:459887.1 - ORA-13516 AWR Operation failed: SWRF Schema not initialized ORA-06512 SYS.DBMS_WORKLOAD_REPOSITORY
NOTE:733655.1 - AWR Diagnostic Collection Script
NOTE:287679.1 - How to Address Issues Where AWR Data Uses Significant Space in the SYSAUX Tablespace
NOTE:296765.1 - Solutions for possible AWR Library Cache Latch Contention Issues in Oracle 10g
NOTE:786554.1 - How to Read PGA Memory Advisory Section in AWR and Statspack Reports to Tune PGA_AGGREGATE_TARGET
NOTE:1357637.1 - How to Control the Number of SQL Statements and other information displayed in AWR Report

Oracle E-Business Suite Release 12 Upgrade Sizing and Best Practices (Doc ID 399362.1)

 This document looks at several key aspects of upgrading Oracle E-Business Suite Release 12.

The core of this document is the set of six attachments that contain information on the following topics: tablespace sizing, schema sizing, post-upgrade historical Financials documents (optional), best practices to manage the upgrade of Release 12, required post-upgrade concurrent jobs, and sample upgrade timings.

The database upgrade statistics are from the upgrade of a 6.5 TB Oracle E-Business Suite Release 11.5.10 CU2 database.

There is a change log at the end of this document.

Attachments To This Document

Click on one of the following links to open or download an attachment:

These attachments are also listed at the bottom of this document.

Database Upgrade Statistics

Years of Data MigratedDatabase Size (GB) Before Upgrade
Database Size (GB) After Upgrade
Delta (GB)
% Growth
36609.976808.44198.473
126609.977161.61551.648.3

The first column, "Years of Data Migrated" refers to the number of financial periods (in units of years) selected to be migrated during the actual upgrade phase. For example, three years of Financials data refers to upgrading Financials documents such as Payables, Receivables, Costing, Projects, and Fixed Assets for the periods from 2004 through to 2006.

Note: During upgrade of the admin tier, batchsize was 10,000 and number of workers used was 30.

Tuesday, August 23, 2022

Business Continuity for Oracle E-Business Suite Release 12.2

 



Business Continuity for Oracle E-Business Suite Release 12.2 Using Oracle 12c (12.1.0.2) Physical Standby Database (Doc ID 1963472.1)


Business Continuity for Oracle E-Business Suite Release 12.2 Using Oracle 11g (11gR2) Physical Standby Database (Doc ID 1491855.1)

Oracle E-Business Suite Release 12.2: Upgrading to Oracle Database 19c with Existing Physical Standby (Doc ID 2665458.1)

Handy SQL for the Oracle Applications (Doc ID 731190.1)

 In this Document

Goal
Solution
 1. Database
 1.1 General Objects / Tables / Columns
 1.2 Invalids / Compiling
 1 .3 Bugs and Patching
 1.4 Other Objects
 1.5 Helpful SQL Syntax
 2. Foundation (FND/ATG/AOL)
 2.1 SQL related to Oracle Application Messages
 2.2. Review Oracle Application Programs
 2.3. Users and Responsibilities
 2.4 Set Context / Initialize
  
 3. Manufacturing
 3.1 Manufacturing General
 3.2. Setup
 3.2.1. Inventory
 3.3. Transactions
 3.3.0 Inventory + Order Management
 3.3.1. Inventory Transactions
References

APPLIES TO:

Oracle Inventory Management - Version 11.5.10 and later
Information in this document applies to any platform.
This document includes all versions of 11i and R12 and later


GOAL


@ To Support:
@

Do you have suggestions on some helpful SQL scripts when working with the Oracle Applications?

NOTE: One customer had issues viewing the content of this note. They had to highlight the text to see the code snippets. The code snippets are following the standard Oracle KM guidelines with standard code widgets so should be the same as other code snippets used in other notes. The note was edited to bring it to the latest formats available. Sorry in advanced if you face this issue. Please highlight the text to see it.

SOLUTION

Yes, there are a number of helpful SQL scripts that we will share below. The scripts are segmented by foundation technology scripts (FND/ATG/AOL), then other product areas like manufacturing.  Many of the scripts prompt for information.  None of the scripts do any updates. Note that occasionally table names or columns change overtime. Where possible, the scripts will note if they will work only on a specific release. Otherwise, they should work across 11i to R12 though the scripts will be focused on the latest code.

1. Database

1.1 General Objects / Tables / Columns

PROMPT Find Object by Type, Name, Status
select object_name, object_type, owner, status 
  from dba_objects 
 where upper(object_name) like upper('%&object_name%')
   and object_type like upper('%'|| NVL('&object_type', 'TABLE')|| '%')
   and status like upper('%'|| NVL('&Status', '%')|| '%')
order by object_name, object_type;

PROMPT Find table indexes, keys, columns
select index_name,column_position,column_name
from all_ind_columns 
where table_name = '&EnterTableName' 
order by index_name, column_position;

PROMPT Find tables and columns that include a table and/or column name specified.
select table_name, column_name
from  dba_tab_columns
where column_name like NVL(UPPER('&COLUMN_NAME'), column_name)
  and table_name like NVL(UPPER('&TABLE_NAME'), table_name);

1.2 Invalids / Compiling

PROMPT Find Invalids
select object_name, object_type, owner, status 
  from dba_objects 
 where status = 'INVALID';

PROMPT Compile Packages
select 'alter package '|| object_name || ' compile '|| decode(object_type, 'PACKAGE', '', 'PACKAGE BODY', 'body')|| ';'
  from dba_objects
 where status = 'INVALID'
and object_type like 'PACK%';

1 .3 Bugs and Patching

PROMPT Find specific package version
select text from dba_source
where
   name = upper( '&PackageName')
    and line < 3;

PROMPT Find bugs already installed fixed in your system
select bug_number
  from ad_bugs 
  where bug_number  ='&Bug_Number';

PROMPT Find patches applied
select substr(patch_name,1,12) patch_num 
  from ad_applied_patches
 where patch_name like '%&Patch_Number%';
NOTE: A specific bug maybe fixed by multiple patches so it might be good to look for the bug number, instead of the patch number to see if that bug is fixed already on your system. Another way is to look at the file version mentioned in the patch and check if you have that version or higher.

1.4 Other Objects

PROMPT Query view details of a specific view.
SELECT VIEW_NAME, TEXT
  FROM DBA_VIEWS 
WHERE VIEW_NAME = UPPER('&VIEW_NAME')
  and owner = 'APPS';

PROMPT Trigger details on a table.
select TABLE_NAME, COLUMN_NAME, trigger_name, trigger_type, TRIGGER_BODY
from dba_TRIGGERS 
WHERE TABLE_NAME like '%&EnterTableName%';

1.5 Helpful SQL Syntax

1.5.1 Rowid:
Working with Rowids: rowidtochar(rowid) and chartorowid('AAABUeAAQAAACsjAAg')

1.5.2 Date Columns
a. Converting dates to show date with time: to_char(<date> 'DD-MON-YYYY HH24:MI:SS')
For example: select to_char(sysdate, 'DD-MON-YYYY HH24:MI:SS') from dual;
b. Comparing date columns -- Sometimes handy to skip the time portion when searching for dates. You can use the trunc command to strip the time off. This resets the time to midnight.
For example: select to_char(trunc(sysdate), 'DD-MON-YYYY HH24:MI:SS') from dual;

 

2. Foundation (FND/ATG/AOL)

2.1 SQL related to Oracle Application Messages


PROMPT ATG
PROMPT Find Messages by Message Text
select m.message_name, m.message_text, m.message_number, a.application_short_name
from fnd_new_messages m, fnd_application a
where upper(m.message_text) like upper('%&EnterMessageText%')
and m.language_code = 'US'
and m.application_id = a.application_id;

PROMPT Find Messages by Message Short Name
select m.message_name, m.message_text, m.message_number, a.application_short_name
from fnd_new_messages m, fnd_application a
where m.message_name like '%&EnterMessageName%'
and m.language_code = 'US'
and m.application_id = a.application_id;

2.2. Review Oracle Application Programs

a. Looking for trace files (Also see Note 296559.1 for more examples on various versions / releases.)

PROMPT IDENTIFY CONCURRENT REQUEST FILE
PROMPT From Bug.3211206
PROMPT Use the following query to identify the correct trace file:
PROMPT where "request" is the concurrent request id for the inventory transaction 
PROMPT worker. 
SELECT 'Request id: '||request_id ,
'Trace id: '||oracle_Process_id,
'Trace Flag: '||req.enable_trace,
'Trace Name: 
'||dest.value||'/'||lower(dbnm.value)||'_ora_'||oracle_process_id||'.trc',
'Prog. Name: '||prog.user_concurrent_program_name,
'File Name: '||execname.execution_file_name|| execname.subroutine_name ,
'Status : '||decode(phase_code,'R','Running') 
||'-'||decode(status_code,'R','Normal'),
'SID Serial: '||ses.sid||','|| ses.serial#,
'Module : '||ses.module
from fnd_concurrent_requests req, v$session ses, v$process proc,
v$parameter dest, v$parameter dbnm, fnd_concurrent_programs_vl prog, 
fnd_executables execname
where req.request_id = &request
and req.oracle_process_id=proc.spid(+)
and proc.addr = ses.paddr(+)
and dest.name='user_dump_dest'
and dbnm.name='db_name'
and req.concurrent_program_id = prog.concurrent_program_id
and req.program_application_id = prog.application_id
and prog.application_id = execname.application_id
and prog.executable_id=execname.executable_id;

b. Another for programs and managers:

PROMPT Programs and Managers
PROMPT Provide various output of concurrent managers related to a specific program.
PROMPT In this case using default of Item Supply/Demand program.
SELECT
fcq.processor_application_id, fcp.concurrent_program_name,
fr.responsibility_id, fr.responsibility_key, fr.data_group_id, fr.request_group_id,
fr.application_id, fa.application_short_name,
fcq.concurrent_queue_id, fcq.CONCURRENT_QUEUE_NAME,
fcq.MIN_PROCESSES, fcq.TARGET_PROCESSES, fcq.TARGET_NODE, fcq.SLEEP_SECONDS, fcq.CONTROL_CODE, fcq.DIAGNOSTIC_LEVEL,
fcpr.*
FROM fnd_application fa,
fnd_concurrent_programs fcp,
fnd_conc_processor_programs fcpp,
fnd_responsibility fr,
fnd_concurrent_queues fcq,
fnd_concurrent_processes fcpr
WHERE fcq.processor_application_id = fcpp.processor_application_id
AND fcq.concurrent_processor_id = fcpp.concurrent_processor_id
AND fcpp.concurrent_program_id = fcp.concurrent_program_id
AND fcpp.program_application_id = fcp.application_id
AND fcp.application_id = fa.application_id
AND fcp.concurrent_program_name = NVL('&EnterProgramShortName', 'INXDSD')
AND fr.application_id = 401
AND fr.data_group_id = fcq.data_group_id
AND fcq.manager_type = '3'
AND fcpr.concurrent_queue_id = fcq.concurrent_queue_id
AND fcpr.queue_application_id = fcq.application_id
-- AND fcpr.process_status_code = 'A'
AND fcpr.instance_number = userenv('instance')
ORDER BY dbms_random.random;

c. Concurrent program statuses

PROMPT Concurrent program values
Select distinct lookup_code, meaning From Fnd_Lookup_Values
Where Lookup_Type = 'CP_STATUS_CODE'
order by lookup_code;

A Waiting
B Resuming
C Normal
D Cancelled
E Error
G Warning
H On Hold
I Normal
M No Manager
P Scheduled
Q Standby
R Normal
S Suspended
T Terminating
U Disabled
W Paused
X Terminated
Z Waiting

d. Submitted Concurrent Programs

Select * From Fnd_Concurrent_Requests
Where Request_Id = &YourRequestID;

Example Output:
Phase_Code: C
Status_Code: G
Argument_Text: 207, 2, , Jbp1-M1-10, ,
Argument1: 207
Argument2: 2
Argument3: Null
Argument4: JTP1-M1-10
CONCURRENT_PROGRAM_ID: 31534

e. Ensure trace is disabled
The best way is to check via the forms System Administrator > Concurrent > Programs > Define. This is just a quick update to change trace enabled to no.

Update Fnd_Concurrent_Programs
Set Enable_Trace = 'N'
where ENABLE_TRACE = 'Y';

 

2.3. Users and Responsibilities

a. Basic user check

PROMPT Basic check for user details
select user_id, user_name, employee_id
from fnd_user
where user_name like '&EnterUserName%';

b. Active users

PROMPT Active Users
select fnd.user_name, icx.responsibility_application_id, icx.responsibility_id, frt.responsibility_name,
icx.session_id, icx.first_connect,
icx.last_connect,
DECODE ((icx.disabled_flag),'N', 'ACTIVE', 'Y', 'INACTIVE') status
from
fnd_user fnd, icx_sessions icx, fnd_responsibility_tl frt
where
fnd.user_id = icx.user_id
and icx.responsibility_id = frt.responsibility_id
and icx.disabled_flag <> 'Y'
and trunc(icx.last_connect) = trunc(sysdate)
order by icx.last_connect;

c. Users with a responsibility
There is also a similar concurrent program "Users of a Responsibility".

PROMPT Find users who have a responsibility
select usr.user_id, usr.user_name, res.RESPONSIBILITY_ID, res.RESPONSIBILITY_NAME
from apps.FND_USER usr, apps.FND_RESPONSIBILITY_TL res, apps.FND_USER_RESP_GROUPS grp
where upper(res.RESPONSIBILITY_NAME) like upper('%' || NVL('&EnterRespName', 'INV')|| '%')
and upper(res.RESPONSIBILITY_NAME) NOT like '%AX%'
and upper(res.RESPONSIBILITY_NAME) NOT like '%OPM%'
and grp.responsibility_id = res.responsibility_id
and grp.user_id = usr.user_id;

d. Values of a profile option
It is sometimes hard to know where a profile option is set. A user might have a profile option set, an application, responsibility, and these might result in unexpected results. The following prompts for the profile name that a user sees. You could also query for the internal profile code instead by using the column a.profile_option_name instead.

select
b.user_profile_option_name "Long Name"
, a.profile_option_name "Short Name"
, decode(to_char(c.level_id),'10001','Site'
,'10002','Application'
,'10003','Responsibility'
,'10004','User'
,'Unknown') "Level"
, decode(to_char(c.level_id),'10001','Site'
,'10002',nvl(h.application_short_name,to_char(c.level_value))
,'10003',nvl(g.responsibility_name,to_char(c.level_value))
,'10004',nvl(e.user_name,to_char(c.level_value))
,'Unknown') "Level Value"
, c.PROFILE_OPTION_VALUE "Profile Value"
, c.profile_option_id "Profile ID"
, to_char(c.LAST_UPDATE_DATE,'DD-MON-YYYY HH24:MI') "Updated Date"
, nvl(d.user_name,to_char(c.last_updated_by)) "Updated By"
from
apps.fnd_profile_options a
, apps.FND_PROFILE_OPTIONS_VL b
, apps.FND_PROFILE_OPTION_VALUES c
, apps.FND_USER d
, apps.FND_USER e
, apps.FND_RESPONSIBILITY_VL g
, apps.FND_APPLICATION h
where
--a.application_id = nvl(401, a.application_id)
--and a.profile_option_name = nvl('INV', a.profile_option_name)
b.user_profile_option_name like '&ProfileName' -- 'AFLOG_ENABLED'
and a.profile_option_name = b.profile_option_name
and a.profile_option_id = c.profile_option_id
and a.application_id = c.application_id
and c.last_updated_by = d.user_id (+)
and c.level_value = e.user_id (+)
and c.level_value = g.responsibility_id (+)
and c.level_value = h.application_id (+)
order by
b.user_profile_option_name, c.level_id,
decode(to_char(c.level_id),'10001','Site'
,'10002',nvl(h.application_short_name,to_char(c.level_value))
,'10003',nvl(g.responsibility_name,to_char(c.level_value))
,'10004',nvl(e.user_name,to_char(c.level_value))
,'Unknown');

 

2.4 Set Context / Initialize

Sometimes you want to run queries that reference profile options. To do this, you should first initialize the context of the current session to the user, responsibility and application being used. You can also set the context of the current inventory organization for queries that reference the organization context.

a. Set context

PROMPT Initialize context of profiles, etc.
PROMPT Note you can query the user id, responsibility id,
PROMPT and application id from the FND tables.
execute fnd_global.APPS_INITIALIZE(&UserID, &ResponsibilityID, &ApplicationID);


b. Set organization

PROMPT Set organization
PROMPT Note you can query the organization idea from mtl_parameters.
execute fnd_client_info.set_org_context('&OrganizationID');

 

3. Manufacturing

3.1 Manufacturing General


PROMPT MANUFACTURING
PROMPT Find standard codes and their meanings
select
   lookup_type,
   lookup_code,
   substr(meaning, 1, 60) "Meaning"
from mfg_lookups
where
upper(lookup_type) like upper('%'||NVL('&YourType', 'N/A')||'%')
or lookup_type IN('SERIAL_NUM_STATUS', 'MTL_PRIMARY_COST', 'MTL_CC_ENTRY_STATUSES', 'MTL_TXN_REQUEST_STATUS', 'MOVE_ORDER_TYPE')
order by lookup_type, lookup_code;

 

3.2. Setup

3.2.1. Inventory

a. Transaction types

PROMPT MANUFACTURING: INVENTORY
PROMPT Transaction Type
SELECT transaction_type_id, transaction_action_id, TRANSACTION_SOURCE_TYPE_ID, TRANSACTION_TYPE_NAME
FROM MTL_TRANSACTION_TYPES
WHERE to_char(transaction_type_id) like ('%&YourTransactionTypeID%')
ORDER BY transaction_type_id;

b. Transaction sources:

PROMPT Transaction Source
select transaction_source_type_id, transaction_source_type_name
from mtl_txn_source_types
where transaction_source_type_id like NVL('&TransSourceID', '%');

3.3. Transactions

3.3.0 Inventory + Order Management

a. View orders and lines of a given order number:

SELECT oh.order_number, oh.header_id, oh.ordered_date, oh.partial_shipments_allowed, oh.open_flag, oh.booked_flag, oh.cancelled_flag, oh.drop_ship_flag, ol.line_number, ol.line_id, ol.org_id, ol.order_quantity_uom, ol.shipping_quantity_uom, ol.cancelled_quantity, ol.shipped_quantity, ol.ordered_quantity, ol.fulfilled_quantity, ol.shipping_quantity, ol.ship_from_org_id, ol.ship_to_org_id, ol.inventory_item_id
FROM OE_ORDER_HEADERS_ALL OH, OE_ORDER_LINES_ALL OL
WHERE ol.header_id = oh.header_id
  AND oh.order_number like '%&EnterOrderNumber%';

b. Sales orders and deliveries for a stuck interface transaction:

select
substr(mti.transaction_interface_id,1,7) "Txn Id",
wdd.inv_interfaced_flag,
wdd.source_code,
wdd.released_status,
wdd.delivery_detail_id,
wda.delivery_id,
substr(mti.inventory_item_id,1,12) "Item Id",
substr(mti.organization_id,1,4) "Org Id",
substr(mti.subinventory_code,1,12) "Subinv",
substr(decode(mti.locator_id,NULL, 'No Loc',mti.locator_id),1,9) "Loc Id",
substr(decode(mti.revision,NULL, 'No Rev',mti.revision),1,7) "Rev",
substr(mti.transaction_quantity,1,9) "Txn Qty",
substr(mti.transaction_date,1,9) "Txn Date",
substr(mti.transaction_type_id,1,7) "Type",
substr(decode(mti.transaction_source_id,NULL, 'Not Source
Id',mti.transaction_source_id),1,15) "Src Id",
substr(decode(mti.transfer_subinventory,NULL, 'Not a Transfer',
mti.transfer_subinventory),1,15) "XFR Subinv",
substr(decode(mti.transfer_locator,NULL, 'Not a Transfer',
mti.transfer_locator),1,15) "XFR Loc",
substr(decode(mti.trx_source_line_id,NULL,'Not Source
Line',mti.trx_source_line_Id),1,15) "Src Line",
substr(mti.process_flag,1,7) "PFlag",
substr(mti.lock_flag,1,7) "LFlag",
substr(mti.transaction_mode,1,5) "Mode",
substr(mti.error_code,1,20) "E Code",
substr(mti.error_explanation,1,300) "Explanation"
from
mtl_transactions_interface mti,
oe_order_headers_all ooh,
oe_order_lines_all ool,
wsh_delivery_details wdd,
wsh_delivery_assignments wda
where
ool.line_id = mti.trx_source_line_id
and ool.header_id = ooh.header_id
and mti.trx_source_delivery_id = wda.delivery_id
and wda.delivery_detail_id = wdd.delivery_detail_id
order by transaction_source_id, trx_source_line_id;

c. View sales orders of a given stuck, pending temporary allocation:

SELECT mmtt.transaction_temp_id, mmtt.transaction_header_id, oh.order_number, ol.line_number, ol.line_id
FROM
MTL_MATERIAL_TRANSACTIONS_TEMP MMTT,
OE_ORDER_HEADERS_ALL OH,
OE_ORDER_LINES_ALL OL
WHERE mmtt.trx_source_line_id = ol.line_id
AND ol.header_id = oh.header_id
AND mmtt.transaction_source_type_id IN (2, 8);

 

3.3.1. Inventory Transactions

a. Stuck interface transactions (Group By)

PROMPT Stuck Transactions - GroupBy MTI
select transaction_type_id, organization_id, substr(error_code, 1, 30),
substr(error_explanation, 1, 50), to_char(transaction_date, 'YYYY-MM'),
count(*)
from mtl_transactions_interface
group by transaction_type_id, organization_id, to_char(transaction_date, 'YYYY-MM'),
substr(error_code, 1, 30), substr(error_explanation, 1, 50);

b. Stuck pending transactions (Group By)

PROMPT Stuck Transactions - GroupBy MMTT
select transaction_type_id, organization_id, substr(error_code, 1, 30), 
substr(error_explanation, 1, 50), to_char(transaction_date, 'YYYY-MM'), 
count(*) 
from mtl_material_transactions_temp
group by transaction_type_id, organization_id, to_char(transaction_date, 'YYYY-MM'), 
substr(error_code, 1, 30), substr(error_explanation, 1, 50);

c. Stuck move order transactions (Group By)

PROMPT Stuck Transactions - GroupBy Move Order
select transaction_type_id, to_char(transaction_date,'YYYY-MON'),
decode(transaction_status,2,'Untransacted Move order', transaction_status),
error_code, error_explanation,
count(*)
from mtl_material_transactions_temp
where organization_id = &Org_id
group by transaction_type_id, to_char(transaction_date,'YYYY-MON'),
decode(transaction_status,2,'Untransacted Move order', transaction_status),
error_code, error_explanation;

d. Uncosted transactions (Group By)

PROMPT Uncosted Transactions - GroupBy MMT
select transaction_type_id, organization_id, costed_flag,
to_char(transaction_date, 'YYYY-MM'), error_code, substr(error_explanation, 1, 50),
count(*)
from mtl_material_transactions
where costed_flag IN ('N','E')
group by transaction_type_id, organization_id, costed_flag, to_char(transaction_date, 'YYYY-MM'),
error_code, substr(error_explanation, 1, 50);

e. Dump information about transaction tables

PROMPT Stuck Transactions Dump - MTI
select transaction_interface_id, inventory_item_id, organization_id, subinventory_code,
locator_id, revision, transaction_quantity, transaction_date, transaction_type_id,
transaction_source_id, transfer_subinventory, transfer_locator,
trx_source_line_id, cost_group_id, process_flag, lock_flag, transaction_mode,
error_explanation, error_code
from mtl_transactions_interface
order by transaction_source_id, trx_source_line_id;

PROMPT Stuck Transactions Dump - MMTT
select transaction_temp_id, inventory_item_id, organization_id, subinventory_code, locator_id, revision,
transaction_quantity, transaction_date, transaction_type_id, transaction_source_id, transfer_subinventory,
transfer_to_location, trx_source_line_id, cost_group_id, process_flag, lock_flag, transaction_mode,
error_explanation, error_code
from mtl_material_transactions_temp
order by transaction_source_id, trx_source_line_id;

PROMPT Stuck Transactions Dump - MMT
select
transaction_id, inventory_item_id, organization_id, subinventory_code,
locator_id, revision, transaction_quantity, transaction_date,
transaction_type_id, transaction_source_id, transfer_subinventory,
transfer_locator_id, trx_source_line_id, cost_group_id,
error_explanation, error_code,
from mtl_material_transactions
where costed_flag IN ('N','E')
order by transaction_source_id, trx_source_line_id;

REFERENCES

BUG:3211206 - FAILED TO PACK/UNPACK ON PHYSICAL INVENTORY ADJUSTMENT ORA-01403
NOTE:296559.1 - FAQ: Common Tracing Techniques in Oracle E-Business Applications 11i and R12

NOTE:568012.1 - FAQ: Inventory Standard Datafixes

Common Tracing Techniques in Oracle E-Business Applications 11i and R12 (Doc ID 296559.1)

 In this Document

Purpose
Questions and Answers
 1a. What is a trace file?
 Example #1: ORA-Error
 Example #2: Rollback
 1b. What are bind variables?
 Example #1: Binds
 Example #2: Binds
 2. How to Enable Trace In...
 2a. Forms
 2b. Concurrent Program
 Checkbox
 Debug Options Button! (Binds and Waits)
 SQL Program (Binds and Waits)
 2c. Trace ALL user actions
 2d. Web-based screen
 3. Finding Trace Files?
 
3a. In 11G:
 3b. Before 11G:
 4. Other Tools
 4a. Using TKPROF
 4b. Using TraceAnalyzer
 4c. SQLT
 4d. RDA
 4. Before 11i?
 5. Tracing API Calls
References

APPLIES TO:

Oracle E-Business Suite Performance - Version 11.5.10.2 to 12.2 [Release 11.5.10 to 12.2]
Oracle Inventory Management - Version 12.1.3 to 12.1.3 [Release 12.1]
Information in this document applies to any platform.

PURPOSE

Here are some common questions or tips about Tracing, SQL Trace, TKProf, and Trace Analyzer related to the Oracle E-Business Applications 11i and R12.

QUESTIONS AND ANSWERS

1. Overview

1a. What is a trace file?

A trace file is a log of SQL run in a particular session or sessions focused on selects, inserts, updates, and deletes. A trace file can be used in many circumstances including reviewing performance, finding tables and views referenced, or finding the root of an error. More details about trace files can be read in the database user's guide related to your version.

Example #1: ORA-Error

The following is an snippet from a trace file that had an Oracle standard error. In this case it is a unique constraint violation, ORA 1 unique constraint. See the line: ERROR #117:err=1 tim=1443801753.  The ERROR flags the line and the 'err=1' lists the Oracle error as ORA-1:

=====================
PARSING IN CURSOR #117 len=1828 dep=1 uid=173 oct=2 lid=173 tim=1203661932011076 hv=1015075934 ad='cc60a820'
INSERT INTO BOM_SUB_OPERATION_RESOURCES (OPERATION_SEQUENCE_ID, SUBSTITUTE_GROUP_NUM, RESOURCE_ID, SCHEDULE_SEQ_NUM,
REPLACEMENT_GROUP_NUM, ACTIVITY_ID, STANDARD_RATE_FLAG, ASSIGNED_UNITS, USAGE_RATE_OR_AMOUNT, USAGE_RATE_OR_AMOUNT_INVERSE, BASIS_TYPE,
SCHEDULE_FLAG, LAST_UPDATE_DATE, LAST_UPDATED_BY, CREATION_DATE, CREATED_BY, LAST_UPDATE_LOGIN, RESOURCE_OFFSET_PERCENT, AUTOCHARGE_TYPE,
ATTRIBUTE_CATEGORY, REQUEST_ID, PROGRAM_APPLICATION_ID, PROGRAM_ID, PROGRAM_UPDATE_DATE, ATTRIBUTE1, ATTRIBUTE2, ATTRIBUTE3, ATTRIBUTE4,
ATTRIBUTE5, ATTRIBUTE6, ATTRIBUTE7, ATTRIBUTE8, ATTRIBUTE9, ATTRIBUTE10, ATTRIBUTE11, ATTRIBUTE12, ATTRIBUTE13, ATTRIBUTE14, ATTRIBUTE15,
PRINCIPLE_FLAG, SETUP_ID, CHANGE_NOTICE, ACD_TYPE, ORIGINAL_SYSTEM_REFERENCE ) SELECT DISTINCT A.OPERATION_SEQUENCE_ID,
B.SUBSTITUTE_GROUP_NUM, D.RESOURCE_ID, B.SCHEDULE_SEQ_NUM, B.REPLACEMENT_GROUP_NUM, B.ACTIVITY_ID, B.STANDARD_RATE_FLAG,
B.ASSIGNED_UNITS, B.USAGE_RATE_OR_AMOUNT, B.USAGE_RATE_OR_AMOUNT_INVERSE, B.BASIS_TYPE, B.SCHEDULE_FLAG, SYSDATE, :B4 ,
SYSDATE, :B4 , NULL, B.RESOURCE_OFFSET_PERCENT, B.AUTOCHARGE_TYPE, B.ATTRIBUTE_CATEGORY, FND_GLOBAL.CONC_REQUEST_ID, NULL,
FND_GLOBAL.CONC_PROGRAM_ID, SYSDATE, B.ATTRIBUTE1, B.ATTRIBUTE2, B.ATTRIBUTE3, B.ATTRIBUTE4, B.ATTRIBUTE5, B.ATTRIBUTE6, B.ATTRIBUTE7,
B.ATTRIBUTE8, B.ATTRIBUTE9, B.ATTRIBUTE10, B.ATTRIBUTE11, B.ATTRIBUTE12, B.ATTRIBUTE13, B.ATTRIBUTE14, B.ATTRIBUTE15, B.PRINCIPLE_FLAG,
B.SETUP_ID, DECODE (:B2 , 1, B.CHANGE_NOTICE, :B3 ), DECODE (:B2 , 1, B.ACD_TYPE, 1), B.ORIGINAL_SYSTEM_REFERENCE
FROM BOM_OPERATION_RESOURCES A, BOM_SUB_OPERATION_RESOURCES B, BOM_RESOURCES C, BOM_RESOURCES D
WHERE A.LAST_UPDATED_BY = B.OPERATION_SEQUENCE_ID AND B.RESOURCE_ID = C.RESOURCE_ID AND C.RESOURCE_CODE = D.RESOURCE_CODE
AND D.ORGANIZATION_ID = :B1 AND NVL (D.DISABLE_DATE, SYSDATE + 1) > SYSDATE
END OF STMT
EXEC #117:c=2099681,e=2436776,p=315,cr=5416,cu=19,mis=0,r=0,dep=1,og=1,tim=1203661932011073
ERROR #117:err=1 tim=1443801753
=====================

 

Example #2: Rollback

Another common thing to look for in trace files are rollbacks. There are several formats that you might see for a rollback including the word 'rollback' or text like 'XCTEND rlbk=1, rd_only=1'.

=====================
PARSING IN CURSOR #118 len=30 dep=1 uid=173 oct=45 lid=173 tim=1203661932011639 hv=4099445834 ad='0'
ROLLBACK TO BEGIN_ROUTING_COPY
END OF STMT
EXEC #118:c=0,e=124,p=0,cr=0,cu=21,mis=0,r=0,dep=1,og=0,tim=1203661932011637
RPC EXEC:c=2105681,e=2524801
BINDS #116:
=====================

 

1b. What are bind variables?

A bind variable is a substitution value used within a trace file. To improve performance, the Oracle database will reuse SQL substituting values for variables as necessary. For example, the same SQL statement could be run for each
of your employees. The employee id might be a variable that is changed before you run each SQL. This could be translated to the database as a bind variable so that the same SQL can be used each time but the correct variable can be substituted just before the SQL is run.

If someone requests that you enable bind variables for your trace file, this causes the database to document the substitution variables within the trace file as well as the SQL run. For example, we may see that a select statement ran against the employee table ten times, but without the binds, we would not know what employee was selected each time.

Example #1: Binds

Here is an example of a trace file with binds. In this example, we see a query against a table called MTL_SYSTEM_ITEMS_VL. Bind variables are used in the where-clause to substitute for the following ":num", ":SEGMENT1", and ":FND_FLEX_WHERE_BIND_0".

=====================
PARSING IN CURSOR #78 len=785 dep=0 uid=173 oct=3 lid=173 tim=1203661928858323 hv=3885565797 ad='d16ab6f8'
SELECT ENABLED_FLAG, SUMMARY_FLAG, NVL(TO_CHAR(START_DATE_ACTIVE, 'J'), 0),NVL(TO_CHAR(END_DATE_ACTIVE, 'J'), 0),SEGMENT1,
DESCRIPTION, PRIMARY_UOM_CODE, LOCATION_CONTROL_CODE, RESTRICT_LOCATORS_CODE, RESTRICT_SUBINVENTORIES_CODE,
INVENTORY_ASSET_FLAG, product_family_item_id, BOM_ITEM_TYPE, SERIAL_NUMBER_CONTROL_CODE, INVENTORY_ITEM_ID
FROM MTL_SYSTEM_ITEMS_VL WHERE ORGANIZATION_ID = :num AND SEGMENT1 = :SEGMENT1
AND  ( bom_enabled_flag = 'Y' And bom_item_type <> 3 And pick_components_flag = 'N'  And eng_item_flag = 'N'
And not exists (Select null From bom_operational_routings bor Where bor.assembly_item_id = inventory_item_id
And bor.organization_id = :FND_FLEX_WHERE_BIND_0 And bor.alternate_routing_designator is null And bor.routing_type <> 1)
And eam_item_type IS NULL  ) 
END OF STMT
EXEC #78:c=0,e=108,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=1203661928858320
FETCH #78:c=0,e=76,p=0,cr=10,cu=0,mis=0,r=1,dep=0,og=1,tim=1203661928858425
BINDS #78:
kkscoacd
 Bind#0
  oacdty=02 mxl=22(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=01 fl2=1000000 frm=00 csi=00 siz=2056 off=0
  kxsbbbfp=2a9cff79f0  bln=22  avl=03  flg=05
  value=101
 Bind#1
  oacdty=01 mxl=32(15) mxlc=00 mal=00 scl=00 pre=00
  oacflg=01 fl2=1000000 frm=01 csi=873 siz=0 off=24
  kxsbbbfp=2a9cff7a08  bln=32  avl=09  flg=01
  value="MRS6814MC"
 Bind#2
  oacdty=01 mxl=2000(255) mxlc=00 mal=00 scl=00 pre=00
  oacflg=01 fl2=1000000 frm=01 csi=873 siz=0 off=56
  kxsbbbfp=2a9cff7a28  bln=2000  avl=03  flg=01
  value="101"
EXEC #78:c=0,e=81,p=0,cr=0,cu=0,mis=0,r=0,dep=0,og=1,tim=1203661928859390
FETCH #78:c=0,e=36,p=0,cr=10,cu=0,mis=0,r=1,dep=0,og=1,tim=1203661928859438
=====================

 

Example #2: Binds

Here is another example where you see the bind numbers. This is more common. Note that the binds are off by one -- bind#0 goes with the variable :b1, bind#1 goes with variable :b2, etc.

=====================
PARSING IN CURSOR #128 len=863 dep=0 uid=173 oct=6 lid=173 tim=1203661928862922 hv=1516422370 ad='d1d91940'
UPDATE BOM_OPERATIONAL_ROUTINGS SET ROUTING_SEQUENCE_ID = :b1,ASSEMBLY_ITEM_ID = :b2,ORGANIZATION_ID = :b3,ALTERNATE_ROUTING_DESIGNATOR = :b4,
LAST_UPDATE_DATE = :b5,LAST_UPDATED_BY = :b6,LAST_UPDATE_LOGIN = :b7 WHERE ROWID  =  :b8  
END OF STMT
PARSE #128:c=0,e=442,p=0,cr=0,cu=0,mis=1,r=0,dep=0,og=1,tim=1203661928862919
BINDS #128:
kkscoacd
 Bind#0
  oacdty=02 mxl=23(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=03 fl2=1000000 frm=00 csi=00 siz=2200 off=0
  kxsbbbfp=2a9cff7cd8  bln=23  avl=04  flg=05
  value=30020
 Bind#1
  oacdty=02 mxl=23(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=03 fl2=1000000 frm=00 csi=00 siz=0 off=24
  kxsbbbfp=2a9cff7cf0  bln=23  avl=04  flg=01
  value=13003
 Bind#2
  oacdty=02 mxl=23(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=03 fl2=1000000 frm=00 csi=00 siz=0 off=48
  kxsbbbfp=2a9cff7d08  bln=23  avl=03  flg=01
  value=101
 Bind#3
  oacdty=01 mxl=2000(255) mxlc=00 mal=00 scl=00 pre=00
  oacflg=03 fl2=1000000 frm=01 csi=873 siz=0 off=72
  kxsbbbfp=2a9cff7d20  bln=2000  avl=00  flg=01
 Bind#4
  oacdty=12 mxl=07(07) mxlc=00 mal=00 scl=00 pre=00
  oacflg=03 fl2=1000000 frm=00 csi=00 siz=0 off=2072
  kxsbbbfp=2a9cff84f0  bln=07  avl=07  flg=01
  value="1/21/2009 8:56:55"
 Bind#5
  oacdty=02 mxl=23(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=03 fl2=1000000 frm=00 csi=00 siz=0 off=2080
  kxsbbbfp=2a9cff84f8  bln=23  avl=03  flg=01
  value=1555
 Bind#6
  oacdty=02 mxl=23(22) mxlc=00 mal=00 scl=00 pre=00
  oacflg=03 fl2=1000000 frm=00 csi=00 siz=0 off=2104
  kxsbbbfp=2a9cff8510  bln=23  avl=04  flg=01
  value=370867
  Bind#7
  oacdty=01 mxl=32(18) mxlc=00 mal=00 scl=00 pre=00
  oacflg=03 fl2=1000000 frm=01 csi=873 siz=0 off=2168
  kxsbbbfp=2a9cfef550  bln=32  avl=18  flg=01
  value="AABDb6AAiAAAGBqAA3"
=====================

 

2. How to Enable Trace In...

2a. Forms

How does one enable trace in the Oracle Application screens / forms?

One can enable trace through the forms by using the Help menu, choosing the diagnostics menu, trace and then selecting the appropriate trace for your needs. Most commonly if debugging an error, you should at least provide trace with binds.  When debugging a performance issue, you may consider using trace with binds and waits.

For example, the following is the navigation to enable trace in a form:
1. Goto the Oracle Applications
2. Login
3. Open the form where the error occurs but do not yet cause the error.
4. Enable SQL*Trace by choosing Help > Diagnostics > Trace > Trace with binds
5. A message appears indicating that the trace will be recorded
6. Note the file name and location of the file
7. Now reproduce the error.
8. Once the error occurs, disable trace as soon as possible.
9. Disable SQL*Trace by choosing Help > Diagnostics > Trace > Trace off
10. The same file name and location will be noted in case you need it again.
11. Retrieve the trace file.

Enable trace on form.

2b. Concurrent Program

How does one enable trace for a concurrent program?

Note: For R12.1 and higher, the concurrent program submission screen now has a "Debug Options" button where you can enable trace. Make sure you have the Patch 8743459 described in Note 1273539.1 for this to work. Without the patch it will not work.

Checkbox

With system administration privileges, a simple way to enable trace in a concurrent program is to review the concurrent program definition and select trace enabled. This will enable trace without binds for all users that run the program.

For example, the following steps could be used.
1. Goto Sysadmin > Concurrent > Program > Define
2. Query the concurrent program
3. Check the trace box to enable trace
Enable trace with checkbox
If you require bind variables for your trace file from a concurrent program, a more sophisticated method is required as noted below.

Debug Options Button! (Binds and Waits)

When submitting a concurrent program in R12.1 and higher, the concurrent program submission screen has a "Debug Options" button where you can enable trace. The button opens a window with various SQL Tracing options including Binds and Waits. The selection applies just to the current run of the program.

Enable trace with debug options

Note: Make sure you have the patch described in Note 1273539.1 for this to work.

 

SQL Program (Binds and Waits)

How does one enable trace for a concurrent program INCLUDING bind variables and waits?

NOTE: See Note 301372.1 for another method using the Profile "Concurrent: Allow Debugging" for 11.5.10 and R12.x.

Trace can be enabled for a concurrent program by enabling trace on the program definition for all users as noted above, but this does not include bind variables or wait times. To enable trace with bind variables for a concurrent program, you may consider the following approach that uses the bde script for concurrent program tracing with binds and waits using event 10046 at level 12.  

*** This method will enable trace with binds for all new sessions and connections
1. Download and review the script, bde_system_event_10046.sql, from Note.179848.1.
2. Run the script and press enter when prompted:

SQL> bde_system_event_10046.sql

3. Return to the application
4. Execute the concurrent program
5. Monitor the program until it begins to run
6. Return to SQL*Plus and press enter to cancel tracing new programs

2c. Trace ALL user actions

How does one enable trace for all actions that occur for a user?

One can enable trace for all actions that a user takes by setting a profile option for the user. See Note 170223.1 for detailed screen shots. This will function when the user logs into the Oracle Applications forms or when logging into the Self Service Web Applications. This method uses an Event Trace.

The instructions for enabling the event trace follow:
a. First enable trace for a specific user:
- Bring up the Core application - System Administrator responsibility
- Move to Profile/System
- Check off the USER box - and enter your username that you are using when getting the error
- Search on the following profile option - 'Initialization SQL Statement - Custom'

Please set this at the user level with the following string:

BEGIN FND_CTL.FND_SESS_CTL('','', '', 'TRUE','','ALTER SESSION SET TRACEFILE_IDENTIFIER='||''''||'4269824.999' ||''''||' EVENTS ='||''''||' 10046 TRACE NAME CONTEXT FOREVER, LEVEL 12 '||''''); END;

(Cut and paste the above sql statement into the User Level profile option: "Initialization SQL - Custom")
This must be one complete line of text - so may be best to copy the string into notepad prior to putting it into the profile.

b. Once the profile is set, please change responsibilities and directly go and reproduce the problem.
After 11G and in 12C, etc. check the "Diag Trace". To locate the trace file, use the following sql in sqlplus:

SQL> SELECT value FROM V$DIAG_INFO WHERE NAME = 'Diag Trace';

Before 11G, to locate the trace file, use the following sql in sqlplus:

SQL> select name, value from v$parameter where name like 'user_dump_dest';

- The value is the location of the trace file on the database server

- The value is the location of the trace file on the database server
- Please move to this directory and search for the file having 4269824.999 in the filename
- This is the trace file created - please tkprof and upload BOTH the raw and tkprof trace file to My Oracle Support.

c. Ensure that the profile option is unset before exiting the Application.
This is a very important step. If this is not unset, unnecessary trace files will be generated.

d. Note that a similar technique can be used for enabling trace with binds for a user in SQL*Plus. The commands would look like the following:

SQL> ALTER SESSION SET TRACEFILE_IDENTIFIER='577' EVENTS ='10046 TRACE NAME CONTEXT FOREVER, LEVEL 12';
SQL> select 'x' from dual; -- or any SQL that you want to trace
SQL> alter session set sql_trace = false;

 

2d. Web-based screen

How does one enable trace for a web-based screen like found in the self service applications?

You have a few options with web-based screens. You can use Diagnostics > Enable trace.

Web-based trace

Or you can use the same method as noted above in "How does one enable trace for all actions that occur for a user?" Also review Note.245974.1, section "10. How To Generate and Retrieve Trace Files in SSA (Self Service Applications)".  Section 10 discusses techniques available within Self Service for debugging and tracing.

3. Finding Trace Files?

How does one find a trace file?

Some trace files like in forms are specified when you enable and disable trace. Others are a bit trickier to identify. In concurrent programs for example, the user is not given the trace file number and location.  It is common for people to look for the last updated trace files or to use UNIX functions like 'grep' to parse the trace files looking for the one related to their concurrent program. However, the following SQL can be used to assist in identifying the trace file associated to a concurrent program. The SQL prompts the user for the request id and outputs the trace file name and location.

Warning: Some users have pointed out that this SQL does not always point out the exact filename and location. On a multi-node database environment, the user might not know what machine to look at. Also, the construction of the actual filename may be different on your environment as this is configurable. If your filenames are configured differently, you may want to use number part of the filename (the process id), then search for files in your trace directory with the same id. A trick that may help you find the correct trace file directory is to enable trace via the Application user using Help > Diagnostics > Trace > Trace On. This will popup a window indicating the directory where trace files are written.

Finally, the oracle_process_id is selected from v$process so this ID is only available during runtime of the process.
It gets cleared shortly after the process terminated. Then you cannot find the trace file for a concurrent program anymore. Therefore, you should run this SQL shortly after running the concurrent program.


3a. In 11G:

This PL/SQL does not link to the Concurrent Request Id but attempts to point to the directory where trace files are located based on your database version. The trace directory parameter changed in 11G onward and 12C to "Diag Trace". It used to be "user_dump_dest".

Set Serveroutput ON

DECLARE
DB_Version VARCHAR2(2);
Trace_location VARCHAR2(240);
BEGIN
SELECT SUBSTR(vi.version, 1, INSTR(vi.version, '.')-1) INTO DB_Version FROM v$instance vi;

IF TO_NUMBER(DB_Version) >= 11 THEN
/* Following Line included as Execute Immediate as V$DIAG_INFO does not exist in DB Versions prior to 11g */
EXECUTE IMMEDIATE 'SELECT value FROM V$DIAG_INFO WHERE NAME = ''Diag Trace''' INTO Trace_location ;
ELSE
SELECT value INTO Trace_location FROM v$parameter WHERE name = 'user_dump_dest';
END IF ;
dbms_output.put_line('Trace File should be located in the directory :- '|| trace_location);
END;
/

 

3b. Before 11G:

This SQL attempts to lookup the trace filename and location based on the request id. This is no longer accurate  in 11G and higher.

SQL>

prompt
accept request prompt 'Please enter the concurrent request id for the appropriate concurrent program:'
prompt

column traceid format a8
column tracename format a80
column user_concurrent_program_name format a40
column execname format a15
column enable_trace format a12
set lines 80
set pages 22
set head off

SELECT 'Request id: '||request_id ,
'Trace id: '||oracle_Process_id,
'Trace Flag: '||req.enable_trace,
'Trace Name:
'||dest.value||'/'||lower(dbnm.value)||'_ora_'||oracle_process_id||'.trc',
'Prog. Name: '||prog.user_concurrent_program_name,
'File Name: '||execname.execution_file_name|| execname.subroutine_name ,
'Status : '||decode(phase_code,'R','Running')
||'-'||decode(status_code,'R','Normal'),
'SID Serial: '||ses.sid||','|| ses.serial#,
'Module : '||ses.module
from fnd_concurrent_requests req, v$session ses, v$process proc,
v$parameter dest, v$parameter dbnm, fnd_concurrent_programs_vl prog,
fnd_executables execname
where req.request_id = &request
and req.oracle_process_id=proc.spid(+)
and proc.addr = ses.paddr(+)
and dest.name='user_dump_dest'
and dbnm.name='db_name'
and req.concurrent_program_id = prog.concurrent_program_id
and req.program_application_id = prog.application_id
and prog.application_id = execname.application_id
and prog.executable_id=execname.executable_id;

 

4. Other Tools

Are there any other tools that can assist in reviewing trace files (what is TraceAnalyzer)?

4a. Using TKPROF

A trace file can be reviewed using TKPROF. TKPROF reformats the raw data so that it is easier to review. The TKPROF commands are normally run at the operating system command prompt.  This will be signified with a $ as this is a common prompt in UNIX.
1. Retrieve the trace file.
2. Issue a command like the following to create a TKPROF version of the trace file.  The explain option will look to see how each query is handled by the database in terms of what tables and indexes are referenced.

$ tkprof <filename.trc> <output_filename> sys=no explain=apps/<password>

However, TKPROF does not take into account bind variables. Therefore, these are ignored in the output. When you need to analyze bind variables, consider using TraceAnalyzer.

A handy technique when trouble shooting performance issues is to use TKPROF to look at the longest running queries.  Since trace files related to performance can be huge, one might spend hours looking through the results to find the queries causing the issue.  If you sort the file by the longest running queries first, it makes it much easier to investigate.  The following example sorts by longest running queries first with the sort options selected as "sort='(prsela,exeela,fchela)'" and limits the results to the "Top 10" long running queries with the "print=10" command:

$ tkprof <filename.trc> <output_filename> sys=no explain=apps/<password>
sort='(prsela,exeela,fchela)' print=10

4b. Using TraceAnalyzer

Please refer to Note 224270.1: Trace Analyzer

TraceAnalyzer reformats the raw data so that it is easier to review. It is a more powerful tool than TKPROF. It translates things like bind variables and make them easy to find.

1. Download TraceAnalyzer from Note 224270.1
2. Install trace analyzer in SQL:

SQL> start TRCACREA.sql

3. Retrieve the trace file.
4. In SQL*Plus, issue a command like the following to create a TraceAnalyzer version of the trace file:

SQL> start TRCANLZR.sql UDUMP vis015_ora_22854.trc

4c. SQLT

Please refer to Note 215187.1 for details on SQLTXPLAIN (SQLT). 

4d. RDA

Is RDA Another technique for finding / supplying trace files?

Check out the RDA output that can grab the last trace file and you could then upload the RDA to the Service Request.

  • Note 559800.1 How To Run Application Collection Tool (ACT/RDA) Diagnostics Test?

... 4e. AWR

See Note 748642.1 - What is AWR( Automatic workload repository ) and How to generate the AWR report?

 

4. Before 11i?

Will these techniques work in previous versions before 11i (For example, 10.7 and 11.0.3)?

Many of the same techniques will work in previous versions of the Oracle Applications. However, there are some limitations for example, in 10.7 and 11.0.3, the application did not indicate the trace file name when a user enabled trace using Help > Diagnostics > Trace. Also, the previous versions of the application did not allow for the user to enable trace with binds using the Help > Diagnostics navigation path.

See also : Note 171647.1 - Tracing Oracle Applications using Event 10046 in 10.7, 11.0, and 11i

5. Tracing API Calls

See Note 869386.1.

REFERENCES

NOTE:130182.1:142898.1
NOTE:301372.1:38018.1
NOTE:115698.1:117129.1
NOTE:179848.1:224270.1
NOTE:1007808.6:100964.1
NOTE:76338.1:869386.1
NOTE:245974.1:279132.1

Database Options/Management Packs Usage Reporting for Oracle Databases 11.2 and later (Doc ID 1317265.1)

  Database Options/Management Packs Usage Report You can determine whether an option is currently in use in a database by running options_pa...