16 April, 2019

How to find logging/tracing/debugging in Oracle Apps 11i/R12?

1) Via script looking into profiles

--Query-1:

set linesize  100
set pagesize 999
column today new_value _date noprint
select to_char(SYSDATE,'DD-MON-RR') today from dual;
ttitle CENTER 'Debug and Trace Profile Options Set to YES'  -
RIGHT _date ' Page:' FORMAT 999 sql.pno SKIP 2 -
Column app_short format a6 heading "APP"
column optname format a35 heading "PROFILE"
column d_level format a36 heading "WHO HAS IT SET"
column optval format a6 heading "SET TO"
column updated format a10 heading "UPDATED ON"
select  distinct
        a.application_short_name app_short,
        user_profile_option_name optname,
        decode(level_id,
        10001,'SITE',
        10002,'APP : '||a2.application_short_name,
        10003,'RESP: '||r.responsibility_key,
        10004,'USER: '||u.user_name,
        'Unknown') d_level,
        profile_option_value optval,
        v.last_update_date updated
from fnd_profile_options_vl o,
        fnd_profile_option_values v,
        fnd_application a,
        fnd_application a2,
        fnd_responsibility r,
        fnd_user u
where (
        upper(o.user_profile_option_name) like '%DEBUG%' or
        upper(o.user_profile_option_name) like '%TRACE%'
--or upper(o.user_profile_option_name) like '%LOGG%'
        )
and a.application_id = v.application_id
and o.application_id = v.application_id
and o.profile_option_id = v.profile_option_id
-- Find the associate level for profile
and r.application_id (+) = v.level_value_application_id
and r.responsibility_id (+) = v.level_value
and a2.application_id (+) = v.level_value
and u.user_id (+) = v.level_value
and profile_option_value = 'Y'
order by 2,1,3,4;


Sample output
=============
                             Debug and Trace Profile Options Set to YES          15-MAY-12 Page:   1

Columnapp_shortheadingAPP
APP_SHORT                                          PROFILE
-------------------------------------------------- -----------------------------------
WHO HAS IT SET                       SET TO UPDATED ON
------------------------------------ ------ ----------
FND                                                Concurrent: Allow Debugging
USER: LSHER                       Y      08-DEC-10

FND                                                Concurrent: Allow Debugging
USER: RAYYG                      Y      27-FEB-12

FND                                                Concurrent: Allow Debugging
USER: RSRIN                    Y      12-JAN-09


So I got the users and profile names which caused logging.

--Query-2:

This query lists the concurrent program which has tracing on. Finding out this information and unsetting redundant tracing improves 11i EBusiness Suite performance.

SELECT concurrent_program_name prog_name
     , enable_trace
     , last_update_date
FROM apps.fnd_concurrent_programs fcp
WHERE NVL(enable_trace,'N') = 'Y' 
/

Sample output:
==============
                            Debug and Trace Profile Options Set to YES          15-MAY-12 Page:   1

Columnapp_shortheadingAPP
PROG_NAME                      E LAST_UPDA
------------------------------ - ---------
VTKSMXXX                       Y 07-MAR-12
MSCXXXXX                       Y 05-OCT-10
FNDWXXXX                       Y 30-MAR-06


2) Using back end DBA_SOURCE to find log information.

I cat/vi the log and found the following text
"Internal logging is enabled" (without double quotes)

see below a sample from logfile,

--------------------------------------------------------------------------
Maximum Stack Size=200000
Each Log File Open Mode=a
Default Log File Prefix=jai_cmn_debug_contexts
Default Log File Suffix=.log
Internal Exception Propagation=N
Context Cache Size (max)=20
Internal Debug Logging=Y
Context Printing=Y
--------------------------------------------------------------------------
NOTE: Internal logging is enabled.  Lines marked with "(#)" are internal log messages.  To disable internal logging
                    set private variable jai_cmn_debug_contexts_pkg.lv_debug='N'
(#):End -> INIT
(#):ln_user_id=1001636
(#):pv_context=TRIGGER.WSH.AFTER.JA_IN_WSH_DLRY_DTLS_AU_TRG
(#):r_temp_rec.log_context=
(#):After Fetch : r_temp_rec.log_context=
(#):Context=TRIGGER.WSH.AFTER.JA_IN_WSH_DLRY_DTLS_AU_TRG not registered
(#):pn_reg_id=0
(#):Begin -> PRINT
(#):pn_reg_id  =0



I searched the selected text in all types of code objects the same in database DBA_SOURCE which covers packages, package bodies, triggers etc

SQL> select owner,name,type  from dba_source where text like '%Internal logging is enabled%';


OWNER                          NAME                           TYPE
------------------------------ ------------------------------ ------------
APPS                           JAI_CMN_DEBUG_CONTEXTS_PKG     PACKAGE BODY

03 April, 2019

Currently running Requests with details

set lines 180
set pages 41
col user_name for a15 trunc
col sess for a13 head "Sid,serial#"
col os_process_id for a10
col db_pid for a8
col mt_pid for a8
col dte head "Start Date"
col parent for a10 head "Parent Req"
col inst_id for 99 head "Inst"
col redo_sz_mb for a12
col duration for a11
col concurrent_queue_name for a24 trunc


SELECT fu.user_name ,
S.request_id,decode(s.is_sub_request,'N',null,s.PARENT_REQUEST_ID) parent,
decode(s.status_code,'W','Paused',s.oracle_process_id) db_pid,
decode(s.status_code,'W','Paused',nvl(s.os_process_id,gs.process)) mt_pid,
-- gs.inst_id,
decode(s.status_code,'W','Paused',gs.sid||','||gs.serial#) sess,
P.concurrent_program_name,
fcq.concurrent_queue_name,
to_char(S.actual_start_date,'DD/MM/RR HH24:MI:SS')dte,
lpad(decode(extract(DAY FROM numtodsinterval(sysdate-actual_start_date,'DAY')),
0,null,
rpad(extract(DAY FROM numtodsinterval(sysdate-actual_start_date,'DAY')),2)||'d ')||
lpad(extract(HOUR FROM numtodsinterval(sysdate-actual_start_date,'DAY')),2)||':'||
lpad(extract(MINUTE FROM numtodsinterval(sysdate-actual_start_date,'DAY')),2,'0')||':'||
lpad(round(extract(SECOND from numtodsinterval(sysdate-actual_start_date,'DAY')),0),2,'0'),11) Duration,
to_char(c.value/1024/1024,'999B999.00')  Redo_Sz_Mb
FROM apps.fnd_user fu,
apps.fnd_concurrent_queues fcq,
apps.fnd_concurrent_processes fcpr,
apps.fnd_concurrent_programs P,
    gv$session gs,
gv$process gp,
-- gv$statname b,
gv$sesstat c,
apps.fnd_concurrent_requests S
WHERE P.concurrent_program_id = S.concurrent_program_id
and c.STATISTIC#(+) = 194
--and b.inst_id(+) = c.inst_id
and c.sid (+) = gs.sid
and c.inst_id(+) = gs.inst_id
--and b.name(+)  = 'redo size'
and gp.spid(+)= s.oracle_process_id
and gp.addr=gs.paddr(+)
and gp.inst_id = gs.inst_id(+)
and s.controlling_manager = fcpr.concurrent_process_id
and fcpr.concurrent_queue_id = fcq.CONCURRENT_QUEUE_ID
and fcq.APPLICATION_ID = fcpr.QUEUE_APPLICATION_ID
AND fu.user_id = S.requested_by
AND P.application_id = S.program_application_id
AND S.phase_code = 'R'
AND upper(s.LOGFILE_NODE_NAME)= upper(nvl(substr(gs.machine,1,instr(gs.machine,'.')-1),s.LOGFILE_NODE_NAME))
order by 2;

24 March, 2019

Find all the profile options recently changed

Oracle E-Busines Suite R12 

select p.profile_option_name SHORT_NAME, n.user_profile_option_name "PROFILE NAME",
decode(v.level_id, 10001, 'Site', 10002, 'Application',
10003, 'Responsibility', 10004, 'User', 10005, 'Server',
10007, 'SERVRESP', 'UnDef') LEVEL_SET,
decode(to_char(v.level_id), '10001', '',
'10002', app.application_short_name, '10003', rsp.responsibility_key,
'10005', svr.node_name, '10006', org.name, '10004', usr.user_name,
'10007', 'Serv/resp', 'UnDef') "CONTEXT", v.profile_option_value VALUE, v.LAST_UPDATE_DATE
from fnd_profile_options p,
fnd_profile_option_values v,
fnd_profile_options_tl n,
fnd_user usr,
fnd_application app,
fnd_responsibility rsp,
fnd_nodes svr,
hr_operating_units org
where p.profile_option_id = v.profile_option_id (+)
and p.profile_option_name = n.profile_option_name
--and upper(n.user_profile_option_name) like upper('BNE%')
--and trunc(v.LAST_UPDATE_DATE) > trunc(sysdate-170)
and usr.user_id (+) = v.level_value
and rsp.application_id (+) = v.level_value_application_id
and rsp.responsibility_id (+) = v.level_value
and app.application_id (+) = v.level_value
and svr.node_id (+) = v.level_value
and org.organization_id (+) = v.level_value
and v.LAST_UPDATE_DATE is not null
--and usr.USER_NAME='LINGA_SUPPORT'
order by last_update_date desc, short_name, level_set;


Oracle E-Busines Suite 11i 

SELECT pot.user_profile_option_name "Profile"
 , DECODE( a.profile_option_value
          , '1', '1 (may be "Yes")'
          , '2', '2 (may be "No")'
          , a.profile_option_value) "Value"
 , DECODE( a.level_id
          , 10001, 'Site'
          , 10002, 'Appl'
          , 10003, 'Resp'
          , 10004, 'User'
          , '????') "Level"
 , DECODE( a.level_id
          , 10002, e.application_name
          , 10003, c.responsibility_name
          , 10004, d.user_name
          , '-') "Location", a.LAST_UPDATE_DATE  
FROM applsys.fnd_application_tl e
 , applsys.fnd_user d   , applsys.fnd_responsibility_tl c
 , applsys.fnd_profile_option_values a   , applsys.fnd_profile_options b
 , applsys.fnd_profile_options_tl pot
WHERE pot.profile_option_name = b.profile_option_name
AND UPPER(pot.user_profile_option_name) LIKE UPPER('BNE%')
 AND b.application_id = a.application_id (+)
 AND b.profile_option_id = a.profile_option_id (+)
 AND a.level_value = c.responsibility_id (+)
 AND a.level_value = d.user_id (+)   AND a.level_value = e.application_id(+)
 AND e.LAST_UPDATE_DATE is not null
 --AND( UPPER( e.application_name) LIKE UPPER( 'username%')
 --OR UPPER( c.responsibility_name) LIKE UPPER( 'username%')
 --OR UPPER( d.user_name) LIKE UPPER( '%username%'))

 ORDER BY a.LAST_UPDATE_DATE desc, "Profile", "Level", "Location", "Value";


Finding OPP Manager log for a concurrent request

=> Use below query to find the OPP manager log for a concurrent request.  SELECT fcpp.concurrent_request_id req_id, fcp.node_name, fcp.lo...