Generating Trace Files, Debug Logs, FND

You might also like

Download as ppt, pdf, or txt
Download as ppt, pdf, or txt
You are on page 1of 32

Traces , Debug Logs, Signal 11

and Stack Trace

Vikranth Medury
Principal Software Engineer ,Apps CoE
July 2008

Copyright © 2006, Oracle. All rights reserved.


Agenda

• Trace ( Forms / DB / Report )


• Performance Issues Additional diagnosis
• Signal 11
• Stack Trace
• Debug Logs
• Additional Reference Material

2 Copyright © 2006, Oracle. All rights reserved.


Trace

• What is a Trace ?

• What are the types of Traces ?


– Forms trace ( FRD Trace )
– DB trace / Sql trace
– Report Trace

• What are the uses of the traces?

3 Copyright © 2006, Oracle. All rights reserved.


Forms trace ( FRD Trace )

• Uses :
– FRM errors
– Loosing the connection
– Deadlock / forms session hangs

• How to enable
Option 1: Obtain FRD Trace Using Profile Options
Option 2: Obtain FRD Trace Using Appsweb.cfg
Option 3: Obtain FRD in an ADHOC way

• How to retrieve the trace file

• How to read the trace file

4 Copyright © 2006, Oracle. All rights reserved.


FRD Trace Option 1 : Using Profile Options

• Step 1: Set the profile option 'ICX: Forms Launcher' at user level to
same as site value
E.g. copy the site level value for profile option 'ICX: Forms Launcher' and paste it in user level field
so as to set it at the user level

• Step 2: Append the user value of ICX: Forms Launcher with the
Forms parameters for FRD i.e '?record=collect' replace hostname,
domain and port as applicable
E.g.
– In Servlet mode http://hostname.domain:port/forms/frmservlet?record=collect
– In Socket mode http://hostname.domain:port/OA_HTML/frmservlet?record=collect

• Step 3: Save this change at the USER level.

• Step 4: Log out and close the browser.

5 Copyright © 2006, Oracle. All rights reserved.


FRD Trace using Profile Options

You will see this additional


note popping up as soon as
the forms session starts
indicating that the FRD
Tracing is on.

• Step 5: Login using the user for whom the FRD trace is enabled
• Step 6: Perform the Activity that causes the error .
• Step 7: log out and close the browser .

6 Copyright © 2006, Oracle. All rights reserved.


FRD Trace via Profile Option

Screen print for profile option set

7 Copyright © 2006, Oracle. All rights reserved.


FRD Trace Option 2 : Using Appsweb.cfg
To start tracing in this way, please refer to the steps below:

• Step 1: Edit the appsweb.cfg file pointed by environment variable "FORMS_WEB_CONFIG_FILE"

• Step 2: Forms parameters for FRD can be set in appsweb.cfg file in one of the following ways :

– Method 1:

Look for "record=" parameter after the 'ENVIRONMENT SPECIFIC PARAMETERS' section and set it to collect
as shown below.

Once done login into Oracle Applications and launch forms via self-service.

– Method 2:

Update appsweb.cfg by adding the required Forms parameters for FRD
E.g.
[debug1]
record=collect


Logon to Applications 12i and start FRD trace by accessing the forms URL directly or updating profile option
ICX: Forms Launcher by appending '?config=debug1' as below

— In Servlet mode http://hostname.domain:port/forms/frmservlet?config=debug1


— In Socket mode http://hostname.domain:port/OA_HTML/frmservlet?config=debug1

replace hostname, domain and port as applicable

8 Copyright © 2006, Oracle. All rights reserved.


FRD Trace Option 3 : FRD Trace ADHOC way
The steps below show how to create an FRD trace in an ADHOC way. This is not a supported
or preferred method of tracing, however, it may be useful to use this method for ad hoc and
basic troubleshooting purposes.

• Step 1: Logon to Applications 12i and start FRD trace by accessing the forms URL
directly and appending '?record=collect' as below

– In Servlet mode > http://hostname.domain:port/forms/frmservlet?record=collect


– In Socket mode >http://hostname.domain:port/OA_HTML/frmservlet?record=collect
replace hostname, domain and port as applicable

http://celalnx19.us.oracle.com:10007/forms/frmservlet?record=collect

9 Copyright © 2006, Oracle. All rights reserved.


FRD Trace file location

The FRD log file will be written in the directory pointed by environment variable
$FORMS_TRACE_DIR. By default, the trace file with name collect_<pid> gets written in
$FORMS_TRACE_DIR , where <pid> is the process identifier.This is a simple text file and can
be viewed directly.

Note:
Unlike in Release 11i, you can no longer create a trace file in any ad hoc directory by using '&log=' directive
like '&log=/usr/tmp/user1.log'.In R12, the FRD log file will be written in the directory pointed by environment
variable $FORMS_TRACE_DIR and one can specify the log filename with '.log' extension in one of the
following ways:

1. In appsweb.cfg:
Look for "log=" parameter after the 'ENVIRONMENT SPECIFIC PARAMETERS' section and set it with name
that you want the trace file to be created with.

E.g
log=user1.log

2. Using +log directive in the URL used to set the frd trace via profile options or in ad hoc way

E.g
http://hostname.domain:port/forms/frmservlet?record=collect&log=user1.log
http://hostname.domain:port/OA_HTML/frmservlet?record=collect&log=user1.log

10 Copyright © 2006, Oracle. All rights reserved.


FRD Trace file location

Steps to locate the $FORMS_TRACE_DIR

• Log into the Server and go to the $APPL_TOP


• Look for the .env file .( <SID>.env)
• Key in . <sid>.env
• Use echo $FORMS_TRACE_DIR
Eg.

APPL_TOP=/global/oracle/visar03/apps/apps_st/appl
globsuptcelalnx19:/home/globsupt> cd $APPL_TOP
globsuptcelalnx19:/global/oracle/visar03/apps/apps_st/appl> ls *.env
APPSvisar03_celalnx19.env visar03_celalnx19.env visar03.env
globsuptcelalnx19:/global/oracle/visar03/apps/apps_st/appl> . visar03.env
globsuptcelalnx19:/global/oracle/visar03/apps/apps_st/appl> echo $FORMS_TRACE_DIR <
/global/oracle/visar03/inst/apps/visar03_celalnx19/logs/ora/10.1.2/forms

Forms Trace Path

11 Copyright © 2006, Oracle. All rights reserved.


Additional Reference Material for FRD trace

• Note 438652.1 :R12: Forms Runtime Diagnostics (FRD), Tracing And Logging For Forms In Oracle
Applications

• Link to the document by Chris White


http://uks712.uk.oracle.com/techddr/docs/ROOTFOLDER/FORMSTRAINING.ZIP

• Note 91123.1 Troubleshooting with core.log

12 Copyright © 2006, Oracle. All rights reserved.


DB trace / Sql trace

• Uses :
– No data found
– Wrong results
– Ora Error
– Performance issues
• Level:
– Level 1 (Normal Trace)
– Level 4 (Trace with Binds)
– Level 8 (Trace with Waits)
– Level 12 (Trace with Binds and Waits)

13 Copyright © 2006, Oracle. All rights reserved.


DB trace / Sql trace

• How to enable
– From Forms
– Concurrent Program
– Profile Option
– Session Level*
– System Level*
– init.ora file

• What are the parameters/ options


• How to retrieve the trace file
• How to read the trace file

14 Copyright © 2006, Oracle. All rights reserved.


Enabling Trace from Forms
Use the navigation Help>Diagnostics>Examine>Trace

15 Copyright © 2006, Oracle. All rights reserved.


Enabling Trace via Profile Options

• Go to Sysadmin >Profile>System

• Give the Responsibility name and the User Name

• Search for the profile ‘Initialization SQL Statement - Custom’

• Give the following value at the user level


– The value should be entered all on one line and be sure to get the quotes exactly as indicated.
– Exact syntax is important. Note that there are no double quotes in this command.
– Be sure to replace the string <tar/bug#> with an appropriate identifier for your TAR/BUG.
– Set this only at the USER level.
– Note about the Trace levels

Use LEVEL 4 (as indicated below) for binds only.

Use LEVEL 8 for waits only

Use LEVEL 12 for both

16 Copyright © 2006, Oracle. All rights reserved.


Trace via Profile Options

begin fnd_ctl.fnd_sess_ctl('','','TRUE','TRUE','LOG','ALTER SESSION SET EVENTS=''10046


TRACE NAME CONTEXT FOREVER, LEVEL 4'' TRACEFILE_IDENTIFIER=''<tar/bug#>'''); end;

17 Copyright © 2006, Oracle. All rights reserved.


Concurrent Program Trace
• Concurrent Program Trace
Enable trace on the concurrent program using the following steps:
– Go to Sysadmin > Concurrent > Program > Define
– Query the concurrent program Auto invoice Import Program
– Check the trace box to enable trace
– Use the following SQL to help identify the trace file related to your concurrent
request.

18 Copyright © 2006, Oracle. All rights reserved.


Concurrent Program Trace
Enter the concurrent request number when prompted in the following SQL:

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

19 Copyright © 2006, Oracle. All rights reserved.


Session Level & System Level

• Enabling the trace


– Session Trace

Eg: alter session set events '10046 trace name context forever , level 12';

– System Trace

Eg: alter system set events '10046 trace name context forever , level 12';

20 Copyright © 2006, Oracle. All rights reserved.


Performance issues Additional diagnosis

• SQLTEXPLAIN Plan
– What is it
– How to generate one
– Options in generating a SQLTEXPLAIN Plan

• TKPROF
– What is it
– How to generate one
– Options in generating a TKPROF trace

21 Copyright © 2006, Oracle. All rights reserved.


Report Trace

• Uses :
– No data found
– Date / Output Format Issues
– REP Error
– Performance issues
• Parameters
– TRACEOPTS=<option> eg TRACE_ALL
– TRACEFILE=<Actual Physical path/filename>
– TRACEMODE=TRACEMODE=<TRACE_APPEND> or
<TRACE_REPLACE>

22 Copyright © 2006, Oracle. All rights reserved.


Report Trace

Enabling Reports Trace

1. Login to Oracle Applications and select System Administrator


responsibility.
2. Navigate to the Concurrent Program definition form.
Concurrent -> Program -> Define
3. Query the concurrent program .
4. Enter your trace Options in the Options Field of the Executable
Section using the below format and save the changes:
TRACEOPTS=<option>TRACEFILE=<filename>
TRACEMODE=<TRACE_APPEND | TRACE_REPLACE>
Example :
TRACEOPTS=TRACE_ALL TRACEFILE=c:\Temp\SMtrace.trc

23 Copyright © 2006, Oracle. All rights reserved.


Report Trace

5. Check 'Enable Trace' in the Request Section which is optional.


Note : This would generate the Database Trace in user_dump_dest. Following
query can be used to identify the location of user_dump_dest.

select value from v$parameter where name = 'user_dump_dest';

6. Submit the request to generate the above trace files.

24 Copyright © 2006, Oracle. All rights reserved.


Report Trace Screen Print

25 Copyright © 2006, Oracle. All rights reserved.


SIGNAL 11

• What is it ?
• What can cause it ?
• What type of trace is needed to debug this ?
• How to read the Stack trace.

26 Copyright © 2006, Oracle. All rights reserved.


Stack trace

• What is it ?
• When do we need it ?
• How do we generate it ?
• How to enable OS to create a Core file.
1) Run the Ulimit command to remove the OS limitations for generating the
core file .
2) Reproduce the problem .
3) Ensure core file is created in the folder where the exe is existing
4) Generate the stack trace form the core file using the OS utilities like
gdb, adb , dbx etc ...

27 Copyright © 2006, Oracle. All rights reserved.


Reading a Stack Trace

The following is an extract from a Stack trace showing the error .

====================
#0 0x0805dd75 in afudup ()
(gdb) bt
#0 0x0805dd75 in afudup ()
#1 0x081ab8f8 in ?? ()
#2 0x0805ec72 in afuparse ()
#3 0x00000000 in ?? ()
(gdb) where
#0 0x0805dd75 in afudup ()
#1 0x081ab8f8 in ?? ()
#2 0x0805ec72 in afuparse ()
#3 0x00000000 in ?? ()
===================

afudup is defined in the file afupi.lc


The version of that file is :
$Header: afupi.lc 120.12.12000000.3 2007/02/02 17:50:12 fskinner ship $
How to get the file versions …

28 Copyright © 2006, Oracle. All rights reserved.


Debug Logs

• Statement level logging /FND DEBUG



Trouble Shooting Framework issues

Any other core issues .( ex WF/ Concurrent requests /transactional entries.)

• Creating the debug logs


– Set the profile options at the user level

FND: Debug Log Enabled -> Yes

FND: Debug Log Level -> Statement

FND: Debug Log Module -> ZX%
• Retrieving the debug logs
Use the Sql to retrieve …

29 Copyright © 2006, Oracle. All rights reserved.


Debug Logs
Retrieving the debug logs
• General sql to get the debug log
SELECT log_sequence, TIMESTAMP, MODULE, message_text
FROM fnd_log_messages fnd
WHERE TRUNC(TIMESTAMP) = TRUNC(sysdate)
AND MODULE LIKE '%ar.%'
AND log_sequence > <log_sequence value before you reproduce the issue>
ORDER BY log_sequence;

• Sql to retrieve the debug log for a concurrent request:


SELECT LOG.MODULE , LOG.message_text message
FROM fnd_log_messages LOG,
fnd_log_transaction_context con
WHERE con.transaction_id = < request_id >
AND con.transaction_type = 'REQUEST'
AND con.transaction_context_id = LOG.transaction_context_id
AND LOG.MODULE LIKE ‘zx%'
ORDER BY LOG.log_sequence;

It helps not to use MODULE LIKE ‘zx.%' , as in that case all the messages from various
modules involved can get picked up . You can play with them once you have them in
excel.

30 Copyright © 2006, Oracle. All rights reserved.


Additional Reference Material

• Note 39817.1 Interpreting Raw SQL_TRACE and DBMS_SUPPORT.START_TRACE


output

• Note 171647.1 Tracing Oracle Applications using Event 10046

• Note 438652.1 R12: Forms Runtime Diagnostics (FRD), Tracing And Logging for Forms
In Oracle Applications
• Note 373548.1

• Note 179848.1bde_system_event_10046.sql - SQL Trace any transaction with Event


10046 8.1-9.2

• Note 1812.1 on using gdb to extract stack trace from a core file.

• Note 91123.1 Troubleshooting with core.log

31 Copyright © 2006, Oracle. All rights reserved.


Thank You

32 Copyright © 2006, Oracle. All rights reserved.

You might also like