Concurrent Mangar Scripts

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 199

Resource One

CONCURRENT REQUESTS COMPLETED WITH ERRORS


COL name FORMAT a50
COL st_time FORMAT a7
COL requestor FORMAT a18
SET TRIMSPOOL ON
SET FEEDBACK OFF
SET TERM OFF
SET VERIFY OFF
SET PAGES 9000
SET LINES 120
SELECT a.request_id request_id
, SUBSTR(a.user_concurrent_program_name,1,50) name
, TO_CHAR(a.actual_start_date,'Hh34:MI') st_time
, TO_CHAR(a.actual_completion_date,'Hh34:MI') end_time
, requestor
, DECODE(a.phase_code, 'R'
,'Running', 'P'
,'Inactive', 'C'
,'Completed', a.phase_code) phase_code
, DECODE(a.status_code, 'E'
,'Error', 'C'
,'Normal', 'X'
,'Terminated', 'Q'
,'On Hold', 'D'
,'Cancelled', 'G'
,'Warning', 'R'
,'Normal', 'W'
,'Paused', a.status_code) status_code
FROM apps.fnd_conc_req_summary_v a
WHERE TRUNC(actual_completion_date) >= TRUNC(SYSDATE -1)
AND a.status_code IN ('E','X','D')
ORDER BY actual_start_date
/

USAGE REPORT FOR TODAY


SET PAGES 900
SELECT fcr.cnt "Conc Reqs"
, icxs.self_serv_user_COUNT "SelfServ Users"
, icxs.self_serv_session_COUNT "SelfServ Sessions"
, fl.forms_user_COUNT "Forms Users"
, fl.forms_session_COUNT "Forms Sessions"
FROM (SELECT COUNT(distinct user_id) self_serv_user_COUNT
, COUNT(*) self_serv_session_COUNT
FROM icx.icx_sessions
WHERE TRUNC(creation_date) = TRUNC(SYSDATE-1)) icxs,
(SELECT COUNT(distinct user_id) forms_user_COUNT
, COUNT(*) forms_session_COUNT
FROM applsys.fnd_logins
WHERE TRUNC(start_time) = TRUNC(SYSDATE-1)) fl,
(SELECT COUNT(*) cnt
FROM apps.fnd_concurrent_requests
WHERE TRUNC(actual_start_date) = TRUNC(SYSDATE-1) ) fcr
/

CONCURRENT REQUESTS WHICH HAS MORE THAN 30 MINUTES OF EXECUTION TIME


SELECT a.request_id
, SUBSTR(user_concurrent_program_name,1,50) name
, TO_CHAR(actual_start_date,'DD-MON-YY Hh34:MI') st_dt
, TO_CHAR(actual_completion_date,'Hh34:MI') end_tm
, TRUNC(((actual_completion_date-actual_start_date)*24*60*60)/60)+(((actual_completion_date-
actual_start_date)*24*60*60)-(TRUNC(((actual_completion_date-actual_start_date)*24*60*60)/60)*60))/100 exe_time
, requestor
, DECODE(a.status_code, 'E'
,'Error', 'X'
,'Terminated', 'Normal') status_code
FROM apps.fnd_conc_req_summary_v a
WHERE actual_start_date >= DECODE(TO_CHAR(SYSDATE,'DAY'), 'MONDAY'
,TRUNC(SYSDATE)-3, 'SUNDAY'
,TRUNC(SYSDATE)-2, TRUNC(SYSDATE-1))
AND NVL(actual_completion_date,SYSDATE) - actual_start_date >= 30/24/60
ORDER BY actual_start_date, name
/

PROGRAMS RAN MORE 200 TIMES IN A DAY


SET LINES 120
SET PAGES 900
COL program FORMAT a70
COL cnt FORMAT 999999 HEADING "Number of Runs"
ttitle 'Programs that ran for more than 200 times ' skip 2
SELECT SUBSTR(user_concurrent_program_name,1,70) program
, COUNT(*) cnt
FROM apps.fnd_conc_req_summary_v
WHERE TRUNC(actual_start_date) = TRUNC(SYSDATE) -1
GROUP BY SUBSTR(user_concurrent_program_name,1,70)
HAVING COUNT(*) > 200
ORDER BY 2
/

NUMBER OF CONCURRENT REQUESTS IN A DAY


SET LINES 120
SET PAGES 0
COL cnt FORMAT 999999 HEADING "Total No of Requests"
SELECT ' Number of Concurrent Requests for ', SYSDATE - 1 FROM dual ;

SET PAGES 900


SELECT COUNT(*) cnt
FROM apps.fnd_concurrent_requests
WHERE TRUNC(actual_start_date) = TRUNC(SYSDATE) - 1
/

SCHEDULED REQUESTS
SET LINE 130 PAGESIZE 1000
COLUMN request_id FORMAT 999999999
COLUMN conc_prog_name FORMAT A47
COLUMN requestor FORMAT A18
COLUMN phase_code FORMAT A10 head 'Phase Code'
COLUMN status_code FORMAT A10 head 'Status Code'
COLUMN req_start_dt FORMAT A20 head 'Requested Start Date'
SELECT fcr.request_id
, SUBSTR(DECODE(fcp.user_concurrent_program_name, 'Report Set'
,fcp.user_concurrent_program_name || ' ' || fcr.description, fcp.user_concurrent_program_name),1,47) conc_prog_name
, fu.user_name requestor
, DECODE(fcr.phase_code, 'R'
,'Running', 'P'
,DECODE(fcr.hold_flag, 'Y'
,'Inactive', 'Pending'), 'C'
,'Completed', fcr.phase_code) phase_code
, DECODE(fcr.status_code, 'E'
,'Error', 'C'
,'Normal', 'X'
,'Terminated', 'Q'
,DECODE(fcr.hold_flag, 'Y'
,'On Hold', DECODE(SIGN(fcr.requested_start_date-SYSDATE),1
,'Scheduled','Standby')), 'D'
,'Cancelled', 'G'
,'Warning', 'R'
,'Normal', 'W'
,'Paused', 'T'
,'Terminating', 'R'
,'Normal', 'W'
,'Paused', 'T'
,'Terminating', 'I'
,'Scheduled', fcr.status_code) status_code
, TO_CHAR(fcr.requested_start_date,'DD-MON-YYYY Hh24:MI:SS') req_start_dt
FROM apps.fnd_user fu
, apps.fnd_concurrent_programs_vl fcp
, apps.fnd_concurrent_requests fcr
WHERE fcp.concurrent_program_id = fcr.concurrent_program_id
AND fcr.status_code IN ('Q', 'I')
AND fcr.phase_code = 'P'
AND fcr.requested_by = fu.user_id
ORDER BY 1
/

TO CHECK THE MANAGERS RUNNING OR NOT SHOULD BE ACTIVE


set lines 180
set pages 300
col OSID for a30;
Select distinct Concurrent_Process_Id CpId, PID Opid,
Os_Process_ID Osid,
Q.Concurrent_Queue_Name Manager,
P.NODE_NAME node,
P.process_status_code Status,
To_Char(P.Process_Start_Date, 'MM-DD-YYYY HH:MI:SSAM') Started_At
from Fnd_Concurrent_Processes P, Fnd_Concurrent_Queues Q, FND_V$Process
where Q.Application_Id = Queue_Application_ID
And (Q.Concurrent_Queue_ID = P.Concurrent_Queue_ID)
And ( Spid = Os_Process_ID )
And Process_Status_Code not in ('K','S')
Order by Concurrent_Process_ID, Os_Process_Id, Q.Concurrent_Queue_Name; 

PRESENTLY RUNNING REQUST


set lines 180
set pages 500
col USER_CONCURRENT_PROGRAM_NAME for a50
col USER_NAME for a30
SELECT fcr.request_id, ftp.user_concurrent_program_name, fcu.user_name
FROM apps.fnd_concurrent_requests fcr,
apps.fnd_concurrent_programs_tl ftp,
apps.fnd_user fcu
WHERE fcr.status_code = 'R'
AND fcr.phase_code = 'R'
AND fcu.user_id = fcr.requested_by
AND fcr.concurrent_program_id = ftp.concurrent_program_id;

TO CHECK PARTICULAR REQUEST STATUS


set lines 180
set pages 300
col name format a20
col QUEUE for a20
col U_NAME for a20
select fcr.request_id req_id,
substr(fcq.concurrent_queue_name, 1, 20) queue,
to_char(fcr.actual_start_date,'hh24:mi') s_time,
substr(fcr.user_concurrent_program_name, 1, 60) name,
substr(fcr.requestor, 1, 9 ) u_name,
round((sysdate -actual_start_date) *24, 2) elap,
decode(fcr.phase_code,'R','Running','P','Inactive','C','Completed', fcr.phase_code) Phase,
substr(decode( fcr.status_code, 'A', 'WAITING', 'B', 'RESUMING',
'C', 'NORMAL', 'D', 'CANCELLED', 'E', 'ERROR', 'F', 'SCHEDULED',
'G', 'WARNING', 'H', 'ON HOLD', 'I', 'NORMAL', 'M', 'NO MANAGER',
'Q', 'STANDBY', 'R', 'NORMAL', 'S', 'SUSPENDED', 'T', 'TERMINATED',
'U', 'DISABLED', 'W', 'PAUSED', 'X', 'TERMINATED', 'Z', 'WAITING',
'UNKNOWN'), 1, 10)
from
apps.fnd_concurrent_queues fcq,
apps.fnd_concurrent_processes fcp,
apps.fnd_conc_req_summary_v fcr
where fcp.concurrent_queue_id = fcq.concurrent_queue_id
and fcp.queue_application_id = fcq.application_id
and fcr.controlling_manager = fcp.concurrent_process_id
and fcr.request_id = '&RequstID'
order by request_id ;

TO CHECK PARTICULAR PROGRAM REPORT


set lines 180
set pages 300
SELECT to_char(a.request_id) ||'~'||
decode(to_char(parent_request_id),'-1',null,to_char(parent_request_id)) ||'~'||
a.user_concurrent_program_name ||'~'||
to_char(a.requested_start_date,'DD-MON-RR HH24:MI:SS') ||'~'||
to_char(a.actual_start_date,'DD-MON-RR HH24:MI:SS') ||'~'||
to_char(a.actual_completion_date,'DD-MON-RR HH24:MI:SS') ||'~'||
round(trunc(((actual_completion_date-actual_start_date)*24*60*60)/60)+(((actual_completion_date-
actual_start_date)*24*60*60)-(trunc(((actual_completion_date-actual_start_date)*24*60*60)/60)*60))/100,2) ||'~'||
a.requestor ||'~'||
decode(a.phase_code,'R','Running','P','Inactive','C','Completed', a.phase_code) ||'~'||
decode(a.status_code,'E','Error', 'C','Normal', 'X','Terminated', 'Q','On Hold', 'D','Cancelled', 'G','Warning', 'R','Normal', 'W',
'Paused', a.status_code) ||'~'||
a.argument_text
FROM apps.fnd_conc_req_summary_v a
WHERE a.user_concurrent_program_name like ('&programname%')
order by a.user_concurrent_program_name,a.actual_start_date,a.phase_code;

MV refresh
SELECT (process_end_time-process_start_time)*86400, cycle_start_time
FROM MARS.mars_batch_process_log
WHERE process_name='REFRESH MARS_BALANCES_GL_MV VIEW'
and trunc(cycle_start_time) >= trunc(sysdate-1)
ORDER BY log_seq DESC;

TO FINDOUT PAST ONE MONTH HISTORY


set pause off
set pagesize 2000
set linesize 120
set wrap off
column user_concurrent_program_name format a45 noprint
column argument_text format a45 print
column user_name format a15
column start_time format a15
column end_time format a15
column comp_time format 9999.99
select request_id,
user_concurrent_program_name,
to_char(actual_start_date,'DD/MON HH24:MI:SS') START_TIME,
to_char(ACTUAL_COMPLETION_DATE,'DD/MON HH24:MI:SS') END_TIME,
(actual_completion_date-actual_start_date)*24*60 comp_time, argument_text,user_name, status_code, phase_code
from apps.fnd_concurrent_requests, apps.fnd_concurrent_programs_tl,apps.fnd_user
where fnd_concurrent_requests.concurrent_program_id = fnd_concurrent_programs_tl.concurrent_program_id
and user_concurrent_program_name like '%Gather Schema%'
and fnd_concurrent_programs_tl.language='US'
and requested_by=user_id
order by actual_start_date desc,ACTUAL_COMPLETION_DATE desc;

TO CHECK WHICH MANAGER IS RUNNING ON WHICH NODE AND MANAGER STATUS


set verify off
set lines 256
set trims ON
set pages 60
col concurrent_queue_id format 99999 heading "QUEUE Id"
col concurrent_queue_name format a20 trunc heading "QUEUE Code"
col user_concurrent_queue_name format a30 trunc heading "Concurrent Queue Name"
col max_processes format 999 heading "Max"
col running_processes format 999 heading "Act"
col running format 999 heading "Run"
col target_node format a15 heading "Node"
col status format a12 trunc heading "Status"
col run format 9999 heading 'Run'
col pend format 9999 heading 'Pending'
col cmgr_program FOR a65;
SELECT 'Instance : '
||NAME instance_name
FROM v$database;
Prompt ===========================
Prompt concurrent manager status
Prompt ===========================
SELECT q.concurrent_queue_id,
q.concurrent_queue_name,
q.user_concurrent_queue_name,
q.target_node,
q.max_processes,
q.running_processes,
running.run running,
pending.pend,
Decode(q.control_code, 'D', 'Deactivating',
'E', 'Deactivated',
'N', 'Node unavai',
'A', 'Activating',
'X', 'Terminated',
'T', 'Terminating',
'V', 'Verifying',
'O', 'Suspending',
'P', 'Suspended',
'Q', 'Resuming',
'R', 'Restarting') status
FROM (SELECT concurrent_queue_name,
COUNT(phase_code) run
FROM fnd_concurrent_worker_requests
WHERE phase_code = 'R'
AND hold_flag != 'Y'
AND requested_start_date <= SYSDATE GROUP BY concurrent_queue_name) running, (SELECT
concurrent_queue_name, COUNT(phase_code) pend FROM fnd_concurrent_worker_requests WHERE phase_code = 'P'
AND hold_flag != 'Y' AND requested_start_date <= SYSDATE GROUP BY concurrent_queue_name) pending,
apps.fnd_concurrent_queues_vl q WHERE q.concurrent_queue_name = running.concurrent_queue_name(+) AND
q.concurrent_queue_name = pending.concurrent_queue_name(+) AND q.enabled_flag = 'Y' ORDER BY
Decode(q.application_id, 0, Decode(q.concurrent_queue_id, 1, 1,4, 2)), Sign(q.max_processes) DESC,
q.concurrent_queue_name, q.application_id;

TO FINDOUT THE REQUEST LOGFILE NAME AND LOCATION


SELECT REQUEST_ID,logfile_name, outfile_name, outfile_node_name, last_update_date FROM
apps.FND_CONCURRENT_REQUESTS WHERE REQUEST_ID =&Req_ID; 

TO FINDOUT THE ICM CURRENT LOGFILE NAME AND LOCATION


SELECT 'LOG=' || fcp.logfile_name LogFile
FROM fnd_concurrent_processes fcp, fnd_concurrent_queues fcq
WHERE fcp.concurrent_queue_id = fcq.concurrent_queue_id
AND fcp.queue_application_id = fcq.application_id
AND fcq.manager_type = '0'AND fcp.process_status_code = 'A';

TO FINDOUT WHICH MANAGER RAN THE REQUEST


select b.USER_CONCURRENT_QUEUE_NAME from fnd_concurrent_processes a, 
fnd_concurrent_queues_vl b, fnd_concurrent_requests c
where a.CONCURRENT_QUEUE_ID = b.CONCURRENT_QUEUE_ID
and a.CONCURRENT_PROCESS_ID = c.controlling_manager
and c.request_id = '&requistno';

CONCURRENT REQUESTS PERFORMANCE HISTORY (PER DAY)


SELECT TO_CHAR(TRUNC(ACTUAL_START_DATE),'DD-MON-YY DY') STARTDATE,
COUNT(*) COUNT, ROUND(SUM(ACTUAL_COMPLETION_DATE - ACTUAL_START_DATE) * 24, 2)
RUNNING_HOURS,
ROUND(AVG(ACTUAL_COMPLETION_DATE - ACTUAL_START_DATE) * 24, 2) AVG_RUNNING_HOURS,
ROUND(SUM(ACTUAL_START_DATE - REQUESTED_START_DATE) * 24, 2) PENDING_HOURS,
ROUND(AVG(ACTUAL_START_DATE - REQUESTED_START_DATE) * 24, 2) AVG_PENDING_HOURS
FROM APPLSYS.FND_CONCURRENT_PROGRAMS P,APPLSYS.FND_CONCURRENT_REQUESTS R
WHERE R.PROGRAM_APPLICATION_ID = P.APPLICATION_ID
AND R.CONCURRENT_PROGRAM_ID = P.CONCURRENT_PROGRAM_ID
AND R.STATUS_CODE IN ('C','G')
AND TRUNC(ACTUAL_COMPLETION_DATE) > TRUNC(SYSDATE-6)
AND TO_CHAR(TRUNC(ACTUAL_START_DATE),'DD-MON-YY DY') IS NOT NULL
GROUP BY TRUNC(ACTUAL_START_DATE) 
ORDER BY TRUNC(ACTUAL_START_DATE) ASC;

TO KNOW THE REQUEST SINCE HOW LONG ITS RUNNING


select user_concurrent_program_name,request_id,status_code,phase_code,to_char(actual_start_date,'DD-MON-YY
HH24:MI:SS'),to_char(actual_completion_date,'DD-MON-YY HH24:MI:SS') from apps.fnd_conc_req_summary_v where
request_id='&Requstno';

TO FINDOUT THE TRACEFILE OF A PARTICULAR REQUEST


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||'.trcrog.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 apps.fnd_concurrent_requests req, v$session ses, v$process proc,
v$parameter dest, v$parameter dbnm, apps.fnd_concurrent_programs_vl prog,
apps.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_destd dbnm.name='db_named 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;

LIST ALL THE REGISTERED CONCURRENT PROGRAMS BY MODULE


set lines 180
set pages 300
col SHORT_NAME for a10
col APPLICATION_NAME for a30
SELECT SUBSTR(a.application_name,1,60) Application_NAME
, b.application_short_name SHORT_NAME
, DECODE(SUBSTR(cp.user_concurrent_program_name,4,1),':'
, 'Concurrent Manager Executable'
, 'Subprogram or Function') TYPE
, SUBSTR(d.concurrent_program_name,1,16) PROGRAM 
, SUBSTR(cp.user_concurrent_program_name,1,55) USER_PROGRAM_NAME
FROM applsys.FND_CONCURRENT_PROGRAMS_TL cp, applsys.FND_CONCURRENT_PROGRAMS d,
applsys.FND_APPLICATION_TL a, applsys.fnd_application b
WHERE cp.application_id = a.application_id
AND d.CONCURRENT_PROGRAM_ID = cp.CONCURRENT_PROGRAM_ID 
AND a.APPLICATION_ID = b.APPLICATION_ID
AND b.application_short_name LIKE UPPER('PA')
UNION ALL
SELECT SUBSTR(a.application_name,1,60) c1
, b.application_short_name c2 , 'Form Executable' c3
, SUBSTR(f.form_name,1,16) c4 , 
SUBSTR(d.user_form_name,1,55) c5
FROM applsys.fnd_form f , applsys.FND_APPLICATION_TL a, applsys.fnd_application b, applsys.FND_FORM_TL d
WHERE f.application_id = a.application_id 
AND d.FORM_ID = f.FORM_ID
AND a.APPLICATION_ID = b.APPLICATION_ID
AND b.application_short_name LIKE UPPER('PA') ORDER BY 1,2,3,4;

Find component Version in Apps 11i/R12/12i


How to find Apps Version

select release_name from apps.fnd_product_groups;

Web Server/Apache or Application Server in Apps 11i/R12

Log in as Application user, set environment variable and run below

query$IAS_ORACLE_HOME/Apache/Apache/bin/httpd -version

Forms & Report version in R12/12i


Log in as Application user, set environment variable and run below query

$ORACLE_HOME/bin/rwrun | grep Release

 Oracle Jinitiator in 11i/R12/12i

Log in as Application user, set environment variable and run below query

grep jinit_ver_comma $CONTEXT_FILE

(Default is Java Plug-In for R12/12i )

Oracle Java Plug-in in 11i/R12/12i

A. Log in as Application user, set environment variable and run below query

grep plugin $CONTEXT_FILE.

File Version on file system

adident Header

or
strings | grep Header

Here adident is AD Utility (Oracle Apps) and strings is Unix utility.

Version of pld file

*.pld are source code of *.pll which are inturn source of *.plx.  *.pll is in $AU_TOP/resource and to find its version check

adident Header $AU_TOP/resource/.pll

IGSAU012.pll:

$Header IGSAU012.pld 115.1.115100.1 2004/04/01 05:40:18 appldev ship $

or

strings $AU_TOP/resource/.pll | grep -i header

FDRCSID(’$Header: IGSAU012.pld 115.1.115100.1 2004/04/01 05:40:18 appldev ship $’);

Workflow Version with Apps

select TEXT Version from   WF_RESOURCES where  NAME = ‘WF_VERSION’;

  Identity Management component Version/Release Number

Oracle Single Sign On

select version from orasso.wwc_version$;

Oracle Internet Directory

There are two component in OID (Software/binaries & Schema/database)

To find software/binary version

$ORACLE_HOME/bin/oidldapd -version

To find Schema Version/ database use

ldapsearch -h -p -D “cn=orcladmin” -w “” -b “” \ -s base “objectclass=*” orcldirectoryversion

select attrval from ods.ds_attrstore where entryid = 1 and attrname = ‘orcldirectoryversion’;

Application Server
Oracle Application Server 10g Rel 3 (10.1.3.X)

cat $ORACLE_HOME/config/ias.properties | grep Version

Version=10.1.3.0.0 

For Oracle Application Server 10.1.2 (Prior to Oracle WebLogic Server)

If application server is registered in database (Portal, Discoverer) check from database


select * from ias_versions;

or

select * from INTERNET_APPSERVER_REGISTRY.SCHEMA_VERSIONS;

AOC4J (Oracle Container for J2EE)

Set ORACLE_HOME

cd $ORACLE_HOME/j2ee/home

java -jar oc4j.jar -version

Oracle Portal

select version from portal.wwc_version$;

 
Database Component 
To find database version
select * from v$version;
or
All component version in database
$ORACLE_HOME/OPatch/opatch lsinventory -detail
Unix Operating System

Solaris -> cat /etc/release

Red Hat Linux -> cat /etc/redhat-release

Script to find who has changed the sysadmin Password

SELECT substr(d.user_name,1,30) || '~'||substr(f.user_name,1,10)||'~'||


substr(d.last_update_date,1,10) key,count(*) value

from apps.fnd_user d, apps.fnd_user f

WHERE

trunc(d.last_update_date) = trunc(sysdate)

and d.user_name='SYSADMIN'

and d.last_updated_by=f.user_id GROUP BY substr(d.user_name,1,30) || '~'||

substr(f.user_name,1,10)||'~'||substr(d.last_update_date,1,10);

This is to list the Apps User who are assigned a particular responsibility
select a.user_name,b.responsibility_name

from

fnd_user a,fnd_responsibility_vl b ,FND_USER_RESP_GROUPS c

where
a.user_id = c.user_id

and

c.RESPONSIBILITY_ID = b.RESPONSIBILITY_ID

and lower(b.responsibility_name) like lower(‘&Responsibility_name%’)

and a.END_DATE is null

and

(c.END_DATE is null

or

c.end_date > sysdate)

group by a.USER_NAME,b.RESPONSIBILITY_NAME;

Users Connected through application (To get the list of users connected.)
SELECT user_name username,

description name,

to_char(b.first_connect,'MM/DD/RR HH24:MI') firstconnect,

to_char(b.last_connect,'MM/DD/RR HH24:MI') lastconnect

FROM apps.fnd_user a,

(SELECT MIN (first_connect) first_connect,

MAX (last_connect) last_connect, last_updated_by user_id

FROM apps.icx_sessions

GROUP BY last_updated_by) b

WHERE a.user_id = b.user_id

AND last_connect>SYSDATE-3/12

ORDER BY 4 DESC

To get list of responsibilities.


SELECT (SELECT application_short_name

FROM apps.fnd_application fa

WHERE fa.application_id = frt.application_id) application,

frt.responsibility_id, frt.responsibility_name

FROM apps.fnd_responsibility_tl frt;

To get Menus Associated with responsibility

SELECT DISTINCT a.responsibility_name, c.user_menu_name
FROM apps.fnd_responsibility_tl a,

apps.fnd_responsibility b,

apps.fnd_menus_tl c,

apps.fnd_menus d,

apps.fnd_application_tl e,

apps.fnd_application f

WHERE a.responsibility_id(+) = b.responsibility_id

AND a.responsibility_id = ‘20538’

AND b.menu_id = c.menu_id

AND b.menu_id = d.menu_id

AND e.application_id = f.application_id

AND f.application_id = b.application_id

AND a.LANGUAGE = 'US';

To get submenus and Function attached to this Main menu.

SELECT c.prompt, c.description

FROM apps.fnd_menus_tl a, fnd_menu_entries_tl c

WHERE a.menu_id = c.menu_id AND a.user_menu_name = 'F4 UK PAY Navigator';

To get assigned responsibility to a user.

SELECT UNIQUE u.user_id, SUBSTR (u.user_name, 1, 30) user_name,

SUBSTR (r.responsibility_name, 1, 60) responsiblity,

SUBSTR (a.application_name, 1, 50) application

FROM fnd_user u,

fnd_user_resp_groups g,

fnd_application_tl a,

fnd_responsibility_tl r

WHERE g.user_id(+) = u.user_id

AND g.responsibility_application_id = a.application_id

AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id

ORDER BY SUBSTR (user_name, 1, 30),

SUBSTR (a.application_name, 1, 50),

SUBSTR (r.responsibility_name, 1, 60);

To get responsibility and attached request groups.

SELECT responsibility_name responsibility, request_group_name, frg.description

FROM fnd_request_groups frg, fnd_responsibility_vl frv

WHERE frv.request_group_id = frg.request_group_id

ORDER BY responsibility_name

To get modified profile options.

SELECT t.user_profile_option_name, profile_option_value, v.creation_date,

v.last_update_date,

v.creation_date - v.last_update_date "Change Date",

(SELECT UNIQUE user_name

FROM fnd_user

WHERE user_id = v.created_by) "Created By",

(SELECT user_name

FROM fnd_user

WHERE user_id = v.last_updated_by) "Last Update By"

FROM fnd_profile_options o,

fnd_profile_option_values v,

fnd_profile_options_tl t

WHERE o.profile_option_id = v.profile_option_id

AND o.application_id = v.application_id

AND start_date_active <= SYSDATE

AND NVL (end_date_active, SYSDATE) >= SYSDATE

AND o.profile_option_name = t.profile_option_name

AND level_id = 10001
AND t.LANGUAGE IN (SELECT language_code

FROM fnd_languages

WHERE installed_flag = 'B'

UNION

SELECT nls_language

FROM fnd_languages

WHERE installed_flag = 'B')

ORDER BY user_profile_option_name;

To get modified profile options.

SELECT ffft.user_function_name "User Form Name", ffcr.SEQUENCE,

ffcr.description, ffcr.rule_type, ffcr.enabled, ffcr.trigger_event,

ffcr.trigger_object, ffcr.condition, ffcr.fire_in_enter_query,

(SELECT user_name

FROM fnd_user fu

WHERE fu.user_id = ffcr.created_by) "Created By "

FROM fnd_form_custom_rules ffcr, fnd_form_functions_vl ffft

WHERE ffcr.ID = ffft.function_id

ORDER BY 1;

To get Patch Level.

SELECT a.application_name,

DECODE (b.status, 'I', 'Installed', 'S', 'Shared', 'N/A') status,

patch_level

FROM apps.fnd_application_vl a, apps.fnd_product_installations b

WHERE a.application_id = b.application_id;

To get all Functions

SELECT function_id, user_function_name, creation_date, description

FROM applsys.fnd_form_functions_tl
order by order by user_function_name;

To get all Request attached to a responsibility

SELECT responsibility_name , frg.request_group_name,

fcpv.user_concurrent_program_name, fcpv.description

FROM fnd_request_groups frg,

fnd_request_group_units frgu,

fnd_concurrent_programs_vl fcpv,

fnd_responsibility_vl frv

WHERE frgu.request_unit_type = 'P'

AND frgu.request_group_id = frg.request_group_id

AND frgu.request_unit_id = fcpv.concurrent_program_id

AND frv.request_group_id = frg.request_group_id

ORDER BY responsibility_name;

To get all request with application

SELECT fa.application_short_name, fcpv.user_concurrent_program_name,

description,

DECODE (fcpv.execution_method_code,

'B', 'Request Set Stage Function',

'Q', 'SQL*Plus',

'H', 'Host',

'L', 'SQL*Loader',

'A', 'Spawned',

'I', 'PL/SQL Stored Procedure',

'P', 'Oracle Reports',

'S', 'Immediate',

fcpv.execution_method_code

) exe_method,

output_file_type, program_type, printer_name, minimum_width,
minimum_length, concurrent_program_name, concurrent_program_id

FROM fnd_concurrent_programs_vl fcpv, fnd_application fa

WHERE fcpv.application_id = fa.application_id

ORDER BY description

To Count Module Wise Report

SELECT fa.application_short_name,

DECODE (fcpv.execution_method_code,

'B', 'Request Set Stage Function',

'Q', 'SQL*Plus',

'H', 'Host',

'L', 'SQL*Loader',

'A', 'Spawned',

'I', 'PL/SQL Stored Procedure',

'P', 'Oracle Reports',

'S', 'Immediate',

fcpv.execution_method_code

) exe_method,

COUNT (concurrent_program_id) COUNT

FROM fnd_concurrent_programs_vl fcpv, fnd_application fa

WHERE fcpv.application_id = fa.application_id

GROUP BY fa.application_short_name, fcpv.execution_method_code

ORDER BY 1;
To calculate request time

SELECT f.request_id , pt.user_concurrent_program_name user_concurrent_program_name

, f.actual_start_date actual_start_date

, f.actual_completion_date actual_completion_date,

floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)

|| ' HOURS ' ||


floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -

floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)

|| ' MINUTES ' ||

round((((f.actual_completion_date-f.actual_start_date)*24*60*60) -

floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600 -

(floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) -

floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)*60) ))

|| ' SECS ' time_difference

, DECODE(p.concurrent_program_name,'ALECDC',p.concurrent_program_name||'['||
f.description||']',p.concurrent_program_name) concurrent_program_name

, decode(f.phase_code,'R','Running','C','Complete',f.phase_code) Phase

, f.status_code

FROM apps.fnd_concurrent_programs p

, apps.fnd_concurrent_programs_tl pt

, apps.fnd_concurrent_requests f

WHERE f.concurrent_program_id = p.concurrent_program_id

and f.program_application_id = p.application_id

and f.concurrent_program_id = pt.concurrent_program_id

and f.program_application_id = pt.application_id

AND pt.language = USERENV('Lang')

and f.actual_start_date is not null

ORDER by f.actual_completion_date-f.actual_start_date desc;
Check responsibility assigned to a specific USER

SELECT UNIQUE u.user_id, SUBSTR (u.user_name, 1, 30) user_name,

SUBSTR (r.responsibility_name, 1, 60) responsiblity,

SUBSTR (a.application_name, 1, 50) application

FROM fnd_user u,

fnd_user_resp_groups g,

fnd_application_tl a,

fnd_responsibility_tl r
WHERE g.user_id(+) = u.user_id

AND g.responsibility_application_id = a.application_id

AND a.application_id = r.application_id

AND g.responsibility_id = r.responsibility_id

and a.application_name = 'Purchasing'

ORDER BY SUBSTR (user_name, 1, 30),

SUBSTR (a.application_name, 1, 50),

SUBSTR (r.responsibility_name, 1, 60)


Check Current Applied Patch

SELECT patch_name, patch_type, maint_pack_level, creation_date

FROM applsys.ad_applied_patches

ORDER BY creation_date DESC

We can use the below query to find the Manager name for a Concurrent Program
SELECT fcqc.INCLUDE_FLAG,
       fcqc.QUEUE_APPLICATION_ID,
       fcq.USER_CONCURRENT_QUEUE_NAME,
       fcp.CONCURRENT_PROGRAM_NAME
  FROM APPLSYS.FND_CONCURRENT_QUEUE_CONTENT fcqc,
       APPLSYS.FND_CONCURRENT_PROGRAMS fcp,
       APPS.FND_CONCURRENT_QUEUES_VL fcq
 WHERE     type_id = fcp.concurrent_program_id
       AND fcp.concurrent_program_name = '&PROGRAM_SHORT_NAME'
       AND fcq.concurrent_queue_id = fcqc.concurrent_queue_id;

Important SQL scripts for Concurrent Request ID Monitoring and Analyzing


1) requests.sql 
-- Find all child requests for a request set (OR if no children, just get details on an
individual request)
-- REQUIRED VALUE - Enter the Request ID that launched the Request set being
investigated
select /*+ ORDERED USE_NL(x fcr fcp fcptl)*/
fcr.request_id "Request ID",
substr(DECODE (FCR.DESCRIPTION, NULL,
FCPTL.USER_CONCURRENT_PROGRAM_NAME,
FCR.DESCRIPTION||' ('||
FCPTL.USER_CONCURRENT_PROGRAM_NAME||')'),1,80)"Program Name",
round((fcr.actual_completion_date - fcr.actual_start_date)*1440,2) "Elapsed Time",
oracle_process_id "Trace File ID" ,
fcr.phase_code "Phase",
fcr.status_code "Status",
to_char(fcr.request_date,'DD-MON-YYYY HH24:MI:SS') "Submitted",
round((fcr.actual_start_date - fcr.request_date)*1440,1) "Delay",
to_char(fcr.actual_start_date,'DD-MON-YYYY HH24:MI:SS') "Start Time",
to_char(fcr.actual_completion_date, 'DD-MON-YYYY HH24:MI:SS') "End Time",
fcr.argument_text "Parameters"
from (select /*+ index (fcr1 FND_CONCURRENT_REQUESTS_N3) */
fcr1.request_id
from fnd_concurrent_requests fcr1
where 1=1
start with fcr1.request_id = &parent_request_id
connect by prior fcr1.request_id = fcr1.parent_request_id) x,
fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcptl
where fcr.request_id = x.request_id
and fcr.concurrent_program_id = fcp.concurrent_program_id
and fcr.program_application_id = fcp.application_id
and fcp.application_id = fcptl.application_id
and fcp.concurrent_program_id = fcptl.concurrent_program_id
and fcptl.language = 'US'
order by 1;

-- end of requests.sql

2) requests_N.sql - find the requests for a Request Program name(s)

-- REQUIRED VALUE - Enter the NAME when prompted -


-- Examples:
-- Suggest using % like Launch%Plan% for finding Launch Supply Chain Plan
-- OR use %Data%Pull% for all requests for Planning Data Pull and Planning Data Pull
Workers
-- NOTE: This IS CASE SENSiTiVe
-- this is valuable when you have performance degrades over time for specific requests.

select /*+ ORDERED USE_NL(x fcr fcp fcptl)*/


fcr.request_id "Request ID",
substr(DECODE (FCR.DESCRIPTION, NULL,
FCPTL.USER_CONCURRENT_PROGRAM_NAME,
FCR.DESCRIPTION||' ('||
FCPTL.USER_CONCURRENT_PROGRAM_NAME||')'),1,80)"Program Name",
round((fcr.actual_completion_date - fcr.actual_start_date)*1440,2) "Elapsed Time",
oracle_process_id "Trace File ID" ,
fcr.phase_code "Phase",
fcr.status_code "Status",
to_char(fcr.request_date,'DD-MON-YYYY HH24:MI:SS') "Submitted",
round((fcr.actual_start_date - fcr.request_date)*1440,1) "Delay",
to_char(fcr.actual_start_date,'DD-MON-YYYY HH24:MI:SS') "Start Time",
to_char(fcr.actual_completion_date, 'DD-MON-YYYY HH24:MI:SS') "End Time",
fcr.argument_text "Parameters"
from fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcptl
where fcr.concurrent_program_id = fcp.concurrent_program_id
and fcr.program_application_id = fcp.application_id
and fcp.application_id = fcptl.application_id
and fcp.concurrent_program_id = fcptl.concurrent_program_id
and fcptl.language = 'US'
and DECODE (FCR.DESCRIPTION, NULL,
FCPTL.USER_CONCURRENT_PROGRAM_NAME,
FCR.DESCRIPTION||' ('||FCPTL.USER_CONCURRENT_PROGRAM_NAME||')')
like '&Name' -- ENTER THE NAME HERE Suggest using % like Launch%Plan% for
finding Launch Supply Chain Plan
order by 1 desc;

-- end of requests_N.sql
 

3) requests_t.sql - -- Find request run during a specific time period


-- this is good for finding what was running on the system over a period of time when
performance degrades
-- Also a good idea to have DBA supply the AWR report for time period when
performance was poor

-- REQUIRED VALUES Enter the start_time and end_time when prompted


-- Date format example for start_time 16-DEC-2012 04:00:00
-- Date format example for end_time 16-DEC-20012 11:00:00
-- The example above will find all requests that launched between 4 am and 11 am on
16-DEC-2012
select /*+ ORDERED USE_NL(x fcr fcp fcptl)*/
fcr.request_id "Request ID",
substr(DECODE (FCR.DESCRIPTION, NULL,
FCPTL.USER_CONCURRENT_PROGRAM_NAME,
FCR.DESCRIPTION||' ('||
FCPTL.USER_CONCURRENT_PROGRAM_NAME||')'),1,80)"Program Name",
fcr.phase_code "Phase",
fcr.status_code "Status",
round((fcr.actual_completion_date - fcr.actual_start_date)*1440,2) "Elapsed Time",
oracle_process_id "Trace File ID" ,
to_char(fcr.request_date,'DD-MON-YYYY HH24:MI:SS') "Submitted",
round((fcr.actual_start_date - fcr.request_date)*1440,1) "Delay",
to_char(fcr.actual_start_date,'DD-MON-YYYY HH24:MI:SS') "Start Time",
to_char(fcr.actual_completion_date, 'DD-MON-YYYY HH24:MI:SS') "End Time",
fcr.argument_text "Parameters"
from fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcptl
where fcr.concurrent_program_id = fcp.concurrent_program_id
and fcr.program_application_id = fcp.application_id
and fcp.application_id = fcptl.application_id
and fcp.concurrent_program_id = fcptl.concurrent_program_id
and fcptl.language = 'US'
and fcr.actual_start_date
between
to_date('01-AUG-2018 04:00:00','DD-MON-YYYY HH24:MI:SS') --ENTER FROM
DATE/TIME like 16-DEC-2017 04:00:00
and
to_date('31-DEC-2018 04:00:00','DD-MON-YYYY HH24:MI:SS') -- ENTER TO
DATE/TIME like 16-DEC-2017 11:00:00
-- AND FCP.APPLICATION_ID in (724,723) -- isolates ASCP (MSC, MSO) programs --
or other as required **
-- AND fcr.requested_by = &user_id -- can be used if you want to isolate by user_id from
table fnd_user
order by 1 desc;

-- end of requests_T.sql
4)  SQL to find application_id

SELECT P.APPLICATION_ID,
decode(P.STATUS, 'I', 'Yes', 'S', 'Shared', 'N', 'No', P.status) inst_status,
A.APPLICATION_SHORT_NAME
FROM     FND_PRODUCT_INSTALLATIONS P, FND_APPLICATION A
WHERE A.APPLICATION_ID=P.APPLICATION_ID;
5) requests_NT.sql - Find request run during a specific Request Name DURING a
specific time period - Edit times below
-- this is very valuable when you have performance degrades over time for specific
requests.

-- REQUIRED VALUES
-- 1. ENTER THE NAME when prompted - Suggest using % like Launch%Plan% for
finding Launch Supply Chain Plan
----  NOTE: This IS CASE SENSiTiVe
-- 2. Enter the start_time and end_time when prompted
--   2.1 Date format example for start_time 01-JAN-2012 00:00:00
--   2.2 Date format example for end_time 31-JAN-2012 23:59:00
-- The example above will find all requests for Launch%Plan% that launched for 31 day
range 01-JAN-12 to 31-JAN-12

select /*+ ORDERED USE_NL(x fcr fcp fcptl)*/


fcr.request_id "Request ID",
substr(DECODE (FCR.DESCRIPTION, NULL,
FCPTL.USER_CONCURRENT_PROGRAM_NAME,
FCR.DESCRIPTION||' ('||FCPTL.USER_CONCURRENT_PROGRAM_NAME||')'),1,80)
"Program Name",
fcr.phase_code "Phase",
fcr.status_code "Status",
round((fcr.actual_completion_date - fcr.actual_start_date)*1440,2) "Elapsed Time",
oracle_process_id "Trace File ID",
to_char(fcr.request_date,'DD-MON-YYYY HH24:MI:SS') "Submitted",
round((fcr.actual_start_date - fcr.request_date)*1440,1) "Delay",
to_char(fcr.actual_start_date,'DD-MON-YYYY HH24:MI:SS') "Start Time",
to_char(fcr.actual_completion_date, 'DD-MON-YYYY HH24:MI:SS') "End Time",
substr(fcr.argument_text,1,200) "Parameters"
from fnd_concurrent_requests fcr,
fnd_concurrent_programs fcp,
fnd_concurrent_programs_tl fcptl
where fcr.concurrent_program_id = fcp.concurrent_program_id
and fcr.program_application_id = fcp.application_id
and fcp.application_id = fcptl.application_id
and fcp.concurrent_program_id = fcptl.concurrent_program_id
and fcptl.language = 'US'
and DECODE (FCR.DESCRIPTION, NULL,
FCPTL.USER_CONCURRENT_PROGRAM_NAME,
FCR.DESCRIPTION||' ('||FCPTL.USER_CONCURRENT_PROGRAM_NAME||')')
like '%Data%Pull%%' -- ENTER THE NAME HERE
and fcr.actual_start_date
BETWEEN
to_date('09-MAR-2018 00:00:00','DD-MON-YYYY HH24:MI:SS') --ENTER FROM
DATE/TIME like 01-JAN-2017 00:00:00
and
to_date('31-DEC-2018 23:59:00','DD-MON-YYYY HH24:MI:SS') -- ENTER TO
DATE/TIME like 31-JAN-2017 23:59:00
order by 1 desc;

-- end of requests_NT.sql

6) Find TMP log files when log is not written by the request process
-- When requests use this TMP file process, then this can help determine cause of
failure

-- REQUIRED VALUES
-- Enter request ID that failed to provide a log file to get location of TMP file created while
the request is running

select
c.value || '/' || p.plsql_log
from fnd_concurrent_processes P,
fnd_concurrent_requests R,
fnd_env_context C
where R.controlling_manager=P.concurrent_process_id
and P.concurrent_process_id=C.concurrent_process_id
and c.variable_name='APPLPTMP'
and r.request_id = &error_request_id

-- end requests_TMP.sql
  
7) requests_RAC.sql

-- Includes node information to know which RAC DB Node processed a request - refer to
Note 279156.1
-- REQUIRED VALUE - Enter the Request ID that launched the Request set being
investigated

SELECT
        /*+ ORDERED USE_NL(x fcr fcp fcptl)*/
        SUBSTR(fcr.request_id,1,10) "Request ID"
      , SUBSTR(parent_request_id,1,10) "Parent ID"
      , SUBSTR(fcptl.user_concurrent_program_name,1,40) "Program Name"
      , FCPRC.NODE_NAME "DB Node" -- this is node that processed the request
      , FCR.OUTFILE_NODE_NAME "Output file Node" -- this is the node where the
output files were processed
      , fcr.phase_code
      , fcr.status_code
      , SUBSTR(TO_CHAR(fcr.actual_start_date,'DD-MON HH24:MI:SS'),1,16) "Start
Time"
      , SUBSTR(TO_CHAR(fcr.actual_completion_date, 'DD-MON HH24:MI:SS'),1,16)
"End Time"
      , TO_CHAR((fcr.actual_completion_date - fcr.actual_start_date)*1440,'9999.00')
"Elapsed"
      , SUBSTR(fcr.oracle_process_id,1,10) "Trace ID"
      , FCR.COMPLETION_TEXT
      , 'cp ' || FCR.LOGFILE_NAME || ' .' LOGFILE
      , 'cp ' || FCR.OUTFILE_NAME || ' .' OUTFILE
      , 'cp ' || FEC.value || '/' || FCPRC.PLSQL_LOG || ' .' TMPLOG
      , FCR.ARGUMENT_TEXT "Parameters"      
FROM
        (SELECT
                /*+ index (fcr1 fnd_concurrent_requests_n3) */
                fcr1.request_id
        FROM
                apps.fnd_concurrent_requests fcr1
        WHERE
                1                          =1
                START WITH fcr1.request_id =
                (SELECT -- walk up the request family tree to the root
                        MIN(fcr2.request_id) root
                FROM
                        apps.fnd_concurrent_requests fcr2
                        CONNECT BY fcr2.request_id = prior fcr2.parent_request_id
                        start with FCR2.REQUEST_ID = &Request_ID
                        --  amp child_request_id
                ) -- decending from the root, select all of the requests in the family
                CONNECT BY PRIOR fcr1.request_id = fcr1.parent_request_id
    )x
      , apps.fnd_concurrent_requests fcr
      , apps.fnd_concurrent_programs fcp
      , APPS.FND_CONCURRENT_PROGRAMS_TL FCPTL
      , APPS.FND_ENV_CONTEXT FEC
      , APPS.FND_CONCURRENT_PROCESSES FCPRC      
WHERE
        fcr.request_id             = x.request_id
    AND fcr.concurrent_program_id  = fcp.concurrent_program_id
    AND fcr.program_application_id = fcp.application_id
    AND fcp.application_id         = fcptl.application_id
    AND fcp.concurrent_program_id  = fcptl.concurrent_program_id
    and FCPTL.LANGUAGE             = 'US'
    and FEC.VARIABLE_NAME           = 'APPLPTMP'
    and FCR.CONTROLLING_MANAGER     = FCPRC.CONCURRENT_PROCESS_ID
    and FCPRC.CONCURRENT_PROCESS_ID = FEC.CONCURRENT_PROCESS_ID
ORDER BY
        1;
-- END requests_RAC.sql

8) requests_HANG.sql
-- To find current running SQL text for a request with performance/hanging issues - refer
to Note 186472.1
-- prints all requests currently running for a request set or can be used for any single
running request
-- note that if no SQL is returned, then the process may be working in RAM Memory -
examples are MRP or ASCP Memory Based Planner process
-- REQUIRED VALUE - Enter the Request ID that launched the Request set being
investigated

select
request_id,
to_char(sid) sid
, to_char(serial#) serial#
, vq.sql_id SQLID
, vs.machine
, sql_text
, vs.process
from
apps.fnd_concurrent_requests fcr,
v$session vs,
v$sqltext vq
where
vs.process = fcr.os_process_id
and vs.sql_address = vq.address
and fcr.status_code = 'R'
and fcr.phase_code = 'R'
   and request_id in
  (select fcr.request_id
  from (select /*+ index (fcr1 FND_CONCURRENT_REQUESTS_N3) */
          fcr1.request_id
       from fnd_concurrent_requests fcr1
         where 1=1
         start with fcr1.request_id = &request_id
          connect by prior fcr1.request_id = fcr1.parent_request_id) x,
          fnd_concurrent_requests fcr,
          fnd_concurrent_programs fcp,
          fnd_concurrent_programs_tl fcptl
          where fcr.request_id = x.request_id
          and fcr.concurrent_program_id = fcp.concurrent_program_id
          and fcr.program_application_id = fcp.application_id
          and fcp.application_id = fcptl.application_id
          and fcp.concurrent_program_id = fcptl.concurrent_program_id
          and fcptl.language = 'US')
order by request_id, serial#, piece;

-- END requests_HANG.sql
 
9) Longops_check.sql

-- Good for monitoring long running SQL session where single SQL ID is taking time OR
finding long running SQL on system
-- OR --
-- SQL process is known to take extensive time and want to monitor and get
calculated/potential time to complete

SELECT inst_id,
sid,
serial#,
sql_id,
opname,
target,
sofar,
totalwork,
start_time,
last_update_time,
ROUND(time_remaining /60,2) "REMAIN MINS",
ROUND(elapsed_seconds/60,2) "ELAPSED MINS",
ROUND((time_remaining+elapsed_seconds)/60,2) "TOTAL MINS",
ROUND(SOFAR /TOTALWORK*100,2) "%_COMPLETE",
MESSAGE
FROM gv$session_longops
WHERE OPNAME NOT LIKE 'RMAN%'
AND OPNAME NOT LIKE '%aggregate%'
AND TOTALWORK != 0
AND SOFAR <>TOTALWORK
AND TIME_REMAINING > 0;

-- END Longops_check.sql

10) requests_orig.sql

-- REQUIRED VALUE - Enter the Request ID that launched the Request set being
investigated

SELECT /*+ ORDERED USE_NL(x fcr fcp fcptl)*/


       fcr.request_id "Request ID",
       fcptl.user_concurrent_program_name"Program Name",
       fcr.phase_code,
       fcr.status_code,
       to_char(fcr.actual_start_date,'DD-MON-YYYY HH24:MI:SS') "Start Time",
       to_char(fcr.actual_completion_date, 'DD-MON-YYYY HH24:MI:SS') "End Time",
       (fcr.actual_completion_date - fcr.actual_start_date)*1440 "Elapsed",
       fcr.oracle_process_id "Trace ID"
  FROM (SELECT /*+ index (fcr1 fnd_concurrent_requests_n3) */
               fcr1.request_id
          FROM apps.fnd_concurrent_requests fcr1
         WHERE 1=1
         START WITH fcr1.request_id = &parent_request_id
       CONNECT BY PRIOR fcr1.request_id = fcr1.parent_request_id) x,
       apps.fnd_concurrent_requests fcr,
       apps.fnd_concurrent_programs fcp,
       apps.fnd_concurrent_programs_tl fcptl
 WHERE fcr.request_id = x.request_id
   AND fcr.concurrent_program_id = fcp.concurrent_program_id
   AND fcr.program_application_id = fcp.application_id
   AND fcp.application_id = fcptl.application_id
   AND fcp.concurrent_program_id = fcptl.concurrent_program_id
   AND fcptl.language = 'US'
 ORDER BY 1;
 
 -- end of requests_orig.sql
SQL script to Cancel Pending Request from a particular user in Oracle Apps
UPDATE fnd_concurrent_requests
SET phase_code = 'C', status_code = 'X'
WHERE request_id in (select cwr.request_id FROM
apps.fnd_concurrent_worker_requests cwr, apps.fnd_concurrent_queues_tl cq,
apps.fnd_user fu
WHERE (cwr.phase_code = 'P')   AND cwr.hold_flag != 'Y'   
--AND cwr.requested_start_date <= SYSDATE
AND cwr.concurrent_queue_id = cq.concurrent_queue_id   AND cwr.queue_application_id
= cq.application_id  and cq.LANGUAGE='US'
AND cwr.requested_by = fu.user_id and fu.user_name='&username'
and cwr.user_concurrent_program_name='&user_concurrent_program_name')

Query to find the Parent and Child Concurrent Request with Run Details and Timings
Query:

SELECT
fcr.request_id "Child Request ID",
PARENT_REQUEST_ID "Parent Request ID",
fcptl.user_concurrent_program_name"Parent Program Name",
fcr.phase_code,
fcr.status_code,
to_char(fcr.actual_start_date,'DD-MON-YYYY HH24:MI:SS') "Start Time",
round((fcr.actual_completion_date - fcr.actual_start_date)*1440,2) "Elapsed Mins"
FROM (SELECT
fcr1.request_id
FROM apps.fnd_concurrent_requests fcr1
WHERE 1=1
START WITH fcr1.request_id = &Parent_request_id
CONNECT BY PRIOR fcr1.request_id = fcr1.parent_request_id) x,
apps.fnd_concurrent_requests fcr,
apps.fnd_concurrent_programs fcp,
apps.fnd_concurrent_programs_tl fcptl
WHERE fcr.request_id = x.request_id
AND fcr.concurrent_program_id = fcp.concurrent_program_id
AND fcr.program_application_id = fcp.application_id
AND fcp.application_id = fcptl.application_id
AND fcp.concurrent_program_id = fcptl.concurrent_program_id
AND fcptl.language = 'US'
ORDER BY 1;
Query to find Data Definition, Template File Name of a Concurrent Program in Oracle Apps

ALTER SESSION SET NLS_LANGUAGE= 'AMERICAN';

SELECT  distinct xddv.data_source_code "Data Definition Code"


,xddv.data_source_code "Concurrent Short Name"
     ,  xddv.data_source_name "Data Definition"
     ,  xddv.description "Data Definition Description"
     ,  xtb.template_code "Template Code"
     ,  xtt.template_name "Template Name"
     ,  xtt.description "Template Description"
     ,  xtb.template_type_code "Type"
     ,  xl.file_name "File Name"
     ,  xtb.default_output_type "Default Output Type" , fat.application_name
  FROM  apps.xdo_ds_definitions_vl xddv
     ,  apps.xdo_templates_b xtb
     ,  apps.xdo_templates_tl xtt
     ,  apps.xdo_lobs xl
     ,  apps.fnd_application_tl fat
     ,  apps.fnd_application fa
 WHERE xddv.data_source_code = '&Concurrent_Program_Short_Name'
   AND xddv.application_short_name = fa.application_short_name
   AND fat.application_id = fa.application_id
   AND xtb.application_short_name = xddv.application_short_name
   AND xddv.data_source_code = xtb.data_source_code
   AND xtt.template_code = xtb.template_code
   AND xl.lob_code = xtb.template_code
   AND xl.xdo_file_type = xtb.template_type_code;

Query to find which all schema password will be changed when using ALLORACLE mode in
FNDCPASS
select * from fnd_oracle_userid where read_only_flag='A';
Query to find Total Concurrent Request Submitted on a Daily Basis
select trunc(request_date) "Date",count(1) "Total Request Completed" from
fnd_concurrent_requests where phase_code='C'  group by trunc(request_date) order by 1
desc;
Query to find the Top Concurrent Job/Requests generating Big Output Files
SELECT
   distinct fcr.request_id,
   user_concurrent_program_name,
    responsibility_name,
    request_date,
    argument_text,
    request_id,
    phase_code,
    status_code,
    logfile_name,
    outfile_name,
    output_file_type,
    hold_flag,
    user_name,
    fcr.ofile_size,
    fcp.creation_date
FROM
    fnd_concurrent_requests fcr,
    fnd_concurrent_programs_tl fcp,
    fnd_responsibility_tl fr,
    fnd_user fu
WHERE
    fcr.CONCURRENT_PROGRAM_ID = fcp.concurrent_program_id
    and fcr.responsibility_id = fr.responsibility_id
    and fcr.requested_by = fu.user_id
    and Phase_code='C'
    and fcp.language='US'
    and fcr.ofile_size is NOT NULL
    ORDER BY fcr.ofile_size desc;
Query to find if we are connected to Run or Patch Database Edition on EBS12.2
SQL> select ad_zd.get_edition_type from dual;
Query to find full Access Details for Users in EBS/Oracle App
SELECT
    distinct fu.user_name "User_Name",
    fu.end_date "User_End_Date",
    frt.responsibility_name "Responsibility_Name",
    fat.application_name "Application_Name",
    furg.start_date "Responsibility_Start_Date",
    furg.end_date "Responsibility_End_Date",
    fu.last_update_date "Last Updated Date",
    (SELECT user_name
FROM fnd_user
WHERE user_id = fu.last_updated_by) "Last Update By"
FROM
    fnd_user_resp_groups_direct furg,
    applsys.fnd_user fu,
    applsys.fnd_responsibility_tl frt,
    applsys.fnd_responsibility fr,
    applsys.fnd_application_tl fat,
    applsys.fnd_application fa
WHERE
        furg.user_id = fu.user_id
    AND
        furg.responsibility_id = frt.responsibility_id
    AND
        fr.responsibility_id = frt.responsibility_id
    AND
        fa.application_id = fat.application_id
    AND
        fr.application_id = fat.application_id
        and fat.language='US'
and frt.language='US'
    ORDER BY 1;
Concurrent Manager Scripts
Oracle supplies several useful scripts, (located in $FND_TOP/sql directory), for monitoring the

concurrent managers:
afcmstat.sql Displays all the defined managers, their maximum capacity, pids, and their status.
Displays the status of ICM and PMON method in effect, the ICM’s log file, and
afimchk.sql
determines if the concurrent manger monitor is running.
Displays the concurrent manager and the name of its log file that processed a
afcmcreq.sql
request.
afrqwait.sql Displays the requests that are pending, held, and scheduled.
Displays of summary of concurrent request execution time and status since a
afrqstat.sql
particular date.
Displays the operating system process id of the FNDLIBR process based on a
afqpmrid.sql
concurrent request id. The process id can then be used with the ORADEBUG utility.
Displays the process id, terminal, and process id that may be causing locks that the
ICM and CRM are waiting to get. You should run this script if there are long delays
afimlock.sql
when submitting jobs, or if you suspect the ICM is in a gridlock with another oracle
process.
Script’s to find concurrent request
###HISTORY OF CONCURRENT REQUEST – SCRIPT (PROGRAM WISE) ###
set pagesize 200
set linesize 200
col “Who submitted” for a25
col “Status” for a10
col “Parameters” for a20
col USER_CONCURRENT_PROGRAM_NAME for a42
SELECT distinct t.user_concurrent_program_name,
r.REQUEST_ID,
to_char(r.ACTUAL_START_DATE,’dd-mm-yy hh24:mi:ss’) “Started at”,
to_char(r.ACTUAL_COMPLETION_DATE,’dd-mm-yy hh24:mi:ss’) “Completed at”,
decode(r.PHASE_CODE,’C’,’Completed’,’I’,’Inactive’,’P ‘,’Pending’,’R’,’Running’,’NA’)
phasecode,
decode(r.STATUS_CODE, ‘A’,’Waiting’, ‘B’,’Resuming’, ‘C’,’Normal’, ‘D’,’Cancelled’,
‘E’,’Error’, ‘F’,’Scheduled’, ‘G’,’Warning’, ‘H’,’On Hold’, ‘I’,’Normal’, ‘M’,
‘No Manager’, ‘Q’,’Standby’, ‘R’,’Normal’, ‘S’,’Suspended’, ‘T’,’Terminating’,
‘U’,’Disabled’, ‘W’,’Paused’, ‘X’,’Terminated’, ‘Z’,’Waiting’) “Status”,r.argument_text
“Parameters”,substr(u.description,1,25) “Who
submitted”,round(((nvl(v.actual_completion_date,sysdate)-
v.actual_start_date)*24*60)) Etime
FROM
apps.fnd_concurrent_requests r ,
apps.fnd_concurrent_programs p ,
apps.fnd_concurrent_programs_tl t,
apps.fnd_user u, apps.fnd_conc_req_summary_v v
WHERE
r.CONCURRENT_PROGRAM_ID = p.CONCURRENT_PROGRAM_ID
AND r.actual_start_date >= (sysdate-30)
–AND r.requested_by=22378
AND   r.PROGRAM_APPLICATION_ID = p.APPLICATION_ID
AND t.concurrent_program_id=r.concurrent_program_id
AND r.REQUESTED_BY=u.user_id
AND v.request_id=r.request_id
–AND r.request_id =’2260046′ in (‘13829387′,’13850423’)
and t.user_concurrent_program_name like ‘%%’
order by to_char(r.ACTUAL_COMPLETION_DATE,’dd-mm-yy hh24:mi:ss’);

  ###Requests completion date details ###


SELECT request_id, TO_CHAR( request_date, ‘DD-MON-YYYY HH24:MI:SS’ )

request_date, TO_CHAR( requested_start_date,’DD-MON-YYYY HH24:MI:SS’ )

requested_start_date, TO_CHAR( actual_start_date, ‘DD-MON-YYYY HH24:MI:SS’ )

actual_start_date, TO_CHAR( actual_completion_date, ‘DD-MON-YYYY HH24:MI:SS’ )

actual_completion_date, TO_CHAR( sysdate, ‘DD-MON-YYYY HH24:MI:SS’ )

current_date, ROUND( ( NVL( actual_completion_date, sysdate ) – actual_start_date ) *


24, 2 ) duration

FROM fnd_concurrent_requests

WHERE request_id = TO_NUMBER(‘&p_request_id’);

### Reqid_from sid ###


SELECT a.request_id, a.PHASE_CODE, a.STATUS_CODE,

d.sid as Oracle_SID,

d.serial#,

d.osuser,

d.process,

c.SPID as OS_Process_ID

FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,

gv$process c,

gv$session d

WHERE a.controlling_manager = b.concurrent_process_id

AND c.pid = b.oracle_process_id

AND b.session_id=d.audsid AND a.PHASE_CODE=’R’ AND a.STATUS_CODE=’R’

AND d.sid = &SID;

###How to Determine Which Manager Ran a Specific Concurrent Request###


col USER_CONCURRENT_QUEUE_NAME for a100

select b.USER_CONCURRENT_QUEUE_NAME from fnd_concurrent_processes a,

fnd_concurrent_queues_vl b, fnd_concurrent_requests c

where a.CONCURRENT_QUEUE_ID = b.CONCURRENT_QUEUE_ID

and a.CONCURRENT_PROCESS_ID = c.controlling_manager

and c.request_id = ‘&conc_reqid’;

###Concurrent request status for a given sid###


col MODULE for a20

col OSUSER for a10

col USERNAME for a10

set num 10

col MACHINE for a20

set lines 200

col SCHEMANAME for a10

select s.INST_ID,s.sid,s.serial#,p.spid os_pid,s.status, s.osuser,s.username,


s.MACHINE,s.MODULE, s.SCHEMANAME,

s.action from gv$session s, gv$process p WHERE s.paddr = p.addr and s.sid =


‘&oracle_sid’;

###Find out request id from Oracle_Process Id###


select REQUEST_ID,ORACLE_PROCESS_ID,OS_PROCESS_Id from
apps.fnd_concurrent_requests where ORACLE_PROCESS_ID=’&a’;
###To find concurrent program name,phase code,status code for a given request id###
SELECT request_id, user_concurrent_program_name,
DECODE(phase_code,’C’,’Completed’,phase_code) phase_code, DECODE(status_code,’D’,
‘Cancelled’ ,

‘E’, ‘Error’ , ‘G’, ‘Warning’, ‘H’,’On Hold’ , ‘T’, ‘Terminating’, ‘M’, ‘No Manager’ , ‘X’,
‘Terminated’,  ‘C’, ‘Normal’, status_code) status_code, to_char(actual_start_date,’dd-mon-
yy:hh24:mi:ss’) Start_Date, to_char(actual_completion_date,’dd-mon-yy:hh24:mi:ss’),
completion_text FROM apps.fnd_conc_req_summary_v WHERE request_id = ‘&req_id’
ORDER BY 6 DESC;

###To find the sql query for a given concurrent request sid###
select sid,sql_text from gv$session ses, gv$sqlarea sql where

ses.sql_hash_value = sql.hash_value(+) and ses.sql_address = sql.address(+)


and ses.sid=’&oracle_sid’

###To find child requests for Parent request id###


set lines 200

col USER_CONCURRENT_PROGRAM_NAME for a40

col PHASE_CODE for a10

col STATUS_CODE for a10

col COMPLETION_TEXT for a20

SELECT sum.request_id,req.PARENT_REQUEST_ID,sum.user_concurrent_program_name,
DECODE(sum.phase_code,’C’,’Completed’,sum.phase_code) phase_code,
DECODE(sum.status_code,’D’, ‘Cancelled’ ,

‘E’, ‘Error’ , ‘G’, ‘Warning’, ‘H’,’On Hold’ , ‘T’, ‘Terminating’, ‘M’, ‘No Manager’ , ‘X’,
‘Terminated’,  ‘C’, ‘Normal’, sum.status_code) status_code, sum.actual_start_date,
sum.actual_completion_date, sum.completion_text FROM
apps.fnd_conc_req_summary_v sum, apps.fnd_concurrent_requests req where
req.request_id=sum.request_id and req.PARENT_REQUEST_ID =
‘&parent_concurrent_request_id’;

set col os_process_id for 99

select HAS_SUB_REQUEST, is_SUB_REQUEST, parent_request_id, ORACLE_PROCESS_ID,


ORACLE_SESSION_ID, OS_PROCESS_ID from fnd_concurrent_requests where
request_id= ‘&Req_ID’ ;

###Cancelling Concurrent request ###


 –By request id

update fnd_concurrent_requests
set status_code=’D’, phase_code=’C’

where request_id=&req_id;

–by program_id

update fnd_concurrent_requests

set status_code=’D’, phase_code=’C’

where CONCURRENT_PROGRAM_ID=&prg_id;

###To terminate the all concurrent requests using by Module wise###


select ‘ALTER SYSTEM KILL SESSION ”’||sid||’,’||serial#||”’ immediate;’ from gv$session
where MODULE like ‘GLPREV’;

###History of concurrent requests which are error out ###


SELECT a.request_id “Req Id”

,a.phase_code,a.status_code

, actual_start_date

, actual_completion_date

,c.concurrent_program_name || ‘: ‘ || ctl.user_concurrent_program_name “program”

FROM APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_processes b

,applsys.fnd_concurrent_queues q

,APPLSYS.fnd_concurrent_programs c

,APPLSYS.fnd_concurrent_programs_tl ctl

WHERE a.controlling_manager = b.concurrent_process_id

AND a.concurrent_program_id = c.concurrent_program_id

AND a.program_application_id = c.application_id

AND a.status_code = ‘E’

AND a.phase_code = ‘C’

AND actual_start_date > sysdate – 2

AND b.queue_application_id = q.application_id

AND b.concurrent_queue_id = q.concurrent_queue_id

AND ctl.concurrent_program_id = c.concurrent_program_id

AND ctl.LANGUAGE = ‘US’

ORDER BY 5 DESC;
### Find out Concurrent Program which enable with trace###
col User_Program_Name for a40

col Last_Updated_By for a30

col DESCRIPTION for a30

SELECT A.CONCURRENT_PROGRAM_NAME “Program_Name”,

SUBSTR(A.USER_CONCURRENT_PROGRAM_NAME,1,40) “User_Program_Name”,

SUBSTR(B.USER_NAME,1,15) “Last_Updated_By”,

SUBSTR(B.DESCRIPTION,1,25) DESCRIPTION

FROM APPS.FND_CONCURRENT_PROGRAMS_VL A, APPLSYS.FND_USER B

WHERE A.ENABLE_TRACE=’Y’

AND A.LAST_UPDATED_BY=B.USER_ID;

 ###Concurrent Program count under QUEUE ###


col  “program name” format a55;

col “name” format  a17;

col “queue name” format a15

col “statuscode” format a3

select user_CONCURRENT_PROGRAM_NAME “PROGRAM


NAME”,concurrent_queue_name “QUEUE NAME”,
priority,decode(phase_code,’P’,’Pending’) “PHASE”,

decode(status_code,’A’,’Waiting’,’B’,’Resuming’,’C’,’Normal’,’D’,’Cancelled’,’E’,’Error’,’F’,

‘Scheduled’,’G’,’Warning’,’H’,’On Hold’,’I’,’Normal’,’M’,’No
Manager’,’Q’,’Standby’,’R’,’Normal’,’S’,

‘Suspended’,’T’,’Terminating’,’U’,’Disabled’,’W’,’Paused’,’X’,’Terminated’,’Z’,’Waiting’) “

NAME”, status_code,count(*) from

fnd_concurrent_worker_requests

where  phase_code=’P’ and hold_flag!=’Y’

and requested_start_date<=sysdate

and concurrent_queue_name<> ‘FNDCRM’

and concurrent_queue_name<> ‘GEMSPS’

group by
user_CONCURRENT_PROGRAM_NAME,

concurrent_queue_name,priority,phase_code,status_code

order by count(*) desc

###Lists the Manager Names with the No. of Requests in Pending/Running ###
col “USER_CONCURRENT_QUEUE_NAME” format a40;

SELECT a.USER_CONCURRENT_QUEUE_NAME,a.MAX_PROCESSES,

sum(decode(b.PHASE_CODE,’P’,decode(b.STATUS_CODE,’Q’,1,0),0)) Pending_Standby,

sum(decode(b.PHASE_CODE,’P’,decode(b.STATUS_CODE,’I’,1,0),0)) Pending_Normal,

sum(decode(b.PHASE_CODE,’R’,decode(b.STATUS_CODE,’R’,1,0),0)) Running_Normal

FROM FND_CONCURRENT_QUEUES_VL a, FND_CONCURRENT_WORKER_REQUESTS b

where a.concurrent_queue_id = b.concurrent_queue_id

AND b.Requested_Start_Date<=SYSDATE

GROUP BY a.USER_CONCURRENT_QUEUE_NAME,a.MAX_PROCESSES;

### Concurrent QUEUE Details ###


set echo off

set linesize 130

set serveroutput on size 50000

set feed off

set veri off

DECLARE

running_count NUMBER := 0;

pending_count NUMBER := 0;

crm_pend_count NUMBER := 0;

–get the list of all conc managers and max worker and running workers

CURSOR conc_que IS

SELECT concurrent_queue_id,

concurrent_queue_name,

user_concurrent_queue_name,
max_processes,

running_processes

FROM apps.fnd_concurrent_queues_vl

WHERE enabled_flag=’Y’ and

concurrent_queue_name not like ‘XDP%’ and

concurrent_queue_name not like ‘IEU%’ and

concurrent_queue_name not in (‘ARTAXMGR’,’PASMGR’) ;

BEGIN

DBMS_OUTPUT.PUT_LINE(‘==================================================
==================================================’);

DBMS_OUTPUT.PUT_LINE(‘QueueID’||’ ‘||’Queue          ‘||

‘Concurrent Queue Name              ‘||’ ‘||’MAX ‘||’ ‘||’RUN ‘||’ ‘||

‘Running ‘||’ ‘||’Pending   ‘||’ ‘||’In CRM’);

DBMS_OUTPUT.PUT_LINE(‘==================================================
==================================================’);

FOR i IN conc_que

LOOP

–for each manager get the number of pending and running requests in each queue

SELECT /*+ RULE */ nvl(sum(decode(phase_code, ‘R’, 1, 0)), 0),

nvl(sum(decode(phase_code, ‘P’, 1, 0)), 0)

INTO running_count, pending_count

FROM fnd_concurrent_worker_requests

WHERE

requested_start_date <= sysdate

and concurrent_queue_id = i.concurrent_queue_id

AND hold_flag != ‘Y’;

–for each manager get the list of requests pending due to conflicts in each manager

SELECT /*+ RULE */ count(1)

INTO crm_pend_count
FROM apps.fnd_concurrent_worker_requests a

WHERE concurrent_queue_id = 4

AND hold_flag != ‘Y’

AND requested_start_date <= sysdate

AND exists (

SELECT ‘x’

FROM apps.fnd_concurrent_worker_requests b

WHERE a.request_id=b.request_id

and concurrent_queue_id = i.concurrent_queue_id

AND hold_flag != ‘Y’

AND requested_start_date <= sysdate);

–print the output by joining the outputs of manager counts,

DBMS_OUTPUT.PUT_LINE(

rpad(i.concurrent_queue_id,8,’_’)||

rpad(i.concurrent_queue_name,15, ‘ ‘)||

rpad(i.user_concurrent_queue_name,40,’ ‘)||

rpad(i.max_processes,6,’ ‘)||

rpad(i.running_processes,6,’ ‘)||

rpad(running_count,10,’ ‘)||

rpad(pending_count,10,’ ‘)||

rpad(crm_pend_count,10,’ ‘));


DBMS_OUTPUT.PUT_LINE(‘————————————————————————————
—————-‘);

END LOOP;

DBMS_OUTPUT.PUT_LINE(‘==================================================
==================================================’);

END;

set verify on
set echo on

Analyzer.sql
----------------------------------------------------------------------------------------

--

-- analyzereq.sql

-- Analyze a concurrent request

--

-- USAGE: sqlplus apps_user/apps_passwd @analyzereq request_id

-- EX: sqlplus apps/apps @analyzereq 304504

--

--

-- $Id: analyzereq.sql,v 1.4 2001/06/16 22:20:06 pferguso Exp $

--

-- $Log: analyzereq.sql,v $

-- Revision 1.4 2001/06/16 22:20:06 pferguso

-- Removed FND_CONC diagnosis

--

-- Revision 1.3 2001/04/07 19:49:43 pferguso

-- whoa, lots of changes...

--

-- Revision 1.2 2000/04/03 04:18:04 pferguso

-- added print_mgrs, more request info

--

-- Revision 1.1.1.1 2000/02/23 22:00:36 pferguso

-- initial import into CVS

--

-- Revision 1.3 1999-12-29 13:46:44-05 pferguso

-- added responsibility info, logfile names

--

-- Revision 1.2 1999-12-29 13:13:58-05 pferguso

-- first usable version


--

-- Revision 1.1 1999-10-19 18:04:23-04 pferguso

-- Initial revision

--

--

--

----------------------------------------------------------------------------------------

set serveroutput on

set feedback off

set verify off

set heading off

set timing off

prompt

DECLARE

req_id number(15) := &1;

FUNCTION get_status(p_status_code varchar2) return varchar2 AS

c_status fnd_lookups.meaning%TYPE;

BEGIN

SELECT nvl(meaning, 'UNKNOWN')

INTO c_status
FROM fnd_lookups

WHERE LOOKUP_TYPE = 'CP_STATUS_CODE'

AND LOOKUP_CODE = p_status_code;

return rtrim(c_status);

END get_status;

FUNCTION get_phase(p_phase_code varchar2) return varchar2 AS

c_phase fnd_lookups.meaning%TYPE;

BEGIN

SELECT nvl(meaning, 'UNKNOWN')

INTO c_phase

FROM fnd_lookups

WHERE LOOKUP_TYPE = 'CP_PHASE_CODE'

AND LOOKUP_CODE = p_phase_code;

return rtrim(c_phase);

END get_phase;

PROCEDURE manager_check (req_id in number,

cd_id in number,

mgr_defined out boolean,

mgr_active out boolean,

mgr_workshift out boolean,

mgr_running out boolean,

run_alone out boolean) is

cursor mgr_cursor (rid number) is

select running_processes, max_processes,

decode(control_code,

'T','N', -- Abort
'X','N', -- Aborted

'D','N', -- Deactivate

'E','N', -- Deactivated

'Y') active

from fnd_concurrent_worker_requests

where request_id = rid

and not((queue_application_id = 0)

and (concurrent_queue_id in (1,4)));

run_alone_flag varchar2(1);

begin

mgr_defined := FALSE;

mgr_active := FALSE;

mgr_workshift := FALSE;

mgr_running := FALSE;

for mgr_rec in mgr_cursor(req_id) loop

mgr_defined := TRUE;

if (mgr_rec.active = 'Y') then

mgr_active := TRUE;

if (mgr_rec.max_processes > 0) then

mgr_workshift := TRUE;

end if;

if (mgr_rec.running_processes > 0) then

mgr_running := TRUE;

end if;

end if;

end loop;

if (cd_id is null) then


run_alone_flag := 'N';

else

select runalone_flag

into run_alone_flag

from fnd_conflicts_domain d

where d.cd_id = manager_check.cd_id;

end if;

if (run_alone_flag = 'Y') then

run_alone := TRUE;

else

run_alone := FALSE;

end if;

end manager_check;

PROCEDURE print_mgrs(p_req_id number) AS

CURSOR c_mgrs(rid number) IS

SELECT user_concurrent_queue_name name, fcwr.running_processes active,

decode(fcwr.control_code, 'A', fl.meaning,

'D', fl.meaning,

'E', fl.meaning,

'N', fl.meaning,

'R', fl.meaning,

'T', fl.meaning,

'U', fl.meaning,

'V', fl.meaning,

'X', fl.meaning,

NULL, 'Running',

'** Unknown Status **') status

FROM fnd_concurrent_queues_vl fcqv, fnd_concurrent_worker_requests fcwr, fnd_lookups fl

WHERE fcwr.request_id = rid

AND fcwr.concurrent_queue_id = fcqv.concurrent_queue_id


AND fcwr.concurrent_queue_id not in (1, 4)

AND fl.lookup_code (+) = fcwr.control_code

AND fl.lookup_type (+) = 'CP_CONTROL_CODE';

BEGIN

for mgr_rec in c_mgrs(p_req_id) loop

DBMS_OUTPUT.PUT_LINE('- ' || mgr_rec.name || ' | Status: ' || mgr_rec.status || ' (' ||


mgr_rec.active || ' active processes)');

end loop;

END print_mgrs;

PROCEDURE analyze_request(p_req_id number) AS

reqinfo fnd_concurrent_requests%ROWTYPE;

proginfo fnd_concurrent_programs_vl%ROWTYPE;

c_status fnd_lookups.meaning%TYPE;

m_buf fnd_lookups.meaning%TYPE;

conc_prog_name fnd_concurrent_programs.concurrent_program_name%TYPE;

exe_method_code fnd_concurrent_programs_vl.execution_method_code%TYPE;

conc_app_name fnd_application_vl.application_name%TYPE;

tmp_id number(15);

tmp_status fnd_concurrent_requests.status_code%TYPE;

tmp_date date;

conc_app_id fnd_concurrent_requests.program_application_id%TYPE;

conc_id fnd_concurrent_requests.concurrent_program_id%TYPE;

conc_cd_id fnd_concurrent_requests.cd_id%TYPE;

v_enabled_flag fnd_concurrent_programs.enabled_flag%TYPE;
conflict_domain fnd_conflicts_domain.user_cd_name%TYPE;

parent_id number(15);

resp_name varchar2(100);

rclass_name fnd_concurrent_request_class.request_class_name%TYPE;

exe_file_name fnd_executables.execution_file_name%TYPE;

c_user fnd_user.user_name%TYPE;

last_user fnd_user.user_name%TYPE;

fcd_phase varchar2(48);

fcd_status varchar2(48);

traid fnd_concurrent_requests.program_application_id%TYPE;

trcpid fnd_concurrent_requests.concurrent_program_id%TYPE;

icount number;

ireqid fnd_concurrent_requests.request_id%TYPE;

pcode fnd_concurrent_requests.phase_code%TYPE;

scode fnd_concurrent_requests.status_code%TYPE;

live_child boolean;

mgr_defined boolean;

mgr_active boolean;

mgr_workshift boolean;

mgr_running boolean;

run_alone boolean;

reqlimit boolean := false;

mgrname fnd_concurrent_queues_vl.user_concurrent_queue_name%TYPE;

filename varchar2(255);
qcf fnd_concurrent_programs.queue_control_flag%TYPE;

sep varchar2(200) := '------------------------------------------------------';

REQ_NOTFOUND exception;

CURSOR c_wait IS

SELECT request_id, phase_code, status_code

FROM fnd_concurrent_requests

WHERE parent_request_id = p_req_id;

CURSOR c_inc IS

SELECT to_run_application_id, to_run_concurrent_program_id

FROM fnd_concurrent_program_serial

WHERE running_application_id = conc_app_id

AND running_concurrent_program_id = conc_id;

CURSOR c_ireqs IS

SELECT request_id, phase_code, status_code

FROM fnd_concurrent_requests

WHERE phase_code = 'R'

AND program_application_id = traid

AND concurrent_program_id = trcpid

AND cd_id = conc_cd_id;

CURSOR c_userreqs(uid number, s date) IS

SELECT request_id, to_char(requested_start_date, 'DD-MON-RR HH24:MI:SS') start_date,

phase_code, status_code

FROM fnd_concurrent_requests

WHERE phase_code IN ('R', 'P')


AND requested_by = uid

AND requested_start_date < s

AND hold_flag = 'N';

BEGIN

BEGIN

SELECT *

INTO reqinfo

FROM fnd_concurrent_requests

WHERE request_id = p_req_id;

EXCEPTION

WHEN NO_DATA_FOUND THEN

raise REQ_NOTFOUND;

END;

DBMS_OUTPUT.PUT_LINE('Analyzing request '||req_id||':');

DBMS_OUTPUT.PUT_LINE(sep);

-- Program information

DBMS_OUTPUT.PUT_LINE('Program information:');

SELECT fvl.*

INTO proginfo

FROM fnd_concurrent_programs_vl fvl, fnd_concurrent_requests fcr

WHERE fcr.request_id = p_req_id

AND fcr.concurrent_program_id = fvl.concurrent_program_id

AND fcr.program_application_id = fvl.application_id;


DBMS_OUTPUT.PUT_LINE('Program: '|| proginfo.user_concurrent_program_name || ' (' ||
proginfo.concurrent_program_name || ')');

SELECT nvl(application_name, '-- UNKNOWN APPLICATION --')

INTO conc_app_name

FROM fnd_application_vl fvl, fnd_concurrent_requests fcr

WHERE fcr.request_id = p_req_id

AND fcr.program_application_id = fvl.application_id;

DBMS_OUTPUT.PUT_LINE('Application: '||conc_app_name);

SELECT nvl(meaning, 'UNKNOWN')

INTO m_buf

FROM fnd_lookups

WHERE lookup_type = 'CP_EXECUTION_METHOD_CODE'

AND lookup_code = proginfo.execution_method_code;

SELECT nvl(execution_file_name, 'NONE')

INTO exe_file_name

FROM fnd_executables

WHERE application_id = proginfo.executable_application_id

AND executable_id = proginfo.executable_id;

DBMS_OUTPUT.PUT_LINE('Executable type: ' || m_buf || ' (' ||


proginfo.execution_method_code || ')');

DBMS_OUTPUT.PUT_LINE('Executable file name or procedure: ' || exe_file_name);

DBMS_OUTPUT.PUT_LINE('Run alone flag: ' || proginfo.run_alone_flag);

DBMS_OUTPUT.PUT_LINE('SRS flag: ' || proginfo.srs_flag);

DBMS_OUTPUT.PUT_LINE('NLS compliant: ' || proginfo.nls_compliant);

DBMS_OUTPUT.PUT_LINE('Output file type: ' || proginfo.output_file_type);

if proginfo.concurrent_class_id is not null then


select request_class_name

into rclass_name

from fnd_concurrent_request_class

where application_id = proginfo.class_application_id

and request_class_id = proginfo.concurrent_class_id;

DBMS_OUTPUT.PUT_LINE('Request type: ' || rclass_name);

end if;

if proginfo.execution_options is not null then

DBMS_OUTPUT.PUT_LINE('Execution options: ' || proginfo.execution_options);

end if;

if proginfo.enable_trace = 'Y' then

DBMS_OUTPUT.PUT_LINE('SQL Trace has been enabled for this program.');

end if;

DBMS_OUTPUT.PUT_LINE(sep);

DBMS_OUTPUT.PUT_LINE('

');

DBMS_OUTPUT.PUT_LINE(sep);

-- Submission information

DBMS_OUTPUT.PUT_LINE('Submission information:');

begin

SELECT user_name into c_user from fnd_user

where user_id = reqinfo.requested_by;

exception

when no_data_found then

c_user := '-- UNKNOWN USER --';


end;

begin

SELECT user_name into last_user from fnd_user

WHERE user_id = reqinfo.last_updated_by;

exception

when no_data_found then

last_user := '-- UNKNOWN USER --';

end;

DBMS_OUTPUT.PUT_LINE('It was submitted by user: '||c_user);

SELECT responsibility_name

INTO resp_name

FROM fnd_responsibility_vl

WHERE responsibility_id = reqinfo.responsibility_id

AND application_id = reqinfo.responsibility_application_id;

DBMS_OUTPUT.PUT_LINE('Using responsibility: ' || resp_name);

DBMS_OUTPUT.PUT_LINE('It was submitted on: ' || to_char(reqinfo.request_date, 'DD-MON-RR


HH24:MI:SS'));

DBMS_OUTPUT.PUT_LINE('It was requested to start on: '||

to_char(reqinfo.requested_start_date, 'DD-MON-RR HH24:MI:SS'));

DBMS_OUTPUT.PUT_LINE('Parent request id: ' || reqinfo.parent_request_id);

DBMS_OUTPUT.PUT_LINE('Language: ' || reqinfo.nls_language);

DBMS_OUTPUT.PUT_LINE('Territory: ' || reqinfo.nls_territory);

DBMS_OUTPUT.PUT_LINE('Priority: ' || to_char(reqinfo.priority));

DBMS_OUTPUT.PUT_LINE('Arguments (' || reqinfo.number_of_arguments || '): ' ||


reqinfo.argument_text);

c_status := get_status(reqinfo.status_code);
DBMS_OUTPUT.PUT_LINE(sep);

DBMS_OUTPUT.PUT_LINE('

');

DBMS_OUTPUT.PUT_LINE(sep);

-- Analysis

DBMS_OUTPUT.PUT_LINE('Analysis:');

-- Completed Requests

-------------------------------------------------------------------------------------------------------------

IF reqinfo.phase_code = 'C' THEN

DBMS_OUTPUT.PUT_LINE('Request '||p_req_id||' has completed with status "'||


c_status||'".');

DBMS_OUTPUT.PUT_LINE('It began running on: '||

nvl(to_char(reqinfo.actual_start_date, 'DD-MON-RR HH24:MI:SS'),

'-- NO START DATE --'));

DBMS_OUTPUT.PUT_LINE('It completed on: '||

nvl(to_char(reqinfo.actual_completion_date, 'DD-MON-RR
HH24:MI:SS'),

'-- NO COMPLETION
DATE --'));

BEGIN

SELECT user_concurrent_queue_name

INTO mgrname

FROM fnd_concurrent_queues_vl

WHERE concurrent_queue_id = reqinfo.controlling_manager;

DBMS_OUTPUT.PUT_LINE('It was run by manager: ' || mgrname);


EXCEPTION

WHEN NO_DATA_FOUND THEN

SELECT queue_control_flag

INTO qcf

FROM fnd_concurrent_programs

WHERE concurrent_program_id = reqinfo.concurrent_program_id

AND application_id = reqinfo.program_application_id;

IF qcf = 'Y' THEN

DBMS_OUTPUT.PUT_LINE('This request is a queue control request, it was run by


the ICM');

ELSE

DBMS_OUTPUT.PUT_LINE('It was run by an unknown manager.');

END IF;

END;

SELECT nvl(reqinfo.logfile_name, '-- No logfile --')

INTO filename

FROM dual;

DBMS_OUTPUT.PUT_LINE('Logfile: ' || filename);

SELECT nvl(reqinfo.outfile_name, '-- No output file --')

INTO filename

FROM dual;

DBMS_OUTPUT.PUT_LINE('Output file: ' || filename);

DBMS_OUTPUT.PUT_LINE('It produced completion message: ');

DBMS_OUTPUT.PUT_LINE(nvl(reqinfo.completion_text, '-- NO COMPLETION MESSAGE


--'));
-- Running Requests

-------------------------------------------------------------------------------------------------------------

ELSIF reqinfo.phase_code = 'R' THEN

DBMS_OUTPUT.PUT_LINE('Request '||p_req_id||' is currently running with status


"'||c_status||'".');

DBMS_OUTPUT.PUT_LINE('It began running on: '||

nvl(to_char(reqinfo.actual_start_date, 'DD-MON-RR
HH24:MI:SS'),

'-- NO START DATE


--'));

BEGIN

SELECT user_concurrent_queue_name

INTO mgrname

FROM fnd_concurrent_queues_vl

WHERE concurrent_queue_id = reqinfo.controlling_manager;

DBMS_OUTPUT.PUT_LINE('It is being run by manager: ' || mgrname);

EXCEPTION

WHEN NO_DATA_FOUND THEN

null;

END;

SELECT nvl(reqinfo.logfile_name, '-- No logfile --')

INTO filename

FROM dual;

DBMS_OUTPUT.PUT_LINE('Logfile: ' || filename);

SELECT nvl(reqinfo.outfile_name, '-- No output file --')

INTO filename

FROM dual;

DBMS_OUTPUT.PUT_LINE('Output file: ' || filename);


IF reqinfo.os_process_id is not null THEN

DBMS_OUTPUT.PUT_LINE('OS process id: ' || reqinfo.os_process_id);

END IF;

IF reqinfo.status_code = 'Z' THEN

-- Waiting request, See what it is waiting on

FOR child in c_wait LOOP

DBMS_OUTPUT.PUT_LINE('It is waiting on request '||

child.request_id||' phase = '||


get_phase(child.phase_code)||

' status = '||get_status(child.status_code));

END LOOP;

ELSIF reqinfo.status_code = 'W' THEN

-- Paused, check and see if it is a request set, and if its children are running

SELECT nvl(concurrent_program_name, 'UNKNOWN')

INTO conc_prog_name

FROM fnd_concurrent_programs

WHERE concurrent_program_id = reqinfo.concurrent_program_id;

DBMS_OUTPUT.PUT_LINE('A Running/Paused request is waiting on one or


more child requests to complete.');

IF conc_prog_name = 'FNDRSSTG' THEN

DBMS_OUTPUT.PUT_LINE('This program appears to be a Request


Set Stage.');

END IF;
IF instr(conc_prog_name, 'RSSUB') > 0 THEN

DBMS_OUTPUT.PUT_LINE('This program appears to be a Request


Set parent program.');

END IF;

live_child := FALSE;

FOR child in c_wait LOOP

DBMS_OUTPUT.PUT_LINE('It has a child request: '||

child.request_id||' (phase = '||


get_phase(child.phase_code)||

' - status = '||


get_status(child.status_code)||')');

IF child.phase_code != 'C' THEN

live_child := TRUE;

END IF;

END LOOP;

IF live_child = FALSE THEN

DBMS_OUTPUT.PUT_LINE('This request has no child requests that


are still running. You may need to wake this request up manually.');

END IF;

END IF;

-- Pending Requests

-------------------------------------------------------------------------------------------------------------

ELSIF reqinfo.phase_code = 'P' THEN


DBMS_OUTPUT.PUT_LINE('Request '||p_req_id||' is in phase "Pending" with status "'||
c_status||'".');

DBMS_OUTPUT.PUT_LINE(' (phase_code = P) (status_code = '||


reqinfo.status_code||')');

-- could be a queue control request

SELECT queue_control_flag

INTO qcf

FROM fnd_concurrent_programs

WHERE concurrent_program_id = reqinfo.concurrent_program_id

AND application_id = reqinfo.program_application_id;

IF qcf = 'Y' THEN

DBMS_OUTPUT.PUT_LINE('This request is a queue control request');

DBMS_OUTPUT.PUT_LINE('It will be run by the ICM on its next sleep cycle');

GOTO diagnose;

END IF;

-- why is it pending?

-- could be scheduled

IF reqinfo.requested_start_date > sysdate or reqinfo.status_code = 'P' THEN

DBMS_OUTPUT.PUT_LINE('This is a scheduled request.');

DBMS_OUTPUT.PUT_LINE('It is currently scheduled to start running on '||

to_char(reqinfo.requested_start_date, 'DD-MON-RR HH24:MI:SS'));

DBMS_OUTPUT.PUT_LINE('This should show on the form as Pending/Scheduled');

GOTO diagnose;

END IF;

-- could be on hold

IF reqinfo.hold_flag = 'Y' THEN


DBMS_OUTPUT.PUT_LINE('This request is currently on hold. It will not run until the
hold is released.');

DBMS_OUTPUT.PUT_LINE('It was placed on hold by: '||last_user||' on '||


to_char(reqinfo.last_update_date, 'DD-MON-RR HH24:MI:SS'));

DBMS_OUTPUT.PUT_LINE('This should show on the form as Inactive/On Hold');

GOTO diagnose;

END IF;

-- could be disabled

IF proginfo.enabled_flag = 'N' THEN

DBMS_OUTPUT.PUT_LINE('This request is currently disabled.');

DBMS_OUTPUT.PUT_LINE('The concurrent_program '||


proginfo.user_concurrent_program_name ||' needs to be enabled for this request to run.');

DBMS_OUTPUT.PUT_LINE('This should show on the form as Inactive/Disabled');

GOTO diagnose;

END IF;

-- check queue_method_code

-- unconstrained requests

IF reqinfo.queue_method_code = 'I' THEN

DBMS_OUTPUT.PUT_LINE('This request is an unconstrained request.


(queue_method_code = I)');

IF reqinfo.status_code = 'I' THEN

DBMS_OUTPUT.PUT_LINE('It is in a "Pending/Normal" status, ready to be run by the


next available manager.');

ELSIF reqinfo.status_code = 'Q' THEN

DBMS_OUTPUT.PUT_LINE('It has a status of "Standby" even though it is unconstrained.


It will not be run by any manager.');

ELSIF reqinfo.status_code IN ('A', 'Z') THEN

DBMS_OUTPUT.PUT_LINE('It is in a "Waiting" status. This usually indicates a child


request waiting for the parent to release it.');

SELECT nvl(parent_request_id, -1)


INTO parent_id

FROM fnd_conc_req_summary_v

WHERE request_id = p_req_id;

IF parent_id = -1 THEN

DBMS_OUTPUT.PUT_LINE('** Unable to find a parent request for this request');

ELSE

DBMS_OUTPUT.PUT_LINE('It''s parent request id is: ' || to_char(parent_id));

END IF;

ELSE

DBMS_OUTPUT.PUT_LINE('Hmmm. A status of ' || reqinfo.status_code || '. I was not


really expecting to see this status.');

END IF;

-- constrained requests

ELSIF reqinfo.queue_method_code = 'B' THEN

DBMS_OUTPUT.PUT_LINE('This request is a constrained request. (queue_method_code =


B)');

IF reqinfo.status_code = 'I' THEN

DBMS_OUTPUT.PUT_LINE('The Conflict Resolution manager has released this request,


and it is in a "Pending/Normal" status.');

DBMS_OUTPUT.PUT_LINE('It is ready to be run by the next available manager.');

ELSIF reqinfo.status_code = 'Q' THEN

DBMS_OUTPUT.PUT_LINE('It is in a "Pending/Standby" status. The Conflict Resolution


manager will need to release it before it can be run.');

ELSIF reqinfo.status_code IN ('A', 'Z') THEN

DBMS_OUTPUT.PUT_LINE('It is in a "Waiting" status. This usually indicates a child


request waiting for the parent to release it.');

SELECT nvl(parent_request_id, -1)

INTO parent_id

FROM fnd_conc_req_summary_v

WHERE request_id = p_req_id;

IF parent_id = -1 THEN

DBMS_OUTPUT.PUT_LINE('** Unable to find a parent request for this request');


ELSE

DBMS_OUTPUT.PUT_LINE('It''s parent request id is: ' || to_char(parent_id));

END IF;

ELSE

DBMS_OUTPUT.PUT_LINE('Hmmm. A status of ' || reqinfo.status_code || '. I was not


really expecting to see this status.');

END IF;

-- incompatible programs

SELECT program_application_id, concurrent_program_id, cd_id

INTO conc_app_id, conc_id, conc_cd_id

FROM fnd_concurrent_requests

WHERE request_id = p_req_id;

icount := 0;

FOR progs in c_inc LOOP

traid := progs.to_run_application_id;

trcpid := progs.to_run_concurrent_program_id;

OPEN c_ireqs;

LOOP

FETCH c_ireqs INTO ireqid, pcode, scode;

EXIT WHEN c_ireqs%NOTFOUND;

DBMS_OUTPUT.PUT_LINE('Request '|| p_req_id ||' is waiting, or


will have to wait, on an incompatible request: '|| ireqid );

DBMS_OUTPUT.PUT_LINE('which has phase = '|| pcode ||' and


status = '|| scode);

icount := icount + 1;
END LOOP;

CLOSE c_ireqs;

END LOOP;

IF icount = 0 THEN

DBMS_OUTPUT.PUT_LINE('No running incompatible requests were found


for request '||p_req_id);

END IF;

-- could be a runalone itself

IF proginfo.run_alone_flag = 'Y' THEN

DBMS_OUTPUT.PUT_LINE('This request is constrained because it is a runalone


request.');

END IF;

-- single threaded

IF reqinfo.single_thread_flag = 'Y' THEN

DBMS_OUTPUT.PUT_LINE('This request is constrained because the profile option


Concurrent: Sequential Requests is set.');

reqlimit := true;

END IF;

-- request limit

IF reqinfo.request_limit = 'Y' THEN

DBMS_OUTPUT.PUT_LINE('This request is constrained because the profile option


Concurrent: Active Request Limit is set.');

reqlimit := true;

END IF;

IF reqlimit = true THEN

DBMS_OUTPUT.PUT_LINE('This request may have to wait on these requests:');

FOR progs in c_userreqs(reqinfo.requested_by, reqinfo.requested_start_date) LOOP

DBMS_OUTPUT.PUT_LINE('Request id: ' || progs.request_id || ' Requested start


date: ' || progs.start_date);
DBMS_OUTPUT.PUT_LINE(' Phase: ' || get_phase(progs.phase_code) || ' Status: '
|| get_status(progs.status_code));

END LOOP;

END IF;

-- error, invalid queue_method_code

ELSE

DBMS_OUTPUT.PUT_LINE('** This request has an invalid queue_method_code of '||


reqinfo.queue_method_code);

DBMS_OUTPUT.PUT_LINE('** This request will not be run. You may need to apply patch
739644.');

GOTO diagnose;

END IF;

DBMS_OUTPUT.PUT_LINE(sep);

DBMS_OUTPUT.PUT_LINE('Checking managers available to run this request...');

-- check the managers

manager_check(p_req_id, reqinfo.cd_id, mgr_defined, mgr_active, mgr_workshift,


mgr_running, run_alone);

-- could be a runalone ahead of it

IF run_alone = TRUE THEN

DBMS_OUTPUT.PUT_LINE('There is a runalone request running ahead of this request');

DBMS_OUTPUT.PUT_LINE('This should show on the form as Inactive/No Manager');

select user_cd_name into conflict_domain from fnd_conflicts_domain

where cd_id = reqinfo.cd_id;

DBMS_OUTPUT.PUT_LINE('Conflict domain = '||conflict_domain);

-- see what is running

begin

select request_id, status_code, actual_start_date

into tmp_id, tmp_status, tmp_date

from fnd_concurrent_requests fcr, fnd_concurrent_programs fcp


where fcp.run_alone_flag = 'Y'

and fcp.concurrent_program_id = fcr.concurrent_program_id

and fcr.phase_code = 'R'

and fcr.cd_id = reqinfo.cd_id;

DBMS_OUTPUT.PUT_LINE('This request is waiting for request '||tmp_id||

', which is running with status '||get_status(tmp_status));

DBMS_OUTPUT.PUT_LINE('It has been running since: '||

nvl(to_char(tmp_date, 'DD-MON-RR HH24:MI:SS'), '-- NO


START DATE --'));

exception

when NO_DATA_FOUND then

DBMS_OUTPUT.PUT_LINE('** The runalone flag is set for conflict domain '||


conflict_domain||

', but there is no runalone request running');

end;

ELSIF mgr_defined = FALSE THEN

DBMS_OUTPUT.PUT_LINE('There is no manager defined that can run this request');

DBMS_OUTPUT.PUT_LINE('This should show on the form as Inactive/No Manager');

DBMS_OUTPUT.PUT_LINE('Check the specialization rules for each manager to make sure


they are defined correctly.');

ELSIF mgr_active = FALSE THEN

DBMS_OUTPUT.PUT_LINE('There are one or more managers defined that can run this
request, but none of them are currently active');

DBMS_OUTPUT.PUT_LINE('This should show on the form as Inactive/No Manager');

-- print out which managers can run it and their status

DBMS_OUTPUT.PUT_LINE('These managers are defined to run this request:');

print_mgrs(p_req_id);

ELSIF mgr_workshift = FALSE THEN

DBMS_OUTPUT.PUT_LINE('Right now, there is no manager running in an active workshift


that can run this request');

DBMS_OUTPUT.PUT_LINE('This should show on the form as Inactive/No Manager');


-- display details about the workshifts

ELSIF mgr_running = FALSE THEN

DBMS_OUTPUT.PUT_LINE('There is one or more managers available to run this request,


but none of them are running');

DBMS_OUTPUT.PUT_LINE('This should show on the form as Inactive/No Manager');

-- print out which managers can run it and their status

print_mgrs(p_req_id);

ELSE

-- print out the managers available to run it

DBMS_OUTPUT.PUT_LINE('These managers are available to run this request:');

print_mgrs(p_req_id);

END IF;

-- invalid phase code

ELSE

DBMS_OUTPUT.PUT_LINE('Request '||p_req_id||' has an invalid phase_code of "'||


reqinfo.phase_code||'"');

END IF;

<<diagnose>>

DBMS_OUTPUT.PUT_LINE(sep);

EXCEPTION

WHEN REQ_NOTFOUND THEN

DBMS_OUTPUT.PUT_LINE('Request '||p_req_id||' not found.');

WHEN OTHERS THEN

DBMS_OUTPUT.PUT_LINE('Error number ' || sqlcode || ' has occurred.');

DBMS_OUTPUT.PUT_LINE('Cause: ' || sqlerrm);


END analyze_request;

BEGIN

analyze_request(req_id);

END;

prompt

exit

Script Provides Daily Concurrent Request Counts Completed by Hour


REM
####################################################################
#####
REM ## Purpose: Script provides daily Concurrent Requests counts
completed by hour
REM ## Filename: daily_request_count_completed_hourly.sql
REM ## Certified for Application releases 11.5 through 12.x
REM ## Document: <nnnnnn.1>
REM ## Usage: sqlplus apps/<appspwd>
@daily_request_count_completed_hourly.sql
REM ## Output: ConcurrentRequestCount.lst
REM ##
REM
####################################################################
#####
set pages 10000
set lines 180
set verify off
column program_name format a50
column request_id format 99999999 heading 'REQUEST'
column st_dt format date
 
spool ConcurrentRequestCount.lst
select
    p.user_concurrent_program_name Program_name,
    to_char(r.actual_start_date,'DD-MON-YYYY HH24') Date_of_exec,
    count(r.request_id)     Executions,
    avg((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Avg_run_time,
    min((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Min_run_time,
    max((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Max_run_time
from
    apps.fnd_concurrent_requests r,
    apps.fnd_concurrent_processes c,
    apps.fnd_concurrent_queues q,
    apps.fnd_concurrent_programs_vl p
where
    p.concurrent_program_id = r.concurrent_program_id
    and p.application_id = r.program_application_id
    and c.concurrent_process_id = r.controlling_manager
    and q.concurrent_queue_id = c.concurrent_queue_id
    and p.application_id = '&appl_id'
    and r.status_code = 'C'
    and r.phase_code = 'C'
   and to_char(r.actual_start_date,'DD-MON-YYYY') between
'&begin_date' and '&end_date'
group by
p.user_concurrent_program_name,to_char(r.actual_start_date,'DD-MON-
YYYY HH24')
order by to_char(r.actual_start_date,'DD-MON-YYYY HH24') asc
/
spool off

Script Provides the Concurrent Requests Counts, Time, and Range


REM
####################################################################
#####
REM ## Purpose: Script provides the Concurrent Requests counts,
Time, and Range
REM ## Filename: Node_Request_Count_TimeRange.sql
REM ## Certified for Application releases 11.5 through 12.x
REM ## Document: <nnnnnn.1>
REM ## Usage: sqlplus apps/<appspwd>
@Node_Request_Count_TimeRange.sql
REM ## Output: Node_Request_Count_TimeRange.lst
REM ##
REM
####################################################################
#####
set pages 10000
set lines 180
set verify off
break on Date_of_exec
compute sum of Executions on Date_of_exec

column program_name format a50


column request_id format 99999999 heading 'REQUEST'
column Manager_name format a10
column Node_Name   format a11
spool NodeConcurrentRequestCountTimeRange.lst
select
    p.user_concurrent_program_name Program_name,
    q.concurrent_queue_name Manager_name,
    q.NODE_NAME             Node_Name,
    to_char(r.actual_start_date,'DD-MON-YYYY HH24') Date_of_exec,
    count(r.request_id)     Executions,
    avg((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Avg_run_time,
    min((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Min_run_time,
    max((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Max_run_time
from
    apps.fnd_concurrent_requests r,
    apps.fnd_concurrent_processes c,
    apps.fnd_concurrent_queues q,
    apps.fnd_concurrent_programs_vl p
where
    p.concurrent_program_id = r.concurrent_program_id
    and p.application_id = r.program_application_id
    and c.concurrent_process_id = r.controlling_manager
    and q.concurrent_queue_id = c.concurrent_queue_id
    and p.application_id = '&appl_id'
    and actual_start_date between to_date('&&begin_date','DD-MON-
YYYY HH24') and to_date('&&end_date','DD-MON-YYYY HH24')
   and r.status_code = 'C'
    and r.phase_code in ('C')
group by
p.user_concurrent_program_name,to_char(r.actual_start_date,'DD-MON-
YYYY HH24'),q.concurrent_queue_name,q.node_name
order by to_char(r.actual_start_date,'DD-MON-YYYY HH24') asc
/
spool off

Script Provides the Count by Name and Date


REM
####################################################################
#####
REM ## Purpose: Script provides the count by Name and Date
REM ## Filename: program_queue_count_byname_date.sql
REM ## Certified for Application releases 11.5 through 12.x
REM ## Document: <nnnnnn.1>
REM ## Usage: sqlplus apps/<appspwd>
@program_queue_count_byname_date.sql
REM ## Output: program_queue_count_byname_date.lst
REM ##
REM
####################################################################
#####
set pages 10000
set lines 180
set verify off
spool program_queue_count_byname_date.lst
select  n.user_concurrent_program_name Program_name,
        q.concurrent_queue_name,
        count(*) cnt,
        sum(r.actual_completion_date - r.actual_start_date) * 24
elapsed,
        avg(r.actual_completion_date - r.actual_start_date) * 24
average,
        stddev(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 wstddev,
        sum(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 waited,
        avg(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 avewait
from   
        apps.fnd_concurrent_requests r,
        apps.fnd_concurrent_queues q,
        apps.fnd_concurrent_processes p,
        apps.fnd_concurrent_programs_vl n
where   
            n.concurrent_program_id = r.concurrent_program_id
        and n.application_id = r.program_application_id
        and r.concurrent_program_id = p.concurrent_program_id
        and r.phase_code='C'
        and r.status_code in ('C','G')  
        and r.controlling_manager=p.concurrent_process_id
        and q.concurrent_queue_id=p.concurrent_queue_id
        and n.user_concurrent_program_name like '&prog_name'
        and to_char(r.actual_completion_date,'DD-MON-YYYY') between
'&begin_date' and '&end_date'
group by  q.concurrent_queue_name,n.user_concurrent_program_name
order by 4;

spool off
Script Provides the Count of Requests Completed and Canceled
REM
####################################################################
#####
REM ## Purpose: Script provides the count of requests completed and
canceled.
REM ## Filename: request_count_completedcancelled.sql
REM ## Certified for Application releases 11.5 through 12.x
REM ## Document: <nnnnnn.1>
REM ## Usage: sqlplus apps/<appspwd>
@request_count_completedcancelled.sql
REM ## Output: request_count_completedcancelled.lst
REM ##
REM
####################################################################
#####
set pages 10000
set lines 180
set verify off
break on report
compute sum of Executions on report
set pages 10000
set lines 180
set verify off
column program_name format a50
column request_id format 99999999 heading 'REQUEST'
column st_dt format date
 
spool completedcancelledrequestcount.lst
select
    p.user_concurrent_program_name Program_name,
    to_date(r.actual_start_date,'DD-MON-YYYY') Date_of_exec,
    count(r.request_id)     Executions,
    avg((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Avg_run_time,
    min((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Min_run_time,
    max((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Max_run_time
from
    apps.fnd_concurrent_requests r,
    apps.fnd_concurrent_processes c,
    apps.fnd_concurrent_queues q,
    apps.fnd_concurrent_programs_vl p
where
    p.concurrent_program_id = r.concurrent_program_id
    and p.application_id = r.program_application_id
    and c.concurrent_process_id = r.controlling_manager
    and q.concurrent_queue_id = c.concurrent_queue_id
    and p.application_id = '&appl_id'
    and r.status_code = 'D'
    and r.phase_code = 'C'
     and to_char(r.actual_start_date,'DD-MON-YYYY')='&begin_date'
group by
p.user_concurrent_program_name,to_date(r.actual_start_date,'DD-MON-
YYYY')
order by to_date(r.actual_start_date,'DD-MON-YYYY') asc
/
spool off

Script Provides the Count of Requests Completed with Error


REM
####################################################################
#####
REM ## Purpose: Script provides the count of requests completed with
error.
REM ## Filename: request_count_completederror.sql
REM ## Certified for Application releases 11.5 through 12.x
REM ## Document: <nnnnnn.1>
REM ## Usage: sqlplus apps/<appspwd>
@request_count_completederror.sql
REM ## Output: completederrorRequestCount.lst
REM ##
REM
####################################################################
#####
set pages 10000
set lines 180
set verify off
break on report
compute sum of Executions on report
set pages 10000
set lines 180
set verify off
column program_name format a50
column request_id format 99999999 heading 'REQUEST'
column st_dt format date
 
spool completederrorRequestCount.lst
select
    p.user_concurrent_program_name Program_name,
    to_date(r.actual_start_date,'DD-MON-YYYY') Date_of_exec,
    count(r.request_id)     Executions,
    avg((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Avg_run_time,
    min((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Min_run_time,
    max((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Max_run_time
from
    apps.fnd_concurrent_requests r,
    apps.fnd_concurrent_processes c,
    apps.fnd_concurrent_queues q,
    apps.fnd_concurrent_programs_vl p
where
    p.concurrent_program_id = r.concurrent_program_id
    and p.application_id = r.program_application_id
    and c.concurrent_process_id = r.controlling_manager
    and q.concurrent_queue_id = c.concurrent_queue_id
    and p.application_id = '&appl_id'
    and r.status_code = 'E'
    and r.phase_code = 'C'
     and to_char(r.actual_start_date,'DD-MON-YYYY')='&begin_date'
group by
p.user_concurrent_program_name,to_date(r.actual_start_date,'DD-MON-
YYYY')
order by to_date(r.actual_start_date,'DD-MON-YYYY') asc
/
spool off

Script Provides the Count of Requests Pending and Scheduled


break on report
compute sum of Executions on report
set pages 10000
set lines 180
set verify off
column program_name format a50
column request_id format 99999999 heading 'REQUEST'
column st_dt format date
 
spool pendingscheduledRequestCount.lst
select
    p.user_concurrent_program_name Program_name
    to_date(r.actual_start_date,'DD-MON-YYYY') Date_of_exec
    count(r.request_id)     Executions
    avg((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Avg_run_time,
    min((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Min_run_time,
    max((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Max_run_time
from
    apps.fnd_concurrent_requests r,
    apps.fnd_concurrent_processes c,
    apps.fnd_concurrent_queues q,
    apps.fnd_concurrent_programs_vl p
where
      p.application_id = r.program_application_id
and
      r.phase_code = 'P'
/
spool off
Script Provides the Count of Requests Terminated by Date
REM
####################################################################
#####
REM ## Purpose: Script provides the count of requests terminated by
date.
REM ## Filename: running_terminated_requests_bydate.sql
REM ## Certified for Application releases 11.5 through 12.x
REM ## Document: <nnnnnn.1>
REM ## Usage: sqlplus apps/<appspwd>
@running_terminated_requests_bydate.sql
REM ## Output: runningterminatedRequestCount.lst
REM ##
REM
####################################################################
#####
break on report
compute sum of Executions on report
set pages 10000
set lines 180
set verify off
column program_name format a50
column request_id format 99999999 heading 'REQUEST'
column st_dt format date
 
spool runningterminatedRequestCount.lst
select
    p.user_concurrent_program_name Program_name,
    to_date(r.actual_start_date,'DD-MON-YYYY') Date_of_exec,
    count(r.request_id)     Executions,
    avg((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Avg_run_time,
    min((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Min_run_time,
    max((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) Max_run_time
from
    apps.fnd_concurrent_requests r,
    apps.fnd_concurrent_processes c,
    apps.fnd_concurrent_queues q,
    apps.fnd_concurrent_programs_vl p
where
    p.concurrent_program_id = r.concurrent_program_id
    and p.application_id = r.program_application_id
    and c.concurrent_process_id = r.controlling_manager
    and q.concurrent_queue_id = c.concurrent_queue_id
    and p.application_id = '&appl_id'
    and r.status_code = 'T'
    and r.phase_code = 'R'
     and to_char(r.actual_start_date,'DD-MON-YYYY')='&begin_date'
group by
p.user_concurrent_program_name,to_date(r.actual_start_date,'DD-MON-
YYYY')
order by to_date(r.actual_start_date,'DD-MON-YYYY') asc
/
spool off

Script Provides the Count of Requests by Date


REM
####################################################################
#####
REM ## Purpose: Script provides the count of requests by date.
REM ## Filename: startdate_count_bydate.sql
REM ## Certified for Application releases 11.5 through 12.x
REM ## Document: <nnnnnn.1>
REM ## Usage: sqlplus apps/<appspwd> @startdate_count_bydate.sql
REM ## Output: startdate_count_bydate.lst
REM ##
REM
####################################################################
#####
set pages 10000
set lines 180
set verify off
spool startdate_count_bydate.lst
select to_char(actual_start_date,'DD-MON-YYYY
HH24'),count(request_id)
from apps.fnd_concurrent_requests
where actual_start_date between to_date('&&begin_date','DD-MON-YYYY
HH24')
and to_date('&&end_date','DD-MON-YYYY HH24') and status_code = 'C'
and phase_code in ('C')
group by  to_char(actual_start_date,'DD-MON-YYYY HH24')
/
spool off

Quick Sql Statement to check Average Monthly Requests


set head off
select avg(count(1)) from apps.fnd_concurrent_requests
where trunc(actual_start_date) >trunc(sysdate -30) group by
trunc(actual_start_date);

Script Identifying Concurrent Managers Used and Compare


REM cmhist.sql
REM Use this report to tell which concurrent managers are actually
being
REM used in an environment and compare to the concurrent managers
that
REM are allocated processes at startup.  This report only reviews
completed
REM normal or completed warning concurrent requests.
REM
REM Deactivate any managers that are not used.
REM
REM It makes no sense to run this request with a date range greater
than
REM what is contained in the fnd_concurrent_requests table. 
Therefore,
REM base dates on the purge frequency.
REM
set verify off
set feedback off
set pagesize 59
set linesize 180
set newpage 02
set recsep off
break on report
compute sum of cnt on report
compute sum of elapsed on report
compute sum of waited on report
rem  column today new_value _date noprint;
rem  select to_char(SYSDATE,'DD-MON-YY') today from dual;
rem  ttitle "Concurrent Manager Request Summary  by Manager from:
&&begin_date to &&end_date" skip 2;
column waited format 99999999.99 heading 'WAITED|HOURS';
column wstddev format 99999999.99 heading 'WAITED|STDDEV';
column avewait format 9999.99 heading 'AVG.|WAIT';
column concurrent_queue_name format a30 wrap;
column cnt format 999,999 heading 'COUNT';
column elapsed format 99999.99 heading 'TOTAL|HOURS';
column average format 9999.99 heading 'AVG.|HOURS';
set feedback off
select  q.concurrent_queue_name,
        count(*) cnt,
        sum(r.actual_completion_date - r.actual_start_date) * 24
elapsed,
        avg(r.actual_completion_date - r.actual_start_date) * 24
average,
        stddev(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 wstddev,
        sum(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 waited,
        avg(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 avewait
from    apps.fnd_concurrent_programs p,
        apps.fnd_concurrent_requests r,
        apps.fnd_concurrent_queues q,
        apps.fnd_concurrent_processes p
where   r.program_application_id = p.application_id  
        and r.concurrent_program_id = p.concurrent_program_id  
        and r.phase_code='C' -- completed
        and r.status_code in ('C','G')  -- completed normal or with
warning
        and r.controlling_manager=p.concurrent_process_id
        and q.concurrent_queue_id=p.concurrent_queue_id
        and r.concurrent_program_id=p.concurrent_program_id
        and actual_start_date between to_date('&&begin_date') and
to_date('&&end_date')
group by  q.concurrent_queue_name
order by 4;
set feedback on;
clear breaks

Elapsed Time History for All Requests Run for a Given Time Period
REM
REM
REM Elapsed time history for all requests run for a given time
period.
REM
REM To help assign requests that always run fast to one queue, and
slow requests to a slow queue
REM
REM
rem set timing off
rem set heading off
set verify off
rem set show off
rem set echo off
set feedback off
set pagesize 500
set linesize 250
column elapsed format 999.99 heading 'TOTAL|HOURS';
column average format 99.99 heading 'AVG|HOURS';
column max     format 99.99 heading 'MAX|HOURS';
column min     format 99.99 heading 'MIN|HOURS';
column waited  format 99999.99 heading '#WAITED|HOURS';
column avewait format 9999.99 heading 'AVG|WAIT';
column program format a20 heading 'PROGRAM';
column description format a55;
column cnt format 999,999 heading '#TIMES|RUN';
column app format a6 heading 'APP';
break on report
compute sum of cnt on report
compute sum of elapsed on report
compute sum of waited on report
column stddev format 999.99 heading 'RUN|STDDEV';
column wstddev format 999.99 heading 'WAIT|STDDEV'
column type format a15 heading 'TYPE'
column priority format 999 heading 'PRI'
column concurrent_queue_name format a14 heading 'Concurrent Mgr'
trunc
select
   f.application_short_name app,
   substr(p.user_concurrent_program_name,1,55) description,
   substr(p.concurrent_program_name,1,20) program,
   r.priority,
   count(*) cnt,
   sum(actual_completion_date - actual_start_date) * 24 elapsed,
   avg(actual_completion_date - actual_start_date) * 24 average,
   max(actual_completion_date - actual_start_date) * 24 max,
   min(actual_completion_date - actual_start_date) * 24 min,
   stddev(actual_completion_date - actual_start_date) * 24 stddev,
   stddev(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 wstddev,
   sum(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 waited,
   avg(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 avewait,
   c.request_class_name type
from apps.fnd_concurrent_request_class c,
     apps.fnd_application f,
     apps.fnd_concurrent_programs_vl p,
     apps.fnd_concurrent_requests r
where r.program_application_id = p.application_id
   and r.concurrent_program_id = p.concurrent_program_id
   and r.status_code in ('C','G') -- maybe 'E' also
   and r.phase_code = 'C'
   and actual_completion_date between to_date('&&begindate') and
to_date('$$enddate')
   and p.application_id = f.application_id
   and r.program_application_id = f.application_id
   and r.request_class_application_id = c.application_id(+)
   and r.concurrent_request_class_id = c.request_class_id(+)
group by
   c.request_class_name,
   f.application_short_name,
   p.concurrent_program_name,
   p.user_concurrent_program_name,
   r.priority
/
clear breaks

Select for Providing Frequency/Volume Analysis Program Name, Queue Name, and Count by
Program Name and Date Range
REM     select statement to pull Program Name, Queue Name, and Count
by program name and date range for frequency/volume analysis
REM

select  n.user_concurrent_program_name Program_name,


        q.concurrent_queue_name,
        count(*) cnt,
        sum(r.actual_completion_date - r.actual_start_date) * 24
elapsed,
        avg(r.actual_completion_date - r.actual_start_date) * 24
average,
        stddev(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 wstddev,
        sum(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 waited,
        avg(actual_start_date -
greatest(r.requested_start_date,r.request_date)) * 24 avewait
from   
        apps.fnd_concurrent_requests r,
        apps.fnd_concurrent_queues q,
        apps.fnd_concurrent_processes p,
        apps.fnd_concurrent_programs_vl n
where   
            n.concurrent_program_id = r.concurrent_program_id
        and n.application_id = r.program_application_id
        and r.concurrent_program_id = p.concurrent_program_id
        and r.phase_code='C' -- completed
        and r.status_code in ('C','G')  -- completed normal or with
warning
        and r.controlling_manager=p.concurrent_process_id
        and q.concurrent_queue_id=p.concurrent_queue_id
        and n.user_concurrent_program_name like '&1'
        and to_char(r.actual_completion_date,'DD-MON-YYYY') between
'&2' and '&3'
group by  q.concurrent_queue_name,n.user_concurrent_program_name
order by 4;
set feedback on;
clear breaks

Request Volume Per Day Select which can be Modified with Additions to the Where Clause
REM Request Volume Per Day Select which can be modified with
additions to the where clause
REM

set pages 1000


set lines 180
select trunc(actual_start_date),count(*)
from apps.fnd_concurrent_requests
where trunc(Actual_start_date) >trunc(sysdate -61)
group by trunc(actual_start_date);

Select Providing the Volume of Concurrent Requests Per Node


REM Concurrent Requests per node select statement
REM

set head off


Break on trunc(actual_start_date)
compute SUM of count(1) on trunc(actual_start_date);
select count(1),trunc(actual_start_date) ,logfile_node_name from
apps.fnd_concurrent_requests
where trunc(actual_start_date) >trunc(sysdate -30) group by
trunc(actual_start_date),logfile_node_name order by
trunc(actual_start_date),count(1);
Select reflecting All Requests with Run Times > 30 Minutes During Peak Load in the Past Month by
Application_Id
rem Script: Requests_Over_30Min_by_App_Id.sql
rem All requests with run times > 30 minutes during peak load in the
past month by Application_Id.

undefine start_date
undefine end_date

set pages 10000


set verify off
column request_id format 99999999 heading 'REQUEST'
column user_name format a17
column phase format a10
column status format a12
column start_date format a5
column completion_date format a5 heading 'END'
column avg_run_time format 9999 heading 'AVG TIME'
column min_run_time format 9999 heading 'MIN TIME'
column max_run_time format 9999 heading 'MAX TIME'
column program_name format a50

select
    p.user_concurrent_program_name program_name,
    count(r.request_id),
    avg((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) avg_run_time,
    min((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) min_run_time,
    max((nvl(r.actual_completion_date,sysdate) -
r.actual_start_date) * 24 * 60) max_run_time
from
    apps.fnd_concurrent_requests r,
    apps.fnd_concurrent_processes c,
    apps.fnd_concurrent_queues q,
    apps.fnd_concurrent_programs_vl p
where
    p.concurrent_program_id = r.concurrent_program_id
    and p.application_id = r.program_application_id
    and c.concurrent_process_id = r.controlling_manager
    and q.concurrent_queue_id = c.concurrent_queue_id
    and p.application_id >= &&ApplicationId
    and r.actual_start_date >= sysdate-31
    and r.status_code = 'C'
    and r.phase_code in ('C')
    and (nvl(r.actual_completion_date,r.actual_start_date) -
r.actual_start_date) * 24 * 60 > 30
    and p.user_concurrent_program_name not like 'Gather%Statistics%'
    and (
      (nvl(r.actual_completion_date,r.actual_start_date) -
r.actual_start_date) * 24 > 16
      or
      (r.actual_start_date-trunc(r.actual_start_date)) * 24 between
9 and 17
      or
      (r.actual_completion_date-trunc(r.actual_completion_date)) *
24 between 9 and 17
    )
group by p.user_concurrent_program_name
/

Select Providing Request ID's for Requests that are Currently Running
alter session set nls_date_format='dd-mon-yy hh24:mi:ss';
 SEt linesize 200
 set pagesize 2000
 col "Secondswait" format 9999 wrap heading 'SWait' print
 col "WaitEvent" format a12 wrap heading 'Waiting|On Event' print
 col "Session Wait" format a12 wrap heading 'file#|block#|
id(Reason)' print
 Column Manager   Format A12 trunc heading 'Manager|Queue' print
 col "ServerClient" format a7 heading 'Server|Client' print
 col "SidSerialSQLHash"  format a10 heading 'Sid|Serial#|SQLHash'
print
 col "DBPhaseStatusCODEUser" format a10 heading 'UserName|CP
PhSCode|Db Status' print
 col Request_id  Format a10 heading 'RequestID|PriorityID|ParentID'
print wrap
 col "RequestStartDate" Format a10 heading 'ReqStart|Minutes' print
 column concurrent_program_name format a25 heading 'CCM Short|Name'
noprint
 column user_concurrent_program_name format a20 wrap heading
'Concurrent|Program Name' print
 column ARGUMENT_TEXT format a15 heading 'CCM Arguments' print
 column "SQLHASH" format 9999999999 heading 'SQL|HASH' print
 column CONCURRENT_QUEUE_ID format 99999 heading 'CCM |Queue ID'
print
 column QUEUE_DESCRIPTION format a20 heading 'CCM |Queue Name'
noprint
 
 select
 w.seconds_in_wait "Secondswait",
 w.event "waitEvent",
 w.p1||chr(10)||w.p2||chr(10)||w.p3 "Session Wait",
 p.spid||chr(10)||s.process "ServerClient",
 s.sid||chr(10)||s.serial#||chr(10)||s.sql_hash_value
"SidSerialSQLHash",
 u.user_name||chr(10)||PHASE_CODE||' '||STATUS_CODE||chr(10)||
s.status "DBPhaseStatusCODEUser",
 Request_id||chr(10)||priority_request_id||chr(10)||
Parent_request_id "Request_id",
 concurrent_program_name,
 user_concurrent_program_name,
 requested_start_Date||chr(10)||round((sysdate-
requested_start_date)*1440, 2)||'M' "RequestStartDate",
 ARGUMENT_TEXT,
 CONCURRENT_QUEUE_ID,
 QUEUE_DESCRIPTION
FROM
 FND_CONCURRENT_WORKER_REQUESTS,
 fnd_user u,
 v$session s,
 v$process p,
 v$session_wait w
WHERE
--  nvl(request_type, 'X') != 'S' and
--  (request_id = &&request_id)
(Phase_Code='R')
and hold_flag != 'Y'
and Requested_Start_Date <= SYSDATE
AND ('' IS NULL OR ('' = 'B' AND PHASE_CODE = 'R' AND STATUS_CODE IN
('I', 'Q')))
and '1' in (0,1,4)
and requested_by=u.user_id
and s.paddr=p.addr
and s.sid=w.sid
and oracle_process_id = p.spid
and oracle_session_id = s.audsid
order by requested_start_date
;
--and request_id=&&request_id;

Session Information Available from an Oracle Unix Process ID - SPID


REM  FILENAME
spid_session_k.sql                                           
REM 
DESCRIPTION                                                         

REM  Session information availabe from an Oracle unix process id -


SPID    

set verify off


set echo off
set head off
set pages 1000
PROMPT Enter SPID :
ACCEPT 1
spool spid&1
 
 
PROMPT  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
PROMPT  Details of SPID &1
PROMPT  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
   select 'SID............ : ' ||
a.sid                                         || chr(10) ||
          'SERIAL#........ : ' ||
a.serial#                                     || chr(10) ||
          'USERNAME....... : ' ||
a.username                                    || chr(10) ||
          'COMMAND........ : ' ||
a.command                                     || chr(10) ||
          'STATUS......... : ' ||
a.status                                      || chr(10) ||
          'Machine........ : ' ||
a.machine                                     || chr(10) ||
          'Terminal....... : ' ||
a.terminal                                    || chr(10) ||
          'Program........ : ' ||
a.program                                     || chr(10) ||
          'Module........ : '  ||
a.module                                      || chr(10) ||
          'SQL Hash Value. : ' ||
a.sql_hash_value                              || chr(10) ||
          'Logon Time..... : ' || to_char(a.logon_time,'DD-Mon-YYYY
HH:MI:SS')  || chr(10) ||
          'Last Call Et... : ' ||
a.last_call_et                                || chr(10) ||
          'Process ID..... : ' ||
a.process                                     || chr(10) ||
          'SPID........... : ' || b.spid
   from   v$session a, v$process b
   where  a.paddr=b.addr     and b.spid='&1';
   PROMPT
   select 'Session Waiting for event...: ' || event
   from    v$session_wait
   where   sid in(select sid from v$session a, v$process b where 
a.paddr=b.addr     and b.spid='&1');
   PROMPT  SQL STATEMENT :
   PROMPT  ===============
   select sql_text
   from   v$sqltext
   where  hash_value in(select sql_hash_value from v$session a,
v$process b where  a.paddr=b.addr  and b.spid='&1')
   order  by piece;
 
 spool off

Tracing Concurrent Processes

For example the following unix process id was consuming high CPU 25807.
 

1. Obtain the Oracle process identifier or the Operating System process


   identifier (SPID) from v$process:
       SQL> sqlplus /nolog
       connect / as sysdba
       select pid, spid, username from v$process;
 

               PID    SPID   USERNAME


               ----   -----  --------
               8      25807  oracle

 
 
2. Attach to the process using ORADEBUG.

 
I.   Using the Oracle process identifier:
 

       SQL> oradebug setorapid 8

 
       Unix process pid: 25807, image: oracle
 

II.   Using the Operating System process identifier:


SQL> oradebug setospid 25807

 
       Oracle pid: 8, Unix process pid: 25807, image: oracle
 
       
3. Turn on SQL Trace for the session and the trace file name as follows:
  

SQL> oradebug event 10046 trace name context forever, level 12

 
       Statement processed.
 
   

SQL> oradebug tracefile_name;

    
4. Turn off the SQL trace for the session.  
 

       SQL> oradebug event 10046 trace name context off


 
 
 
5. Format trace file using TKPROF.
tkprof CR2000000.trc CR0000000.out explain=apps/simple4u
sort='(prsela,exeela,fchela)' print=10

 
      This listed the sql which was consuming CPU.

Query to check the setting of the ICM in the Concurrent Manager environment

select 'PCP' "name", value

from apps.fnd_env_context

where variable_name = 'APPLDCP' and

concurrent_process_id = (select max(concurrent_process_id)

from apps.fnd_concurrent_processes where concurrent_queue_id =


1)

UNION ALL

select 'RAC' "name", decode(count(*), 0, 'N', 1, 'N', 'Y')


"value" from V$thread

UNION ALL

select 'GSM' "name", NVL(v.profile_option_value, 'N') "value"

from apps.fnd_profile_options p,
apps.fnd_profile_option_values v

where p.profile_option_name = 'CONC_GSM_ENABLED'


and p.profile_option_id = v.profile_option_id

UNION ALL

select name, value from apps.fnd_concurrent_queue_params

where queue_application_id = 0 and concurrent_queue_id = 1;

Query to check the details for all the enabled Concurrent Manager

select fcq.application_id "Application Id",

fcq.concurrent_queue_name, fcq.user_concurrent_queue_name
"Service",

fa.application_short_name, fcq.target_node "Node",

fcq.max_processes "Target",

fcq.node_name "Primary", fcq.node_name2


"Secondary",fcq.cache_size "Cache Size",

fcp.concurrent_processor_name "Program Library",

sleep_seconds

from apps.fnd_concurrent_queues_vl fcq, apps.fnd_application


fa, apps.fnd_concurrent_processors fcp

where fcq.application_id = fa.application_id

and fcq.processor_application_id = fcp.application_id


and fcq.concurrent_processor_id = fcp.concurrent_processor_id
and fcq.enabled_flag='Y';

How to check the request type and Programs for the


concurrent Managers

column action format a10

column manager format a20

column object format a20

column type format a10

set pages 0

set lines 400

select q.application_id, q.concurrent_queue_name,

q.user_concurrent_queue_name "Manager", l1.meaning "Action",

l2.meaning "Type", p.user_concurrent_program_name "Object"

from apps.fnd_concurrent_queue_content c,
apps.fnd_concurrent_queues_vl q,

apps.fnd_concurrent_programs_vl p, apps.fnd_lookups l1,


apps.fnd_lookups l2

where q.concurrent_queue_id = c.concurrent_queue_id


and q.application_id = c.queue_application_id

and c.type_code = 'P'

and c.type_id = p.concurrent_program_id

and c.type_application_id = p.application_id

and l1.lookup_code = c.include_flag

and l1.lookup_type = 'INCLUDE_EXCLUDE'

and l2.lookup_code = 'P' and l2.lookup_type =


'CP_SPECIAL_RULES'

UNION ALL

select q.application_id, q.concurrent_queue_name,

q.user_concurrent_queue_name "Manager", l1.meaning "Action",

'Application' "Type", a.application_name "Object"

from apps.fnd_concurrent_queue_content c,
apps.fnd_concurrent_queues_vl q,

apps.fnd_application_vl a, apps.fnd_lookups l1

where q.concurrent_queue_id = c.concurrent_queue_id

and q.application_id = c.queue_application_id

and c.type_code = 'P'


and c.type_id is null

and c.type_application_id = a.application_id

and l1.lookup_code = c.include_flag

and l1.lookup_type = 'INCLUDE_EXCLUDE'

UNION ALL

select q.application_id, q.concurrent_queue_name,

q.user_concurrent_queue_name "Manager", l1.meaning "Action",

l2.meaning "Type", x.complex_rule_name "Object"

from apps.fnd_concurrent_queue_content c,
apps.fnd_concurrent_queues_vl q,

apps.fnd_concurrent_complex_rules x,

apps.fnd_lookups l1, apps.fnd_lookups l2

where q.concurrent_queue_id = c.concurrent_queue_id

and q.application_id = c.queue_application_id

and c.type_code = 'C'

and c.type_id = x.complex_rule_id

and c.type_application_id = x.application_id


and l1.lookup_code = c.include_flag and l1.lookup_type =
'INCLUDE_EXCLUDE'

and l2.lookup_code = 'C'

and l2.lookup_type = 'CP_SPECIAL_RULES'

UNION ALL

select q.application_id, q.concurrent_queue_name,

q.user_concurrent_queue_name "Manager", l1.meaning "Action",


l2.meaning "Type", r.request_class_name "Object"

from apps.fnd_concurrent_queue_content c,
apps.fnd_concurrent_queues_vl q,
apps.fnd_concurrent_request_class r,

apps.fnd_lookups l1, apps.fnd_lookups l2

where q.concurrent_queue_id = c.concurrent_queue_id

and q.application_id = c.queue_application_id

and c.type_code = 'R'

and c.type_id = r.request_class_id

and c.type_application_id = r.application_id

and l1.lookup_code = c.include_flag and l1.lookup_type =


'INCLUDE_EXCLUDE'

and l2.lookup_code = 'R'


and l2.lookup_type = 'CP_SPECIAL_RULES'

UNION ALL

select q.application_id,
q.concurrent_queue_name,q.user_concurrent_queue_name
"Manager", l1.meaning "Action", l2.meaning "Type",
o.oracle_username "Object"

from apps.fnd_concurrent_queue_content c,
apps.fnd_concurrent_queues_vl q, apps.fnd_oracle_userid o,

apps.fnd_lookups l1, apps.fnd_lookups l2

where q.concurrent_queue_id = c.concurrent_queue_id

and q.application_id = c.queue_application_id

and c.type_code = 'O'

and c.type_id = o.oracle_id

and l1.lookup_code = c.include_flag and l1.lookup_type =


'INCLUDE_EXCLUDE'

and l2.lookup_code = 'O'

and l2.lookup_type = 'CP_SPECIAL_RULES'

UNION ALL

select q.application_id,
q.concurrent_queue_name,q.user_concurrent_queue_name
"Manager", l1.meaning "Action", l2.meaning "Type", u.user_name
"Object"
from apps.fnd_concurrent_queue_content c,
apps.fnd_concurrent_queues_vl q, apps.FND_OAM_FNDUSER_VL u,

apps.fnd_lookups l1, apps.fnd_lookups l2

where q.concurrent_queue_id = c.concurrent_queue_id

and q.application_id = c.queue_application_id

and c.type_code = 'U'

and c.type_id = u.user_id

and l1.lookup_code = c.include_flag and l1.lookup_type =


'INCLUDE_EXCLUDE'

and l2.lookup_code = 'U'

and l2.lookup_type = 'CP_SPECIAL_RULES'

UNION ALL

select q.application_id,
q.concurrent_queue_name,q.user_concurrent_queue_name
"Manager", l1.meaning "Action", l2.meaning "Type",
to_char(c.type_id) "Object"

from apps.fnd_concurrent_queue_content c,
apps.fnd_concurrent_queues_vl q,

apps.fnd_lookups l1, apps.fnd_lookups l2

where q.concurrent_queue_id = c.concurrent_queue_id


and q.application_id = c.queue_application_id

and c.type_code not in ('C','P','O','R', 'U')

and l1.lookup_code = c.include_flag and l1.lookup_type =


'INCLUDE_EXCLUDE'

and l2.lookup_code = c.type_code and l2.lookup_type =


'CP_SPECIAL_RULES';

How to check/find  the shift/max/min for All the concurrent


Manager

select fcq.application_id,

fcq.concurrent_queue_name,

fcq.user_concurrent_queue_name,

ftp.application_id,

ftp.concurrent_time_period_name,

fa.application_short_name,

ftp.description,

fcqs.min_processes,

fcqs.max_processes,

fcqs.sleep_seconds,
fcqs.service_parameters

from apps.fnd_concurrent_queues_vl fcq,

apps.fnd_concurrent_queue_size fcqs,

apps.fnd_concurrent_time_periods ftp,

apps.fnd_application fa

where fcq.application_id = fcqs.queue_application_id

and fcq.concurrent_queue_id = fcqs.concurrent_queue_id

and fcqs.period_application_id = ftp.application_id

and fcqs.concurrent_time_period_id =
ftp.concurrent_time_period_id

and ftp.application_id = fa.application_id;

Query to check all the values of Concurrent Manager


related Site level profile option and there lookup

SELECT fpo.profile_option_name,

fpo.profile_option_id,

fpov.profile_option_value,

fpov.level_id,
fa.application_short_name,

fpo.user_profile_option_name,

fpo.sql_validation,

fpo.description

FROM apps.FND_PROFILE_OPTIONS_VL fpo,

apps.FND_PROFILE_OPTION_VALUES fpov,

apps.fnd_application fa

where fpo.application_id = 0

and fpo.site_enabled_flag = 'Y'

and (fpo.profile_option_name like 'CONC_%'

or fpo.profile_option_name like 'FS_%'

or fpo.profile_option_name like 'PRINTER%'

or fpo.profile_option_name in ('EDITOR_CHAR',
'FNDCPVWR_FONT_SIZE', 'MAX_PAGE_LENGTH', 'APPLWRK'))

and fpo.profile_option_id = fpov.profile_option_id

and fpo.application_id = fpov.application_id

and fpo.application_id = fa.application_id


and fpov.level_id = 10001;

Query to check concurrent manager status from backend

select q.user_concurrent_queue_name service_name,

a.application_name srvc_app_name,

a.application_short_name srvc_app_short_name,

q.concurrent_queue_name service_short_name,

decode( ( select count(*)

from apps.fnd_concurrent_processes fcp1

where fcp1.concurrent_queue_id = q.concurrent_queue_id

and fcp1.queue_application_id = q.application_id

and ( fcp1.process_status_code in ('C','M')

or ( fcp1.process_status_code in ('A', 'D', 'T')

and exists (select 1

from gv$session

where fcp1.session_id = audsid )

)
)

)/*actual_processes */, 0, decode(q.max_processes,


0,'NOT_STARTED', 'DOWN'),

q.max_processes, 'UP', 'WARNING' ) service_status,

q.max_processes target_processes,

(select count(*)

from apps.fnd_concurrent_processes fcp2

where fcp2.concurrent_queue_id = q.concurrent_queue_id

and fcp2.queue_application_id = q.application_id

and ( fcp2.process_status_code in ('C','M') /* Connecting or


Migrating */

or ( fcp2.process_status_code in ('A', 'D', 'T')

and exists (select 1 from gv$session

where fcp2.session_id = audsid)

) actual_processes,

'' message, s.service_handle srvc_handle


from apps.fnd_concurrent_queues_vl q, apps.fnd_application_vl
a,

apps.fnd_cp_services s

where q.application_id = a.application_id

and s.service_id = q.manager_type

UNION

/* Need to cover the case where a manager has no rows in


FND_CONCURRENT_PROCESSES. Outer joins won't cut it. */

select q.user_concurrent_queue_name service_name,

a.application_name srvc_app_name,

a.application_short_name srvc_app_short_name,

q.concurrent_queue_name srvc_short_name,

decode( q.max_processes, 0, 'NOT_STARTED', 'DOWN')


service_status,

q.max_processes target_processes,

0 actual_processes,

'' message, s.service_handle srvc_handle

from apps.fnd_concurrent_queues_vl q, apps.fnd_application_vl


a,
apps.fnd_cp_services s

where q.application_id = a.application_id

and s.service_id = q.manager_type

and not exists (select 1

from apps.fnd_concurrent_processes p

where process_status_code in ('C','M','A','D','T')

and q.concurrent_queue_id = p.concurrent_queue_id

and q.application_id = p.queue_application_id);

To check All the running jobs with DB session details on the


current DB node

set lines 200

set pages 200

column PHASE heading 'Phase' format A8

column STATUS heading 'Status' format A8

column PROGRAM heading 'Program Name' format A25

column REQUESTOR heading 'Requestor' format A9


column START_TIME heading 'Start Time' format A15

column RUN_TIME justify left heading 'Runtime(m)' format


9999.99

column OSPID heading 'OSPID' format a5

column SID heading 'DBSID' format 99999

spool crrunning.lst

select fcrv.request_id REQUEST,

decode(fcrv.phase_code,'P','Pending','R','Running','I','Inacti
ve','Completed')PHASE,

decode(fcrv.status_code, 'A','Waiting', 'B','Resuming',


'C','Normal', 'F','Scheduled',

'G','Warning', 'H','On Hold', 'I','Normal', 'M','No Manager',

'Q','Standby', 'R','Normal', 'S','Suspended',


'T','Terminating',

'U','Disabled', 'W','Paused', 'X','Terminated',

'Z','Waiting',fcrv.status_code)STATUS,

substr(fcrv.program,1,25)PROGRAM,

substr(fcrv.requestor,1,9)REQUESTOR,

to_char(fcrv.actual_start_date,'MM/DD/RR HH24:MI')START_TIME,
round(((sysdate - fcrv.actual_start_date)*1440),2)RUN_TIME,

substr(fcr.oracle_process_id,1,7)OSPID,

vs.sid SID

--substr(fcr.os_process_id,1,7)OS_PID

from apps.fnd_conc_req_summary_v fcrv,

apps.fnd_concurrent_requests fcr,

v$session vs,

v$process vp

where fcrv.phase_code = 'R'

and fcrv.request_id = fcr.request_id

and fcr.oracle_process_id = vp.spid

and vs.paddr = vp.addr

order by PHASE, STATUS, REQUEST desc

To find the Trace file for particular concurrent request

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 offSELECT '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 apps.fnd_concurrent_requests req, v$session ses,


v$process proc,

v$parameter dest, v$parameter dbnm,


apps.fnd_concurrent_programs_vl prog,

apps.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;

To find the overall Request set activity and its various


request completion time

set linesize 300


col "Program Name" format a50

col Elapsed format 9999.99

col "Process ID" format a10

col REQUEST_DATE format a15

col ACTUAL_START_DATE format a15

col REQUEST format 999999999

col PARENT format 999999999

col argument_text format a50SELECT /*+ ORDERED USE_NL(x fcr


fcp fcptl)*/

fcr.request_id "REQUEST", fcr.parent_request_id "PARENT",

fcr.oracle_process_id "Process ID",

fcptl.user_concurrent_program_name "Program Name",

fcr.argument_text,

DECODE(fcr.phase_code

,'X', 'Terminated'

,'E', 'Error'

,'C','Completed'
,'P','Pending'

,'R','Running'

,phase_code) "Phase",

DECODE(fcr.status_code

,'X','Terminated'

,'C','Normal'

,'D','Cancelled'

,'E','Error'

,'G','Warning'

,'Q','Scheduled'

,'R','Normal'

,'W','Paused'

,'Not Sure') "Status",

--fcr.phase_code,

--fcr.status_code,

fcr.request_date,
fcr.actual_start_date,

fcr.actual_completion_date,

(fcr.actual_completion_date - fcr.actual_start_date)*1440
"Elapsed"

FROM (SELECT /*+ index (fcr1 FND_CONCURRENT_REQUESTS_N3) */

fcr1.request_id

FROM fnd_concurrent_requests fcr1

WHERE 1=1

START WITH fcr1.request_id = &request_id

--CONNECT BY PRIOR fcr1.parent_request_id = fcr1.request_id)


x,

CONNECT BY PRIOR fcr1.request_id = fcr1.parent_request_id) x,

fnd_concurrent_requests fcr,

fnd_concurrent_programs fcp,

fnd_concurrent_programs_tl fcptl

WHERE fcr.request_id = x.request_id

AND fcr.concurrent_program_id = fcp.concurrent_program_id

AND fcr.program_application_id = fcp.application_id


AND fcp.application_id = fcptl.application_id

AND fcp.concurrent_program_id = fcptl.concurrent_program_id

AND fcptl.LANGUAGE = 'US'

ORDER BY 1

To find the sid from the request id

select s.inst_id, fcr.request_id, fv.requestor, fv.Program


cmgr_job,

p.PID,

p.SERIAL#,

p.USERNAME p_user,

p.SPID,

to_char(s.logon_time,'DD-MON-YY HH24:MI:SS') Logon_Time,

s.program,

s.command,

s.sid,

s.serial#,

s.username,
s.process,

s.machine,

s.action,

s.module

from apps.fnd_concurrent_requests fcr,

apps.FND_CONC_REQ_SUMMARY_V fv,

gv$session s,

gv$process p

where fcr.request_id = &request_id

and p.SPID = fcr.oracle_process_id

and s.process = fcr.OS_PROCESS_ID

and s.inst_id = p.inst_id

and p.addr = s.paddr

and fv.request_id = fcr.request_id

;
To find all the things in detail from the particular request id/
query to find concurrent request details/how to check
concurrent request status from backend/ query to find
concurrent program run time

set pages 100;

col request_class_application_id format 99999999 heading


'REQUEST_CLASS|APP_ID'

col os_process_id format a8

col application_short_name format a5

col requested_start_date format a18 heading 'REQUEST DATE'

col actual_start_date format a18 heading 'START DATE'

col actual_completion_date format a18 heading 'COMPLETE DATE'

--

select r.REQUEST_ID

,u.user_name

, decode(r.PHASE_CODE,'C', 'Complete','P', 'Pending', 'R',


'Running', r.PHASE_CODE) phase
,decode(r.STATUS_CODE, 'C',
'Normal','I' ,'Normal','R' ,'Normal','Q', 'Standby',
'E' ,'Error', 'X' ,'Terminated','W', 'Paused' , r.STATUS_CODE)
status

,r.PRIORITY

,decode(r.HOLD_FLAG,'N','"NOT on hold"','Y','"ON
HOLD"',r.HOLD_FLAG) Hold_flag

, p.application_short_name

,f.user_concurrent_program_name,f.concurrent_program_name,e.EX
ECUTABLE_NAME,e.EXECUTION_FILE_NAME,

e.EXECUTION_METHOD_CODE,e.EXECUTION_FILE_PATH

, v.RESPONSIBILITY_name

, r.REQUEST_CLASS_APPLICATION_ID

, q.request_class_name

, r.PARENT_REQUEST_ID

,to_char(r.REQUESTED_START_DATE,'DD-MON-YYYY HH:MI')
requested_start_date

,to_char(r.ACTUAL_START_DATE,'DD-MON-YYYY HH:MI')
actual_start_date

,decode(r.ACTUAL_COMPLETION_DATE,null,'"Still
Running"',to_char(r.ACTUAL_COMPLETION_DATE,'DD-MON-YYYY
HH:MI')) actual_completion_date
,to_char(decode(r.ACTUAL_COMPLETION_DATE,null,SYSDATE,r.ACTUAL
_COMPLETION_DATE)-
decode(r.ACTUAL_START_DATE,null,SYSDATE,r.ACTUAL_START_DATE),'
MI') "Time Running"

,r.CPU_SECONDS

,r.LOGICAL_IOS

,r.PHYSICAL_IOS

,r.ORACLE_PROCESS_ID

,r.ORACLE_SESSION_ID

,r.OS_PROCESS_ID

,r.CD_ID

,decode(r.ENABLE_TRACE,'N', '"NOT Tracing"', 'Y', '"TRACING"',


r.ENABLE_TRACE) Trace

,decode(f.run_alone_flag, 'N', '"NOT Alone"', 'Y', '"RUN


ALONE"', f.run_alone_flag) Alone

,r.ARGUMENT_TEXT Parameters

,r.LOGFILE_NAME

from fnd_concurrent_requests r

, fnd_user u

, fnd_application p
, fnd_concurrent_programs_vl f

,fnd_EXECUTABLEs e

, fnd_responsibility_vl v

, fnd_concurrent_request_class q

where u.user_id = r.requested_by

and p.application_id = r.PROGRAM_APPLICATION_ID

and r.CONCURRENT_PROGRAM_ID = f.CONCURRENT_PROGRAM_ID

and f.EXECUTABLE_ID=e.EXECUTABLE_ID

and v.responsibility_id = r.responsibility_id

and q.request_class_id (+)= r.concurrent_request_class_id

and r.request_id = &reqid;

Sql to find Pending request in all Concurrent Manager/query


to find pending concurrent requests

select request_id,

b.user_concurrent_queue_name
from apps.fnd_concurrent_worker_requests a,

apps.fnd_concurrent_queues_vl b

where a.phase_code = 'P'

and a.status_code = 'I'

and a.hold_flag != 'Y'

and a.requested_start_date <= sysdate

and a.concurrent_queue_id = b.concurrent_queue_id

and a.control_code is null

--and a.concurrent_queue_name != 'FNDCRM'

and a.concurrent_queue_name not in ('FNDCRM')

order by

request_id, b.user_concurrent_queue_name

How to find which manager runs your request ID/query to


find concurrent manager for concurrent program

Column OsId Format A7


Column Oracle_Process_ID Format 99999

Column Concurrent_Queue_Name Format A20

Column Log Format A25

Column Started_At Format A20Set Head Off

Set Verify Off

Set Echo OffSelect

'The ' || Concurrent_Queue_Name ||

' concurrent manager ran your request from',

to_char(Actual_Start_date, ' MON-DD-YY HH:MI:SS AM') || ' - to


- ' ||

to_char(Actual_COMPLETION_date, 'MON-DD-YY HH:MI:SS AM'),

'The ' || Concurrent_Queue_Name ||

' concurrent manager log file is ' || P.Logfile_Name,

'Request log file is ' || R.Logfile_Name

From Fnd_Concurrent_Queues Q,

Fnd_Concurrent_requests R,

Fnd_Concurrent_Processes P
Where

(P.Concurrent_Queue_ID = Q.Concurrent_Queue_ID And

Queue_Application_ID = Q.Application_ID )

And R.Controlling_Manager = P.Concurrent_Process_ID

And R.Phase_Code = 'C'

And Request_ID = &Request_ID

;set head on

To find History of the Request ID program

set linesize 250

col request_date format a15

col requested_start_date format a15

col actual_start_date format a15

col actual_completion_date format a15

col argument_text format a70

col Elapsed format 9999.99

select * from (select a.request_id, a.parent_request_id,


DECODE(a.phase_code,

'C','Completed',

'I','Inactive',

'P','Pending',

'R','Running') || ' ' ||

DECODE(a.status_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') "PHASE_STATUS ", a.request_date,


a.requested_start_date, a.actual_start_date,
a.actual_completion_date ,

(nvl(actual_completion_date,sysdate) - actual_start_date)*1440
"Elapsed", a.argument_text ,a.USER_CONCURRENT_PROGRAM_NAME

from apps.FND_CONC_REQ_SUMMARY_V a where


a.concurrent_program_id=(select concurrent_program_id from
fnd_concurrent_requests where request_id=&1)

---(nvl(actual_completion_date,sysdate) -
actual_start_date)*1440 > 10

order by a.request_id desc) where rownum < 100;

Query to check concurrent program run history

ttitle off
set linesize 180

set pagesize 60

set newpage 0

set pause off

set termout on

ttitle 'CM Analysis Report' skip1

col conc_que format a15 heading "Conc Queue"

col user_name format a12 heading "Requestor"

col reqid format 99999999 heading "Req ID"

col sdate format a9 heading "Date"

col astart format a8 heading "ActSt|Time"

col acomp format a8 heading "ActEnd|Time"

col rtime format 99,999 heading "ExTme|(Sec)"

col wtime format 99,999 heading "WtTme|(Sec)"


col pname1 format a40 heading "Short|Name"

col pname2 format a65 heading "Prog Name"

col args format a25 heading "Arguments"

select

trunc(actual_start_date) sdate,

request_id reqid,

user_name,

to_char(actual_start_date,'HH24:MI:SS') astart,

to_char(actual_completion_date,'HH24:MI:SS') acomp,

((actual_start_date - requested_start_date)*60*60*24) wtime,

((actual_completion_date - actual_start_date)*60*60*24) rtime,

que.concurrent_queue_name conc_que,

prog.user_concurrent_program_name pname2,

req.argument_text args

from

applsys.fnd_concurrent_queues que,
applsys.fnd_user usr,

applsys.fnd_concurrent_programs prog,

applsys.fnd_concurrent_requests req,

applsys.fnd_concurrent_processes proc

where

(actual_start_date between to_date('&start_date', 'DD-MON-YYYY


HH24:MI:SS')

and to_date('&end_date', 'DD-MON-YYYY HH24:MI:SS')

or

actual_completion_date between to_date('&start_dte', 'DD-MON-


YYYY HH24:MI:SS')

and to_date('&end_date', 'DD-MON-YYYY HH24:MI:SS'))

and

user_concurrent_program_name like '&program_name%'

and

que.application_id= proc.queue_application_id

and

que.concurrent_queue_id = proc.concurrent_queue_id
and

req.controlling_manager= proc.concurrent_process_id

and

usr.user_id = req.requested_by

and

prog.concurrent_program_id = req.concurrent_program_id

and

prog.application_id = req.program_application_id

and prog.concurrent_program_name not in

('ACTIVATE','ABORT','DEACTIVATE','VERIFY')

order by

actual_start_date;

Query to find Running request  in Concurrent


Manager/ how to check running concurrent request
from backend/concurrent program status query
in oracle apps

set pages 58
set linesize 79Column Reqst Format 999999

Column Requestor Format A10

Column Orcl Format A7

Column Program Format A10

Column Started Format A14

Column Manager Format A11

Column LN Format a10Column Reqst HEADING 'Request|ID '

Column Requestor HEADING 'Requestor'

Column Orcl HEADING 'Oracle|Name'

Column Started HEADING 'Started at'

Column MANAGER HEADING 'Controlling|Manager'

Column LN HEADING 'Logfile|name'

Column Program HEADING 'Program'select Request_Id Reqst,


User_Name Requestor, Oracle_Username Orcl,

Fcr.Logfile_Name LN,

Concurrent_Queue_Name Manager,

Concurrent_Program_Name Program,
To_Char(Actual_Start_Date, 'Mm-Dd-Yy Hh24:Mi') Started,

Run_Alone_Flag, Single_Thread_Flag

From Fnd_Concurrent_Requests Fcr, Fnd_Concurrent_Programs Fcp,

Fnd_Oracle_Userid O, Fnd_Concurrent_Processes P,

Fnd_Concurrent_Queues Q, Fnd_User

Where

Controlling_Manager = Concurrent_Process_ID

And ( P.Concurrent_Queue_ID = Q.Concurrent_Queue_ID AND

P.Queue_Application_ID = Q.Application_ID )

And O.Oracle_Id = Fcr.Oracle_Id

And ( Fcr.Program_Application_Id = Fcp.Application_Id

And Fcr.Concurrent_Program_Id = Fcp.Concurrent_Program_Id )

And Requested_By = User_Id

And Phase_Code = 'R' and Status_Code = 'R'

Order By Actual_Start_Date, Request_Id

/
Query to find Terminating Requests in Concurrent Manager

set pages 58

set linesize 79Column Reqst Format 999999

Column Requestor Format A10

Column Orcl Format A7

Column Program Format A10

Column Started Format A14

Column Manager Format A11

Column LN Format a10Column Reqst HEADING 'Request|ID '

Column Requestor HEADING 'Requestor'

Column Orcl HEADING 'Oracle|Name'

Column Started HEADING 'Started at'

Column MANAGER HEADING 'Controlling|Manager'

Column LN HEADING 'Logfile|name'

Column Program HEADING 'Program'Select Request_Id Reqst,


User_Name Requestor, Oracle_Username Orcl,

Fcr.Logfile_Name LN,
Concurrent_Queue_Name Manager,

Concurrent_Program_Name Program,

To_Char(Actual_Start_Date, 'Mm-Dd-Yy Hh24:Mi') Started,

Run_Alone_Flag, Single_Thread_Flag

From Fnd_Concurrent_Requests Fcr, Fnd_Concurrent_Programs Fcp,

Fnd_Oracle_Userid O, Fnd_Concurrent_Processes P,

Fnd_Concurrent_Queues Q, Fnd_User

Where

Controlling_Manager = Concurrent_Process_ID

And ( P.Concurrent_Queue_ID = Q.Concurrent_Queue_ID AND

P.Queue_Application_ID = Q.Application_ID )

And O.Oracle_Id = Fcr.Oracle_Id

And ( Fcr.Program_Application_Id = Fcp.Application_Id

And Fcr.Concurrent_Program_Id = Fcp.Concurrent_Program_Id )

And Requested_By = User_Id

And Phase_Code = 'R' and Status_Code = 'T'


Order By Actual_Start_Date, Request_Id

Query to find Paused Requests in Concurrent Manager

set pages 58

set linesize 79Column Reqst Format 999999

Column Requestor Format A10

Column Orcl Format A7

Column Program Format A10

Column Started Format A14

Column Manager Format A11

Column LN Format a10Column Reqst HEADING 'Request|ID '

Column Requestor HEADING 'Requestor'

Column Orcl HEADING 'Oracle|Name'

Column Started HEADING 'Started at'

Column MANAGER HEADING 'Controlling|Manager'

Column LN HEADING 'Logfile|name'


Column Program HEADING 'Program'Select Request_Id Reqst,
User_Name Requestor, Oracle_Username Orcl,

Fcr.Logfile_Name LN,

Concurrent_Program_Name Program,

To_Char(Actual_Start_Date, 'Mm-Dd-Yy Hh24:Mi') Started,

Run_Alone_Flag, Single_Thread_Flag

From Fnd_Concurrent_Requests Fcr, Fnd_Concurrent_Programs Fcp,

Fnd_Oracle_Userid O, Fnd_User

Where Status_Code = 'W'

And Fcr.Concurrent_Program_Id = Fcp.Concurrent_Program_Id

And Fcr.Program_Application_Id = Fcp.Application_Id

And Requested_By = User_Id

And O.Oracle_Id = Fcr.Oracle_Id

Order By Actual_Start_Date, Request_Id

/
Check the log and outfile created from certain time period

select outfile_node_name,outfile_name,
logfile_node_name,logfile_name

from fnd_concurrent_requests

where phase_code = 'C' and

actual_completion_date < SYSDATE - &age;

Run the following query to check whether any specialization rule defined for any
concurrent manager that includes/excludes the concurrent program in
question. Query returns ‘no rows selected’ when there are no Include/Exclude
specialization rules of Program type for the given concurrent program.

select 'Concurrent program '||fcp.concurrent_program_name||'


is ' ||decode(fcqc.include_flag,'I','included in
','E','excluded from ')||fcqv.user_concurrent_queue_name
specialization_rule_details from fnd_concurrent_queues_vl
fcqv,fnd_concurrent_queue_content fcqc,fnd_concurrent_programs
fcp where fcqv.concurrent_queue_id=fcqc.concurrent_queue_id
and fcqc.type_id=fcp.concurrent_program_id and
fcp.concurrent_program_name='<PROGRAM_SHORT_NAME>';
Query to find the concurrent program id from concurrent
request

select concurrent_program_id from fnd_concurrent_requests


where request_id=&1;

Last 100 execution detail of concurrent program

set linesize 250

col request_date format a15

col requested_start_date format a15

col actual_start_date format a15

col actual_completion_date format a15

col argument_text format a70

col Elapsed format 9999.99

select * from (select  a.request_id, a.parent_request_id,

DECODE(a.phase_code,

'C','Completed',

'I','Inactive',

'P','Pending',
'R','Running') || ' ' ||

DECODE(a.status_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') "PHASE_STATUS ", a.request_date,


a.requested_start_date, a.actual_start_date,
a.actual_completion_date,

(nvl(actual_completion_date,sysdate) - actual_start_date)*1440
"Elapsed", a.argument_text ,a.USER_CONCURRENT_PROGRAM_NAME

from apps.FND_CONC_REQ_SUMMARY_V a where


a.concurrent_program_id=(select concurrent_program_id from
fnd_concurrent_requests where request_id=&1)

order by a.request_id desc) where rownum < 100;

To find the logfile /outfile/node name for the particular


request

SELECT  'LOGFILE_NAME=' || logfile_name

FROM    fnd_concurrent_requests

WHERE   request_id = &req

SELECT  'LOGFILE_NODE_NAME=' || logfile_node_name


FROM    fnd_concurrent_requests

WHERE   request_id = &req

SELECT  'OUTFILE_NAME=' || outfile_name

FROM    fnd_concurrent_requests

WHERE   request_id = &req

SELECT  'OUTFILE_NODE_NAME=' || outfile_node_name

FROM    fnd_concurrent_requests

WHERE   request_id = &req

Check ICM is running on what node

select a.concurrent_queue_name,a.target_node

, substr(b.os_process_id,0,10) “OS Proc”

, b.oracle_process_id “Oracle ID”


, b.process_status_code

from apps.fnd_concurrent_queues a

, apps.fnd_concurrent_processes b

where a.concurrent_queue_id=b.concurrent_queue_id

and a.concurrent_queue_name=’FNDICM’

and b.process_status_code=’A’

order by b.process_status_code

Check OS process ID/Target node for CM

Select User_Concurrent_Queue_Name Manager, Q.Target_Node Node,


Os_Process_ID

from apps.fnd_concurrent_queues_vl
Q,apps.Fnd_Concurrent_Processes P

where Q.Application_Id = Queue_Application_ID

And (Q.Concurrent_Queue_ID = P.Concurrent_Queue_ID);

To know the correct status of the Concurrent request from


the back end

The view FND_AMP_REQUESTS_V shows the proper phase and status


select request_id, phase, status

from fnd_amp_requests_v;

Check the completion text for the concurrent request

select COMPLETION_TEXT from apps.fnd_concurrent_requests where


REQUEST_ID=&n;

To Check Actual and Target Processes for Internal Manager

select MAX_PROCESSES,RUNNING_PROCESSES

from FND_CONCURRENT_QUEUES

where CONCURRENT_QUEUE_NAME='FNDICM';

To check the Actual and Target Processes for Standard


Manager

select MAX_PROCESSES,RUNNING_PROCESSES

from FND_CONCURRENT_QUEUES

where CONCURRENT_QUEUE_NAME='STANDARD';

To check the invalid objects related to FND

select substr(owner,1, 12) owner, substr(object_type,1,12)


type,
substr(status,1,8) status, substr(object_name, 1, 25) name

from dba_objects

where object_name like 'FND_%'

and status='INVALID';

Query to check whether any specialization rule defined for


any concurrent manager that includes/excludes the
concurrent program in question.

select 'Concurrent program '||fcp.concurrent_program_name||'


is ' ||decode(fcqc.include_flag,'I','included in
','E','excluded from ')||fcqv.user_concurrent_queue_name
specialization_rule_details from fnd_concurrent_queues_vl
fcqv,fnd_concurrent_queue_content fcqc,fnd_concurrent_programs
fcp where fcqv.concurrent_queue_id=fcqc.concurrent_queue_id
and fcqc.type_id=fcp.concurrent_program_id and
fcp.concurrent_program_name='<PROGRAM_SHORT_NAME>';

Note: Program Short Name is visible when the program is queried in concurrent
program definition form.

Query returns ‘no rows selected’ when there are no Include/Exclude


specialization rules of Program type for the given concurrent program.

For each manager get the number of pending and running


requests in each queue:

col "USER_CONCURRENT_QUEUE_NAME" format a40;


SELECT a.USER_CONCURRENT_QUEUE_NAME,a.MAX_PROCESSES,

sum(decode(b.PHASE_CODE,'P',decode(b.STATUS_CODE,'Q',1,0),0))
Pending_Standby,

sum(decode(b.PHASE_CODE,'P',decode(b.STATUS_CODE,'I',1,0),0))
Pending_Normal,

sum(decode(b.PHASE_CODE,'R',decode(b.STATUS_CODE,'R',1,0),0))
Running_Normal

FROM FND_CONCURRENT_QUEUES_VL a,
FND_CONCURRENT_WORKER_REQUESTS b

where a.concurrent_queue_id = b.concurrent_queue_id

AND b.Requested_Start_Date<=SYSDATE

GROUP BY a.USER_CONCURRENT_QUEUE_NAME,a.MAX_PROCESSES

To Get Long Running Concurrent Programs:

SELECT fcr.oracle_session_id

,fcr.request_id rqst_id

,fcr.requested_by rqst_by

,fu.user_name

,fr.responsibility_name
,fcr.concurrent_program_id cp_id

,fcp.user_concurrent_program_name cp_name

,TO_CHAR (fcr.actual_start_date, 'DD-MON-YYYY


HH24:MI:SS')act_start_datetime

,DECODE (fcr.status_code, 'R', 'R:Running', fcr.status_code)


status

,ROUND (((SYSDATE - fcr.actual_start_date) * 60 * 24), 2)


runtime_min

,ROUND (((SYSDATE - fcr.actual_start_date) * 60 * 60 * 24),


2)runtime_sec

,fcr.oracle_process_id "oracle_pid/SPID"

,fcr.os_process_id os_pid

,fcr.argument_text

,fcr.outfile_name

,fcr.logfile_name

,fcr.enable_trace

FROM apps.fnd_concurrent_requests fcr

,apps.fnd_user fu

,apps.fnd_responsibility_tl fr
,apps.fnd_concurrent_programs_tl fcp

WHERE fcr.status_code LIKE 'R'

AND fu.user_id = fcr.requested_by

AND fr.responsibility_id = fcr.responsibility_id

AND fcr.concurrent_program_id = fcp.concurrent_program_id

AND fcr.program_application_id = fcp.application_id

AND ROUND (((SYSDATE - fcr.actual_start_date) * 60 * 24), 2) >


60

ORDER BY fcr.concurrent_program_id

,request_id DESC;

Checking the incompatibilities between the


programs/query to find incompatible program of a
concurrent
The below query can be used to find all incompatibilities in
an application instance.

SELECT a2.application_name, a1.user_concurrent_program_name,

DECODE (running_type,

'P', 'Program',
'S', 'Request set',

'UNKNOWN'

) "Type",

b2.application_name "Incompatible App",

b1.user_concurrent_program_name "Incompatible_Prog",

DECODE (to_run_type,

'P', 'Program',

'S', 'Request set',

'UNKNOWN'

) incompatible_type

FROM apps.fnd_concurrent_program_serial cps,

apps.fnd_concurrent_programs_tl a1,

apps.fnd_concurrent_programs_tl b1,

apps.fnd_application_tl a2,

apps.fnd_application_tl b2

WHERE a1.application_id = cps.running_application_id


AND a1.concurrent_program_id =
cps.running_concurrent_program_id

AND a2.application_id = cps.running_application_id

AND b1.application_id = cps.to_run_application_id

AND b1.concurrent_program_id =
cps.to_run_concurrent_program_id

AND b2.application_id = cps.to_run_application_id

AND a1.language = 'US'

AND a2.language = 'US'

AND b1.language = 'US'

AND b2.language = 'US' ;

GET THE CURRENT SQL STATEMENT RUNNING FOR A


CONCURRENT REQUEST

SELECT A.REQUEST_ID, D.SID, D.SERIAL#, D.OSUSER, D.PROCESS,


C.SPID,

E.SQL_TEXT

FROM APPS.FND_CONCURRENT_REQUESTS A,

APPS.FND_CONCURRENT_PROCESSES B,
V$PROCESS C,

V$SESSION D,

V$SQL E

WHERE A.CONTROLLING_MANAGER = B.CONCURRENT_PROCESS_ID

AND C.PID = B.ORACLE_PROCESS_ID

AND B.SESSION_ID = D.AUDSID

AND D.SQL_ADDRESS = E.ADDRESS

AND A.REQUEST_ID = '&REQUEST_ID';

Cancelling Concurrent request/update concurrent request


status from backend

--By request id

update fnd_concurrent_requests

set status_code='D', phase_code='C'

where request_id=&reqid;

--By program_id
update fnd_concurrent_requests

set status_code='D', phase_code='C'

where CONCURRENT_PROGRAM_ID=&prgid;

How to submit a concurrent program using the CONCSUB


utility from the operating system

CONCSUB / \

[WAIT=N|Y|] \

CONCURRENT \

[PROGRAM_NAME=] \

[ORG_ID=<#>] - R12 onwards only

[REPEAT_TIME=] \

[REPEAT_INTERVAL= ] \

[REPEAT_INTERVAL_UNIT=< resubmission unit>] \

[REPEAT_INTERVAL_TYPE=< resubmission type>] \

[REPEAT_END=] \

[START=] \
[IMPLICIT=< type of concurrent request> \

[ ... ]

how to enable trace for a running concurrent


request
First Find the sid and serial# using below queries

For RAC

select s.inst_id, fcr.request_id, fv.requestor, fv.Program


cmgr_job,
p.PID,
p.SERIAL#,
p.USERNAME p_user,
p.SPID,
to_char(s.logon_time,'DD-MON-YY HH24:MI:SS') Logon_Time,
s.program,
s.command,
s.sid,
s.serial#,
s.username,
s.process,
s.machine,
s.action,
s.module
from apps.fnd_concurrent_requests fcr,
apps.FND_CONC_REQ_SUMMARY_V fv,
gv$session s,
gv$process p
where fcr.request_id = &request_id
and p.SPID = fcr.oracle_process_id
and s.process = fcr.OS_PROCESS_ID
and s.inst_id = p.inst_id
and p.addr = s.paddr
and fv.request_id = fcr.request_id
;

For Non-RAC, the above and below both can be used


select s.sid , s.serial# ,p.spid from fnd_concurrent_requests
f,v$session s , v$process p where f.request_id = and
f.oracle_process_id = p.spid and p.addr = s.paddr

Enable Trace

EXEC DBMS_SYSTEM.SET_EV(&sid , &serial,10046, 12 ,'');

Check the Trace file

Log on to the DB Tier …. Check for the trace file <instance


name>_ora_<SPID>.trc

Find the scheduled concurrent requests:

SELECT cr.request_id,
DECODE (cp.user_concurrent_program_name,
'Report Set', 'Report Set:' || cr.description,
cp.user_concurrent_program_name
) NAME,
argument_text, cr.resubmit_interval,
NVL2 (cr.resubmit_interval,
'PERIODICALLY',
NVL2 (cr.release_class_id, 'ON SPECIFIC DAYS', 'ONCE')
) schedule_type,
DECODE (NVL2 (cr.resubmit_interval,
'PERIODICALLY',
NVL2 (cr.release_class_id, 'ON SPECIFIC DAYS', 'ONCE')
),
'PERIODICALLY', 'EVERY '
|| cr.resubmit_interval
|| ' '
|| cr.resubmit_interval_unit_code
|| ' FROM '
|| cr.resubmit_interval_type_code
|| ' OF PREV RUN',
'ONCE', 'AT :'
|| TO_CHAR (cr.requested_start_date, 'DD-MON-RR HH24:MI'),
'EVERY: ' || fcr.class_info
) schedule,
fu.user_name, requested_start_date
FROM apps.fnd_concurrent_programs_tl cp,
apps.fnd_concurrent_requests cr,
apps.fnd_user fu,
apps.fnd_conc_release_classes fcr
WHERE cp.application_id = cr.program_application_id
AND cp.concurrent_program_id = cr.concurrent_program_id
AND cr.requested_by = fu.user_id
AND cr.phase_code = 'P'
AND cr.requested_start_date > SYSDATE
AND cp.LANGUAGE = 'US'
AND fcr.release_class_id(+) = cr.release_class_id
AND fcr.application_id(+) = cr.release_class_app_id;

History of concurrent requests which are error out in


last 2 days

SELECT a.request_id "Req Id"


,a.phase_code,a.status_code
, actual_start_date
, actual_completion_date
,c.concurrent_program_name || ': ' ||
ctl.user_concurrent_program_name "program"
FROM APPLSYS.fnd_Concurrent_requests
a,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_concurrent_programs_tl ctl
WHERE a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND a.status_code = 'E'
AND a.phase_code = 'C'
AND actual_start_date > sysdate - 2
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND ctl.concurrent_program_id = c.concurrent_program_id
AND ctl.LANGUAGE = 'US'
ORDER BY 5 DESC;

query to check trace enabled for concurrent


program
SELECT A.CONCURRENT_PROGRAM_NAME "Program Name",

SUBSTR(A.USER_CONCURRENT_PROGRAM_NAME,1,40) "User Program


Name",

SUBSTR(B.USER_NAME,1,15) "Last Updated By",

SUBSTR(B.DESCRIPTION,1,25) DESCRIPTION

FROM APPS.FND_CONCURRENT_PROGRAMS_VL A, APPLSYS.FND_USER B

WHERE A.ENABLE_TRACE='Y'

AND A.LAST_UPDATED_BY=B.USER_ID;

Query to find Concurrent Request Details from


Concurrent Program Name

Script

SELECT
   distinct user_concurrent_program_name,
    responsibility_name,
    request_date,
    argument_text,
    request_id,
    phase_code,
    status_code,
    logfile_name,
    outfile_name,
    output_file_type,
    hold_flag,
    user_name
FROM
    fnd_concurrent_requests fcr,
    fnd_concurrent_programs_tl fcp,
    fnd_responsibility_tl fr,
    fnd_user fu
WHERE
    fcr.CONCURRENT_PROGRAM_ID = fcp.concurrent_program_id
    and fcr.responsibility_id = fr.responsibility_id
    and fcr.requested_by = fu.user_id
    --and user_name = upper('HIMSINGH')
    and user_concurrent_program_name in 
('Active Users')
    and Phase_code='P'
ORDER BY REQUEST_DATE DESC;

The where conditions can be modified as per your need.


Concurrent Manager and program related scripts
SQL Script to Troubleshoot a long-running concurrent request

set term on
set feedback on
set echo on
set arraysize 4
set linesize 200
set pages 9999
set underline =;
column username format A15
column sid format 9990 heading SID
column type format A4
column lmode format 990 heading 'HELD'
column request format 990 heading 'REQ'
column id1 format 9999990
column id2 format 9999990
column sql_text format a100
column name format a80
break on id1 skip 1 dup
undefine v_request_id
define v_request_id
undefine v_spid
define v_spid
undefine v_sid
define v_sid
spool vj_concurrent_monitor.lst

Prompt Enter the concurrent_request_id


Accept v_request_id
prompt checking requests
select oracle_process_id from fnd_concurrent_requests where request_id='&v_request_id';

Prompt Enter the operating system oracle process id for this concurrent request
accept v_spid
Prompt Getting the sid
SELECT SID,SERIAL#,LOGON_TIME FROM V$SESSION WHERE PADDR IN
(SELECT ADDR FROM V$PROCESS WHERE SPID='&v_spid');

prompt Enter the session id for this concurrent request


accept v_sid
prompt memory usage for this session
SELECT A.SID,A.USERNAME,B.VALUE,c.name FROM V$SESSION a,V$SESSTAT B,V$STATNAME C WHERE
A.SID=B.SID
AND B.STATISTIC#=C.STATISTIC# AND C.NAME like'%memor%' and a.sid='&v_sid';

prompt resource usage for this session


SELECT A.SID,A.USERNAME,B.VALUE,c.name FROM V$SESSION a,V$SESSTAT B,V$STATNAME C WHERE
A.SID=B.SID
AND B.STATISTIC#=C.STATISTIC# and a.sid='&v_sid' order by b.value;

prompt this session waited on


select sid,event,wait_time,state from v$session_wait where sid='&v_sid' order by wait_time;
prompt current sql executing by this session
select a.sid,b.sorts,b.executions,b.loads,b.parse_calls,b.disk_reads,
b.buffer_gets,b.rows_processed,C.sql_text from v$session a,v$sqlarea b,V$SQLTEXT C
where a.sql_address=b.address and b.address=c.address and a.sid='&v_sid';

prompt sql which is taking more than 3mb in shared pool


prompt nosql should take morethan 1mb in shared pool.
prompt please ask the developers to tune the following sql statements
select name,
namespace,type,sharable_mem/(1024*1024) sharablemem,loads,executions,locks,pins,kept from
v$db_object_cache
where SHARABLE_MEM>3000000;

prompt sort segments using by this session


SELECT s.username,s.sid,s.osuser,s.process,s.machine,u.extents, u.blocks,u.tablespace FROM
v$session s, v$sort_usage u
WHERE s.saddr=u.session_addr order by extents;
and s.sid='&v_sid';

prompt current temp segments free in this instance


SELECT tablespace_name, extent_size, total_extents, used_extents, free_extents, max_used_size
FROM v$sort_segment;

prompt total system events at this time


select event,total_waits waits, total_timeouts timeouts, time_waited total_time from
v$system_event order by total_waits;

prompt latch contention if thery is any


SELECT latch#, name, gets, misses, sleeps FROM v$latch WHERE sleeps>0 ORDER BY sleeps ;

prompt the latch which is sleeping


select name, sleeps,latch# from v$latch_children where sleeps>4 order by sleeps;

spool off
clear columns
clear breaks

How to find out which request is handle by which concurrent queue.


a) First find out short_name of a program and then pass it as parameter to below query.

b) The below query will give you output


 I - Included  - Included in new concurrent queue
 E - excluded from Standard Manager 

This way you know now this running program (concurrent request) is handled by new manager and
not part of standard manager.

SELECT A.INCLUDE_FLAG, A.QUEUE_APPLICATION_ID, C.USER_CONCURRENT_QUEUE_NAME,


 B.CONCURRENT_PROGRAM_NAME
FROM APPLSYS.FND_CONCURRENT_QUEUE_CONTENT A, APPLSYS.FND_CONCURRENT_PROGRAMS B,
APPS.FND_CONCURRENT_QUEUES_VL C
WHERE type_id = b.concurrent_program_id and b.concurrent_program_name = ‘&SHORT_NAME’ and
c.concurrent_queue_id = a.concurrent_queue_id

How to find out Summary of Concurrent requests.

SELECT
request_id, SUBSTR(requestor,1,25), SUBSTR(program,1,50),
SUBSTR(user_concurrent_program_name,1,100),
TO_CHAR(actual_start_date,’dd/mm/yy :hh24:mi’) start_date,
TO_CHAR(actual_completion_date,’dd/mm/yy :hh24:mi’) completion_date,
FLOOR((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24) “in Hours”,
(((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24)-(FLOOR((ACTUAL_COMPLETION_DATE-
ACTUAL_START_DATE)*24)))*60 “In_Min”
–requestor, program, user_concurrent_program_name
FROM fnd_conc_req_summary_v
WHERE (ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24*60 >10

How to find database SID from a Concurrent request.

column process heading “FNDLIBR PID”


SELECT a.request_id, d.sid, d.serial# ,d.osuser,d.process , c.SPID
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
v$process c,
v$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND a.request_id = &Request_ID
AND a.phase_code = ‘R’;
You need your concurrent request ID as an input.
c.SPID= is the operating system process id
d.sid= is the Oracle process id

Cancel Concurrent requests. We don't need concurrent requests which are scheduled in
production to keep running in test. We use the following update to cancel them.
update fnd_concurrent_requests
set phase_code='C',
status_code='D'
where phase_code = 'P'
and concurrent_program_id not in (
select concurrent_program_id
from fnd_concurrent_programs_tl
where user_concurrent_program_name like '%Synchronize%tables%'
or user_concurrent_program_name like '%Workflow%Back%'
or user_concurrent_program_name like '%Sync%responsibility%role%'
or user_concurrent_program_name like '%Workflow%Directory%')
and (status_code = 'I' OR status_code = 'Q');

Use the SQL below to only cancel the running requests connecting as sys
UPDATE applsys.fnd_concurrent_requests
SET phase_code = 'C', status_code = 'X'
WHERE phase_code = 'R' and status_code ='R'
/
commit

Also, please put all Pending Jobs on Hold, using the SQL below connecting as sys

update applsys.fnd_concurrent_requests
set hold_flag='Y' where
phase_code='P' and hold_flag='N'
/
commit
update fnd_concurrent_requests fcr
set phase_code = 'C',
status_code = 'D'
where fcr.PHASE_CODE <> 'C'
and (fcr.program_application_id,fcr.CONCURRENT_PROGRAM_id) in
(select fcp.application_id,fcp.concurrent_program_id from fnd_concurrent_programs
fcp,fnd_executables_vl fev
where fcp.executable_application_id=fev.application_id and fcp.executable_id=fev.executable_id
and (upper(fev.user_executable_name) like 'AL%MAIL%'
or upper(fev.user_executable_name) like 'AL%FTP%'
or upper(fev.user_executable_name) like 'AL%EXCEL%'))
/

To change the number of processes for the standard manager


update FND_CONCURRENT_QUEUE_SIZE
set min_processes = 4
where concurrent_queue_id = 0;

how to find params passed to request from backend

select CONCURRENT_PROGRAM_ID,CONCURRENT_PROGRAM_NAME from fnd_concurrent_programs


where concurrent_program_name like '';

select
REQUEST_ID,CONCURRENT_PROGRAM_ID,substr(ARGUMENT_TEXT,1,60)params,status_code,phase_c
ode from fnd_concurrent_requests where CONCURRENT_PROGRAM_ID=;

To increase the jvm for OPP

"From Note ID 737311.1 we need to do step 3 We are changing this parameter to 2048m as
mentioned below in script.
Configure the Output Post Processor's JVM. These steps set the JVM to 2GB, depending upon
your server's size you might find 3 GB (-mx3072m), 4GB (-mx4096m) or even 5GB (-mx5120m) is a
better value. This setting prevents the error ""java.lang.OutOfMemoryError: Java heap space""
in the Output Post Processor's log associated to the Subledger Accounting Program.
Login to SQL*Plus as APPS.
SQL>update FND_CP_SERVICES set DEVELOPER_PARAMETERS =
'J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx2048m'
where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES
where CONCURRENT_QUEUE_NAME = 'FNDCPOPP');
Bounce the concurrent managers.
one more eg:
To determine current heap size:
select DEVELOPER_PARAMETERS
from FND_CP_SERVICES
where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES where
CONCURRENT_QUEUE_NAME = 'FNDCPOPP');

To increase heap size to 1024:


update FND_CP_SERVICES
set DEVELOPER_PARAMETERS = 'J:oracle.apps.fnd.cp.gsf.GSMServiceController:-mx1024m'
where SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES where
CONCURRENT_QUEUE_NAME = 'FNDCPOPP');

Query to find pending concurrent requests

select count(*)
from APPS.FND_ 2 CONCURRENT_PROGRAMS_VL a,
APPS.FND_CONCURRENT_REQUESTS b
where a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_ID
and a.APPLICATION_ID = b.PROGRAM_APPLICATION_ID
and b.PHASE_CODE = 'P'
and b.requested_start_date <= sysdate

Pending job details


"SELECT c.user_name, request_id, phase_code, status_code, hold_flag,
TO_CHAR(requested_start_date,'DD-MON-YY:HH24:MM:SS') Requested_Start_Date,
user_concurrent_program_name, b.concurrent_program_id
FROM applsys.fnd_concurrent_requests a,
applsys.fnd_concurrent_programs_tl b,
applsys.fnd_user c
WHERE a.phase_code = 'P'
AND a.concurrent_program_id = b.concurrent_program_id
AND b.LANGUAGE = 'US'
AND c.user_id = a.requested_by
ORDER BY user_concurrent_program_name;"

Cancel scheduled concurrent Request “Gather Schema Statistics” sqlplus apps/apps


sql>
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I') and concurrent_program_id=38121;
Commit;
Exit

Putting all concurrent jobs on hold:


Update applsys.fnd_concurrent_requests set hold_flag='Y' where phase_code in ('R','P','I');

Cancel scheduled concurrent Request “Gather Schema Statistics”


sqlplus apps/apps
sql>
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I') and concurrent_program_id=38121;
Commit;
Exit

To terminate request from backend


SQL> select REQUEST_ID,ORACLE_ID,ORACLE_PROCESS_ID,ORACLE_SESSION_ID,OS_PROCESS_ID from
applsys.FND_CONCURRENT_REQUESTS where REQUEST_ID=577945;

REQUEST_ID ORACLE_ID ORACLE_PROCESS_ID ORACLE_SESSION_ID


---------- ---------- ------------------------------ -----------------
OS_PROCESS_ID
--------------------------------------------------------------------------------------------------------------------------
----------
577945 900 13348 1242142
13299

SQL> !kill -9 13348


/bin/ksh: kill: 13348: No such process

SQL> update APPLSYS.fnd_Concurrent_requests set PHASE_CODE='C', STATUS_CODE='D' where


REQUEST_ID=577945;

1 row updated.

SQL> commit;

Commit complete.

Schedule “Purge Concurrent Request and/or Manager Data”


Cancel existing scheduled request before scheduling new.
# ebappsenv
# sqlplus apps
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I')
and concurrent_program_id=32263;

Parameter:
Entity : REQUEST
Mode : Age
Mode Value : 15  On non-prod environments as per case# 734780

Schedule:
on specific days : Wednesday and Saturday at 19:00 CET

Run Gather Schema Statistics as a Concurrent request


Cancel any pending jobs for “Gather Schema Statistics”
Sqlplus apps/appspasswd
Sql>
update fnd_concurrent_requests
set phase_code='C',status_code='D'
WHERE phase_code = 'P'
AND status_code in ('Q','I') and concurrent_program_id=38121;

Login to Oracle applications of target instance as sysadmin thru Appjump


Select system administrator Responisibility
Verify whether Concurrent Request “Gather Schema Statistics” is running or not
If not running, schedule the request to run immediately with Parameters : ALL,10

To check status fo running requests:

column REQUEST heading 'Request' format a8


column PHASE heading 'Phase' format A8
column STATUS heading 'Status' format A8
column PROGRAM heading 'Program Name' format A40
column SHORT heading 'Short Name' format A15
column REQUESTOR heading 'Requestor' format A10
column START_TIME heading 'Start Time' format A15
column RUN_TIME justify left heading 'Time(m)' format 999999.9
column OSPID heading 'OSPID' format a5
column OS_PIDa heading 'OSPIDA' format a6
column SID heading 'SID' format 99999
column serial# heading 'Serial#' format 99999

select substr(fcrv.request_id,1,8)REQUEST,
decode(fcrv.phase_code,'P','Pending','R','Running','I','Inactive','Completed')PHASE,
decode(fcrv.status_code,
'A','Waiting',
'B','Resuming',
'C','Normal',
'F','Scheduled',
'G','Warning',
'H','On Hold',
'I','Normal',
'M','No Manager',
'Q','Standby',
'R','Normal',
'S','Suspended',
'T','Terminating',
'U','Disabled',
'W','Paused',
'X','Terminated',
'Z','Waiting',fcrv.status_code)STATUS,
substr(fcrv.program,1,40)PROGRAM,substr(fcrv.PROGRAM_SHORT_NAME,1,15)SHORT,
substr(fcrv.requestor,1,15)REQUESTOR,
-- to_char(fcrv.actual_start_date,'MM/DD/RR HH24:MI')START_TIME,
round(((sysdate - fcrv.actual_start_date)*1440),1)RUN_TIME,
substr(fcr.oracle_process_id,1,7)OSPID,s.sid,s.serial#
from apps.fnd_conc_req_summary_v fcrv,
apps.fnd_concurrent_requests fcr,
v$session s,v$process p
where fcrv.phase_code = 'R'
and fcrv.request_id = fcr.request_id
and s.paddr = p.addr
and fcr.oracle_process_id = p.spid
and fcrv.concurrent_program_id not in ('40112','40113','36887')
--and trunc(fcrv.actual_start_date) like trunc(sysdate)
order by PHASE, STATUS, REQUEST desc;

Take export dump of concurrent tables and import

exp userid=applsys/xxxx file=conc.dmp log=exp.log


tables=FND_CONCURRENT_QUEUES,FND_CONCURRENT_QUEUES_TL,
FND_CONCURRENT_QUEUE_SIZE, FND_CONCURRENT_QUEUE_CONTENT

Truncate the fnd concurrent tables

SQL> truncate table fnd_Concurrent_queues;

Table truncated.

SQL> truncate table FND_CONCURRENT_QUEUES_TL;

Table truncated.

SQL> truncate table FND_CONCURRENT_QUEUE_SIZE;

Table truncated.

SQL> truncate table FND_CONCURRENT_QUEUE_CONTENT;

Table truncated.
Import the data back into the fnd tables which was exported as part of step above

imp userid=applsys/apps ignore=y file=conc.dmp full=y log=imp.log

Check whether the GSM is Up and Running in the system --> Profile option or using the
Following Query :
select DECODE(b.profile_option_value, 'Y', 'Enabled', 'Disabled') DETAILS
from fnd_profile_options a, fnd_profile_option_values b
where a.APPLICATION_ID = b.APPLICATION_ID
and a.PROFILE_OPTION_ID = b.PROFILE_OPTION_ID
and a.PROFILE_OPTION_NAME = 'CONC_GSM_ENABLED';

Check whether the Service Manager is up and Running by the following Query :
select CONCURRENT_QUEUE_NAME, ENABLED_FLAG, MAX_PROCESSES, RUNNING_PROCESSES
from FND_CONCURRENT_QUEUES
where CONCURRENT_QUEUE_NAME like 'FNDSM%';

The following SQL scripts located under $FND_TOP/sql are useful when diagnosing concurrent
manager problems:

afimchk.sql Tells the status of the ICM and PMON method

afcmstat.sql Lists active manager processes

afrqrun.sql Lists all the running, waiting and Terminating requests


afrqwait.sql Lists requests that are constrained and waiting for the ICM to release them.

afrqscm.sql Prints log file name of managers that can run a given request. It can be used to check
for possible errors when a request stays in pending status. It requires a request id value.

afcmcreq.sql Prints the log file name of the manager that processed the request

afrqstat.sql Summary of completed concurrent requests grouped by completion status and


execution type. It requires number of days prior to today on which to report parameter.

afimlock.sql Lists locks that the ICM is waiting to get

afcmrrq.sql Lists managers that currently are running a request

Reports on requests that having been running for over a specified amount of time (hard coded
as 4 hours). Exceptions, in addition to the defaults below, can be added by entering the
program ID for the program exceptions under multi-items.

Runs Every 20 minutes

Uses the following query:


select b.REQUEST_ID, a.DESCRIPTION, b.phase_code,
(sysdate - b.actual_start_date) * 24 "running",
to_char(sysdate, 'mm/dd/yyyy hh:mi') "now",
to_char(b.request_date, 'mm/dd/yyyy hh:mi') "request_date",
to_char(b.actual_start_date, 'mm/dd/yyyy hh:mi') "start_time",
b.program_application_id "program_application_id",
b.concurrent_program_id "concurrent_program_id"
from APPS.FND_CONCURRENT_PROGRAMS_VL a,
APPS.FND_CONCURRENT_REQUESTS b
where a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_ID
and a.APPLICATION_ID = b.PROGRAM_APPLICATION_ID
and b.STATUS_CODE = 'R'
and b.PHASE_CODE = 'R'
and ((sysdate - b.actual_start_date) * 24) > 4
and a.CONCURRENT_PROGRAM_ID NOT IN(36887,43393,38121,42789,31556)

Excludes:
36887 - Workflow Mailer
43393 - ITM Adapter
38121 - Gather Schema Statistics
42789 - OAM Applications Dashboard Collection
31556 - Planning Manager

Monitors pending jobs exceeds the specified threshold. Excessive pending jobs may indicate an
issue with the Concurrent Manager. Uses the following query:

select a.concurrent_program_name, b.REQUEST_ID, a.description,


to_char(b.request_date, 'mm/dd/yyyy hh:mi:ss') ""request_date"",
to_char(b.requested_start_date, 'mm/dd/yyyy hh:mi:ss') ""request_start""
from APPS.FND_CONCURRENT_PROGRAMS_VL a,
APPS.FND_CONCURRENT_REQUESTS b
where a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_ID
and a.APPLICATION_ID = b.PROGRAM_APPLICATION_ID
and b.PHASE_CODE = 'P'
and b.requested_start_date <= sysdate

The error threshold monitor will alert if the number of failed jobs exceeds the user defined
threshold in a 30 minute period.

select a.concurrent_program_name, b.REQUEST_ID, a.description,


b.status_code, b.phase_code
from APPS.FND_CONCURRENT_PROGRAMS_VL a,
APPS.FND_CONCURRENT_REQUESTS b
where a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_ID
and a.APPLICATION_ID = b.PROGRAM_APPLICATION_ID
and b.STATUS_CODE IN ('E')
and b.actual_completion_date > sysdate - 1/48

Find request which are put on hold


SQL> select REQUEST_ID from fnd_concurrent_requests where phase_code ='P' and hold_flag='Y';

To find oracle_process id for a request id to pull trace file from udump:

select oracle_process_id ,
decode(status_code,'R','Running','D','Canceled','E','Error','X','Terminated','G','Warning','T','Terminating'
)""Status_code"",
phase_code,to_char(actual_start_date,'DD-MON-YYYY=>hh24:mi:ss') ""Login Time""
from apps.fnd_concurrent_requests where request_id='&Enter_conn_req_id'

To find spid of a request to get the trace file


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

To check failed jobs submitted by an user


set lines 1000 pages 100
clear columns
col "Submitted By" format a15 word_wrap
select user_name "Submitted By", request_id "Request #",
to_char(cr.request_date,'dd-mon-rr hh24:mi') "Submitted on",
to_char(cr.last_update_date,'dd-mon-rr hh24:mi') "Failed on"
from applsys.fnd_concurrent_requests cr,
applsys.fnd_user u
where u.user_id = cr.requested_by
and user_name like '%BATCH%'
and cr.status_code ='E'
and cr.phase_code ='C'
and cr.request_date > sysdate - 1
order by 1

Statement to put the jobs on hold and release them lateron


To hold the requests (as apps user):
1) Drop table apps.str_dba_conc_req_hold ;
2) Create table apps.str_dba_conc_req_hold as select * from fnd_Concurrent_requests where
PHASE_CODE='P' and hold_flag='N';
3) select count(*) from apps.str_dba_conc_req_hold ;
4) update fnd_Concurrent_requests set hold_flag='Y' where PHASE_CODE='P' and hold_flag='N' and
request_id in (select request_id from apps.str_dba_conc_req_hold) ;

NOTE: You have to commit if select & update are same number of records. Otherwise rollback and
try again till the numbers are same

5) Commit;

To Release these requests in prod after patching, here is the step :

6) a. update fnd_Concurrent_requests set hold_flag='N' where request_id in (select request_id from


apps.str_dba_conc_req_hold);
b. commit;

How to take cm program trace.

Responsibility: System Administrator


Navigate: Concurrent > Program > Define
Query Concurrent Program
Select the Enable Trace Checkbox

Responsibility: System Administrator


Navigate: Profiles > System
Query Profile Option Concurrent: Allow Debugging
Set profile to Yes

Logon to the Responsibility that runs the Concurrent Program


In the Submit Request Screen click on Debug Options (B)
Select the Checkbox for SQL Trace

To submit active user request from backend


CONCSUB APPS/APPS SYSADMIN "System Administrator" SYSADMIN CONCURRENT FND FNDSCURS
PROGRAM_NAME='"Active Users"'

sql program to submit request from backend


"SET SERVEROUTPUT ON
declare
req_id number;
begin
DBMS_OUTPUT.PUT_LINE('In begin');
fnd_global.APPS_INITIALIZE (0, 21758, 671);
req_id := FND_REQUEST.SUBMIT_REQUEST(application => 'FND',program => 'FNDSCURS',description
=> '',start_time =>
'',sub_request => FALSE);

if (req_id = 0) then
/* Handle submission error */
DBMS_OUTPUT.PUT_LINE('Request ID :' || req_id);
DBMS_OUTPUT.PUT_LINE('As the request ID is 0, the request was not submitted');
DBMS_OUTPUT.PUT_LINE('Please verify this part again');
else
DBMS_OUTPUT.PUT_LINE('Request ID :' || req_id);
DBMS_OUTPUT.PUT_LINE('Request submitted successfully');
commit;
end if;
end;
/

Meaning of status_code and phase_code in FND_CONCURRENT_REQUESTS table STATUS_CODE


Column:

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

PHASE_CODE column

C - Completed
I - Inactive
P - Pending
R - Running
check long running concurrent request in Oracle Apps
Looking on how to check long running concurrent request in Oracle Apps 11i or R12?
Here’s the overview of the SQL query script to detect the session information of each program.

First you need to get the listing of running concurrent request in Oracle Apps 11i or R12.
You can use the SQL query script as below to obtain the list of running request.

--------------

SELECT a.request_id
,a.oracle_process_id "SPID"
,frt.responsibility_name
,c.concurrent_program_name || ': ' || ctl.user_concurrent_program_name
,a.description
,a.ARGUMENT_TEXT
,b.node_name
,b.db_instance
,a.logfile_name
,a.logfile_node_name
,a.outfile_name
,q.concurrent_queue_name
,a.phase_code,a.status_code, a.completion_text
, actual_start_date
, actual_completion_date
, fu.user_name
,(nvl(actual_completion_date,sysdate)-actual_start_date)*1440 mins
,(SELECT avg(nvl(a2.actual_completion_date-a2.actual_start_date,0))*1440 avg_run_time
FROM APPLSYS.fnd_Concurrent_requests a2,
APPLSYS.fnd_concurrent_programs c2
WHERE c2.concurrent_program_id = c.concurrent_program_id
AND a2.concurrent_program_id = c2.concurrent_program_id
AND a2.program_application_id = c2.application_id
AND a2.phase_code || '' = 'C') avg_mins
,round((actual_completion_date - requested_start_date),2) * 24 duration_in_hours
FROM APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_concurrent_programs_tl ctl
,apps.fnd_user fu
,apps.FND_RESPONSIBILITY_TL frt
WHERE a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND a.phase_code = 'R'
AND a.status_code = 'R'
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND ctl.concurrent_program_id = c.concurrent_program_id
AND a.requested_by = fu.user_id
AND a.responsibility_id = frt.responsibility_id
ORDER BY a.actual_start_date DESC;
------------------------------------------------------

You can see the request id and other relevant information from the result.

Based on the SPID associated to each running request, query the v$session or
v$session_longops table to see what is the request id doing in the backend.

SELECT b.sid, b.serial#, a.spid, b.program, b.osuser, b.machine,


b.TYPE, b.event, b.action, b.p1text, b.p2text, b.p3text, b.state, c.sql_text,b.logon_time
FROM v$process a, gv$session b, v$sqltext c
WHERE a.addr=b.paddr
AND b.sql_hash_value = c.hash_value
AND b.STATUS = 'ACTIVE'
AND a.spid = '20981'
ORDER BY a.spid, c.piece;

Replace v$session with gv$session if the database is running on RAC environment.


Enable or set trace if you wish to know more details on the session.

Long running Concurrent Requests


1.How to Determine Which Manager Ran a Specific Concurrent Request?

col USER_CONCURRENT_QUEUE_NAME for a100


select b.USER_CONCURRENT_QUEUE_NAME from fnd_concurrent_processes a,
fnd_concurrent_queues_vl b, fnd_concurrent_requests c
where a.CONCURRENT_QUEUE_ID = b.CONCURRENT_QUEUE_ID
and a.CONCURRENT_PROCESS_ID = c.controlling_manager
and c.request_id = '&conc_reqid';

2.Concurrent manager status for a given sid?

col MODULE for a20


col OSUSER for a10
col USERNAME for a10
set num 10
col MACHINE for a20
set lines 200
col SCHEMANAME for a10
select s.sid,s.serial#,p.spid os_pid,s.status, s.osuser,s.username, s.MACHINE,s.MODULE,
s.SCHEMANAME,
s.action from gv$session s, gv$process p WHERE s.paddr = p.addr and s.sid = '&oracle_sid';

3. Find out request id from Oracle_Process Id:

select REQUEST_ID,ORACLE_PROCESS_ID,OS_PROCESS_Id from


apps.fnd_concurrent_requests where
ORACLE_PROCESS_ID='&a';

4.To find sid,serial# for a given concurrent request id?

set lines 200


SELECT a.request_id, d.sid, d.serial# ,d.osuser,d.process , c.SPID ,d.inst_id
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
gv$process c,
gv$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND a.request_id = &Request_ID
AND a.phase_code = 'R';

5.To find concurrent program name,phase code,status code for a given request id?

SELECT request_id, user_concurrent_program_name,


DECODE(phase_code,'C','Completed',phase_code)
phase_code, DECODE(status_code,'D', 'Cancelled' ,
'E', 'Error' , 'G', 'Warning', 'H','On Hold' , 'T', 'Terminating', 'M', 'No Manager' , 'X',
'Terminated', 'C', 'Normal', status_code) status_code, to_char(actual_start_date,'dd-mon-
yy:hh24:mi:ss') Start_Date, to_char(actual_completion_date,'dd-mon-yy:hh24:mi:ss'),
completion_text FROM apps.fnd_conc_req_summary_v WHERE request_id = '&req_id' ORDER BY 6
DESC;

6.To find the sql query for a given concurrent request sid?

select sid,sql_text from gv$session ses, gv$sqlarea sql where


ses.sql_hash_value = sql.hash_value(+) and ses.sql_address = sql.address(+) and
ses.sid='&oracle_sid'
/

7. To find child requests

set lines 200


col USER_CONCURRENT_PROGRAM_NAME for a40
col PHASE_CODE for a10
col STATUS_CODE for a10
col COMPLETION_TEXT for a20
SELECT sum.request_id,req.PARENT_REQUEST_ID,sum.user_concurrent_program_name,
DECODE
(sum.phase_code,'C','Completed',sum.phase_code) phase_code, DECODE(sum.status_code,'D',
'Cancelled' ,
'E', 'Error' , 'G', 'Warning', 'H','On Hold' , 'T', 'Terminating', 'M', 'No Manager' , 'X',
'Terminated', 'C', 'Normal', sum.status_code) status_code, sum.actual_start_date,
sum.actual_completion_date, sum.completion_text FROM apps.fnd_conc_req_summary_v sum,
apps.fnd_concurrent_requests req where req.request_id=sum.request_id and
req.PARENT_REQUEST_ID =
'&parent_concurrent_request_id';

8. Cancelling Concurrent request :

update fnd_concurrent_requests
set status_code='D', phase_code='C'
where request_id=&req_id;

9. Kill sessions program wise

select 'ALTER SYSTEM KILL SESSION '''||sid||','||serial#||''' immediate;' from v$session where
MODULE like '';

10 .Concurrent Request running by SID

SELECT a.request_id,
d.sid as Oracle_SID,
d.serial#,
d.osuser,
d.process,
c.SPID as OS_Process_ID
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
gv$process c,
gv$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND d.sid = &SID;

11. Find out request id from Oracle_Process Id:

select REQUEST_ID,ORACLE_PROCESS_ID,OS_PROCESS_Id from fnd_concurrent_requests


where
ORACLE_PROCESS_ID='&a';

12. Oracle Concurrent Request Error Script (requests which were error ed out)

SELECT a.request_id "Req Id"


,a.phase_code,a.status_code
, actual_start_date
, actual_completion_date
,c.concurrent_program_name || ': ' || ctl.user_concurrent_program_name "program"
FROM APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_concurrent_programs_tl ctl
WHERE a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND a.status_code = 'E'
AND a.phase_code = 'C'
AND actual_start_date > sysdate - 2
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND ctl.concurrent_program_id = c.concurrent_program_id
AND ctl.LANGUAGE = 'US'
ORDER BY 5 DESC;

13. Request submitted by User

SELECT
user_concurrent_program_name,
request_date,
request_id,
phase_code,
status_code
FROM
fnd_concurrent_requests fcr,
fnd_concurrent_programs_tl fcp,
fnd_responsibility_tl fr,
fnd_user fu
WHERE
fcr.CONCURRENT_PROGRAM_ID = fcp.concurrent_program_id
and fcr.responsibility_id = fr.responsibility_id
and fcr.requested_by = fu.user_id
and user_name = '&user'
AND actual_start_date > sysdate - 1
ORDER BY REQUEST_DATE Asc;

14.Concurrent Program enable with trace

col User_Program_Name for a40


col Last_Updated_By for a30
col DESCRIPTION for a30
SELECT A.CONCURRENT_PROGRAM_NAME "Program_Name",
SUBSTR(A.USER_CONCURRENT_PROGRAM_NAME,1,40) "User_Program_Name",
SUBSTR(B.USER_NAME,1,15) "Last_Updated_By",
SUBSTR(B.DESCRIPTION,1,25) DESCRIPTION
FROM APPS.FND_CONCURRENT_PROGRAMS_VL A, APPLSYS.FND_USER B
WHERE A.ENABLE_TRACE='Y'
AND A.LAST_UPDATED_BY=B.USER_ID
Concurrent request running from a very long time
Issue: Concurrent request running from a very long time 
 
Before confirming a concurrent Request to long running we need to
conclude/observe some of the things

•Check the Statistics,History Runs of that program & Based on this timelines we need
to decide the long running Request.
•Check The load on DB node to ensure that High Resource Usage is not
the Main cause.i troubleshoot
•Check DB locks in The Database To Ensure that This Session is not
blocked by any other session.’
•Check wether Same Iteration Of concurrent program is running on
Instance. like if concurrent request is running twise/trice
If we are Happy/resolved the above things and find that we dont have any
problem Then we need to Digg

long running concurrent Request

Step 1 : Get Concurrent Request ID of long running concurrent request


from Application(fronted).

Navigation : Application >> System administrator>>


concurrent>request>

Step 2 : Find session associated with concurrent request .i.e SID

By using the above Query we can get sid,serial#,spid of the concurrent


Request..

SELECT a.request_id, d.sid, d.serial# , c.SPID


FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
v$process c,
v$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND a.request_id = &Request_ID
AND a.phase_code = ‘R’;

In My case The Concurrent Request id is 678901

Output of above query returned

REQUEST_ID SID SERIAL# SPID


———————————————————–
678901 1973 89 1100
Here Conurrent Request id is 678901 & Asoociated Session is 1973.

SPID is the process that Running on DB node Because of This Request..

oracle@acer $ ps -ef|grep -i 1100

oracle1100 1 0 3:30:43 0:03 oracle (LOCAL=NO)

Note : before Using Oradebug make sure that spid shoud exist on DB node..

Step 3 : Enable event 10046 trace with level 12 using oradebug .

Syntax : oradebug setospid SPID

Here SPID is the process id that we are getting from step 2

Coming to My Case
SQL> oradebug setospid 1100

Oracle pid: 79, Unix process pid: 1100, image: oracle@Acer

Step 3.3 : Enable trace for 10046 event with level 12


SQL> oradebug event 10046 trace name context forever, level 12

Step 3.4 : Locate Trace file as


SQL>oradebug tracefile_name

/ORADB/acerdb/9.2.0/admin/DELL_ACER/udump/ACER_ora_1100.trc

Wait for 30 Min to get the Trace file to find the Root Cause

Step 4 : Disable trace if u r thinking that trace is enough to find the root cause..

SQL> oradebug event 10046 trace name context off

Step 5 : Convert raw trace To Understandable tracefile By using tkprof/Traceanalyzer

tkprof ‘ /ORADB/acerdb/9.2.0/admin/DELL_ACER/udump/ACER_ora_1100.trc’ ’
/ORADB/acerdb/9.2.0/admin/DELL_ACER/udump/ACER_ora_1100.txt ’
explain=apps/[apps_passwd] prsela.

Step 6 : Check TKPROF out file to find root cause of slow concurrent request.

 
********************************************************************************
.
Application version: 11.5.10.2 multi-node (4 nodes)
Database: 11g RAC
Scenario:

Business critical concurrent request is running from more than 2 hours which was supposed
to complete within 1 hour.
The standard manager and the manager responsible to execute the critical concurrent
request (custom manager) were overloaded with many requests. The server on which these
managers run had very high server load and all CPU’s were utilized.

After diagnosis, we had to kill few requests which were running from more than 2 hours and
were creating load on the server. These requests were in fact not performing anything and
had gone zombie.

The server load came down and CPU’s available were set free to execute new
requests/processes.

However the business critical request was still running and wasn’t moving ahead at all. The
database session associated was also not executing anything.

Challenge:

Since this being a critical business request, we couldn’t terminate the request coz we had
already lost few hours running it. At the same time the database session also wasn’t
performing any execution and the whole request was not going anywhere even though it
showed running normal status.

Trick:

Not recommended, however can be a life saver at times.

---- Forcibly change the status of the request to pending normal.


---- Kill the database session of the request.

Use the below scripts:

update applsys.fnd_concurrent_requests set phase_code = 'P',


                                           status_code = 'I',
                                           actual_start_date = null,
                                           crm_release_date = null,
                                           controlling_manager=null,
                                           logfile_name = null,
                                           logfile_node_name = null,
                                           outfile_name = null,
                                           outfile_node_name = null,
                                           crm_tstmp = null
where request_id in ('request-id');

             alter system kill session 'sid, serial#, @instance-id';


Hence a new database session will get created as soon as the old one is killed and the
request starts running. Since the server on which the request is supposed to get processed
also had no issues now, the request went through very fast without any issues ;)

Long running Concurrent Requests


1.How to Determine Which Manager Ran a Specific Concurrent Request?
col USER_CONCURRENT_QUEUE_NAME for a100
select b.USER_CONCURRENT_QUEUE_NAME from fnd_concurrent_processes a,
fnd_concurrent_queues_vl b, fnd_concurrent_requests c
where a.CONCURRENT_QUEUE_ID = b.CONCURRENT_QUEUE_ID
and a.CONCURRENT_PROCESS_ID = c.controlling_manager
and c.request_id = ‘&conc_reqid’;
=========================================================================

Long Running Concurrent Request In Oracle :

Looking on how to check long running concurrent request in Oracle Apps 11i or R12?
Here’s the overview of the SQL query script to detect the session information of each
program.

First you need to get the listing of running concurrent request in Oracle Apps 11i or R12.
You can use the SQL query script as below to obtain the list of running request.

SELECT a.request_id
,a.oracle_process_id “SPID”
,frt.responsibility_name
,c.concurrent_program_name || ‘: ‘ || ctl.user_concurrent_program_name
,a.description
,a.ARGUMENT_TEXT
,b.node_name
,b.db_instance
,a.logfile_name
,a.logfile_node_name
,a.outfile_name
,q.concurrent_queue_name
,a.phase_code,a.status_code, a.completion_text
, actual_start_date
, actual_completion_date
, fu.user_name
,(nvl(actual_completion_date,sysdate)-actual_start_date)*1440 mins
,(SELECT avg(nvl(a2.actual_completion_date-a2.actual_start_date,0))*1440 avg_run_time
FROM APPLSYS.fnd_Concurrent_requests a2,
APPLSYS.fnd_concurrent_programs c2
WHERE c2.concurrent_program_id = c.concurrent_program_id
AND a2.concurrent_program_id = c2.concurrent_program_id
AND a2.program_application_id = c2.application_id
AND a2.phase_code || ” = ‘C’) avg_mins
,round((actual_completion_date – requested_start_date),2) * 24 duration_in_hours
FROM APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_concurrent_programs_tl ctl
,apps.fnd_user fu
,apps.FND_RESPONSIBILITY_TL frt
WHERE a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND a.phase_code = ‘R’
AND a.status_code = ‘R’
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND ctl.concurrent_program_id = c.concurrent_program_id
AND a.requested_by = fu.user_id
AND a.responsibility_id = frt.responsibility_id
ORDER BY a.actual_start_date DESC

You can see the request id and other relevant information from the result.
Based on the SPID associated to each running request, query the v$session
orv$session_longops table to see what is the request id doing in the backend.
SELECT b.sid, b.serial#, a.spid, b.program, b.osuser, b.machine,
b.TYPE, b.event, b.action, b.p1text, b.p2text, b.p3text, b.state, c.sql_text,b.logon_time
FROM v$process a, v$session b, v$sqltext c
WHERE a.addr=b.paddr
AND b.sql_hash_value = c.hash_value
AND b.STATUS = ‘ACTIVE’
AND a.spid = ‘11696’
ORDER BY a.spid, c.piece

Replace v$session with gv$session if the database is running on RAC environment. Enable


or set trace if you wish to know more details on the session.
====================================================================

2.Concurrent manager status for a given sid?


col MODULE for a20
col OSUSER for a10
col USERNAME for a10
set num 10
col MACHINE for a20
set lines 200
col SCHEMANAME for a10
select s.sid,s.serial#,p.spid os_pid,s.status, s.osuser,s.username, s.MACHINE,s.MODULE,
s.SCHEMANAME,
s.action from gv$session s, gv$process p WHERE s.paddr = p.addr and s.sid = ‘&oracle_sid’;

3. Find out request id from Oracle_Process Id:


select REQUEST_ID,ORACLE_PROCESS_ID,OS_PROCESS_Id from
apps.fnd_concurrent_requests where
ORACLE_PROCESS_ID=’&a’;

4.To find sid,serial# for a given concurrent request id?


set lines 200
SELECT a.request_id, d.sid, d.serial# ,d.osuser,d.process , c.SPID ,d.inst_id
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
gv$process c,
gv$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND a.request_id = &Request_ID
AND a.phase_code = ‘R’;

5.To find concurrent program name,phase code,status code for a given request id?
SELECT request_id, user_concurrent_program_name,
DECODE(phase_code,’C’,’Completed’,phase_code)
phase_code, DECODE(status_code,’D’, ‘Cancelled’ ,
‘E’, ‘Error’ , ‘G’, ‘Warning’, ‘H’,’On Hold’ , ‘T’, ‘Terminating’, ‘M’, ‘No Manager’ , ‘X’,
‘Terminated’, ‘C’, ‘Normal’, status_code) status_code, to_char(actual_start_date,’dd-mon-
yy:hh24:mi:ss’) Start_Date, to_char(actual_completion_date,’dd-mon-yy:hh24:mi:ss’),
completion_text FROM apps.fnd_conc_req_summary_v WHERE request_id = ‘&req_id’
ORDER BY 6 DESC;
6.To find the sql query for a given concurrent request sid?
select sid,sql_text from gv$session ses, gv$sqlarea sql where
ses.sql_hash_value = sql.hash_value(+) and ses.sql_address = sql.address(+) and
ses.sid=’&oracle_sid’
/

7. To find child requests


set lines 200
col USER_CONCURRENT_PROGRAM_NAME for a40
col PHASE_CODE for a10
col STATUS_CODE for a10
col COMPLETION_TEXT for a20
SELECT sum.request_id,req.PARENT_REQUEST_ID,sum.user_concurrent_program_name,
DECODE
(sum.phase_code,’C’,’Completed’,sum.phase_code) phase_code,
DECODE(sum.status_code,’D’,
‘Cancelled’ ,
‘E’, ‘Error’ , ‘G’, ‘Warning’, ‘H’,’On Hold’ , ‘T’, ‘Terminating’, ‘M’, ‘No Manager’ , ‘X’,
‘Terminated’, ‘C’, ‘Normal’, sum.status_code) status_code, sum.actual_start_date,
sum.actual_completion_date, sum.completion_text FROM apps.fnd_conc_req_summary_v
sum,
apps.fnd_concurrent_requests req where req.request_id=sum.request_id and
req.PARENT_REQUEST_ID =
‘&parent_concurrent_request_id’;

8. Cancelling Concurrent request :


update fnd_concurrent_requests
set status_code=’D’, phase_code=’C’
where request_id=&req_id;
9. Kill sessions program wise
select ‘ALTER SYSTEM KILL SESSION ”’||sid||’,’||serial#||”’ immediate;’ from v$session
where
MODULE like ”;

10 .Concurrent Request running by SID


SELECT a.request_id,
d.sid as Oracle_SID,
d.serial#,
d.osuser,
d.process,
c.SPID as OS_Process_ID
FROM apps.fnd_concurrent_requests a,
apps.fnd_concurrent_processes b,
gv$process c,
gv$session d
WHERE a.controlling_manager = b.concurrent_process_id
AND c.pid = b.oracle_process_id
AND b.session_id=d.audsid
AND d.sid = &SID;

11. Find out request id from Oracle_Process Id:


select REQUEST_ID,ORACLE_PROCESS_ID,OS_PROCESS_Id from fnd_concurrent_requests
where
ORACLE_PROCESS_ID=’&a’;

12. Oracle Concurrent Request Error Script (requests which were error ed out)
SELECT a.request_id “Req Id”
,a.phase_code,a.status_code
, actual_start_date
, actual_completion_date
,c.concurrent_program_name || ‘: ‘ || ctl.user_concurrent_program_name “program”
FROM APPLSYS.fnd_Concurrent_requests a,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_concurrent_programs_tl ctl
WHERE a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND a.status_code = ‘E’
AND a.phase_code = ‘C’
AND actual_start_date > sysdate – 2
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND ctl.concurrent_program_id = c.concurrent_program_id
AND ctl.LANGUAGE = ‘US’
ORDER BY 5 DESC;
13. Request submitted by User
SELECT
user_concurrent_program_name,
request_date,
request_id,
phase_code,
status_code
FROM
fnd_concurrent_requests fcr,
fnd_concurrent_programs_tl fcp,
fnd_responsibility_tl fr,
fnd_user fu
WHERE
fcr.CONCURRENT_PROGRAM_ID = fcp.concurrent_program_id
and fcr.responsibility_id = fr.responsibility_id
and fcr.requested_by = fu.user_id
and user_name = ‘&user’
AND actual_start_date > sysdate – 1
ORDER BY REQUEST_DATE Asc;

14.Concurrent Program enable with trace


col User_Program_Name for a40
col Last_Updated_By for a30
col DESCRIPTION for a30
SELECT A.CONCURRENT_PROGRAM_NAME “Program_Name”,
SUBSTR(A.USER_CONCURRENT_PROGRAM_NAME,1,40) “User_Program_Name”,
SUBSTR(B.USER_NAME,1,15) “Last_Updated_By”,
SUBSTR(B.DESCRIPTION,1,25) DESCRIPTION
FROM APPS.FND_CONCURRENT_PROGRAMS_VL A, APPLSYS.FND_USER B
WHERE A.ENABLE_TRACE=’Y’
AND A.LAST_UPDATED_BY=B.USER_ID

15.Checking which manager is going to execute a program


The below query identifies the manager which will be executing a given program. This
query is based on the specialization rules set for the managers.

SELECT user_concurrent_program_name, user_concurrent_queue_name


FROM apps.fnd_concurrent_programs_tl cp,
apps.fnd_concurrent_queue_content cqc,
apps.fnd_concurrent_queues_tl cq
WHERE cqc.type_application_id(+) = cp.application_id
AND cqc.type_id(+) = cp.concurrent_program_id
AND cqc.type_code(+) = ‘P’
AND cqc.include_flag(+) = ‘I’
AND cp.LANGUAGE = ‘US’
AND cp.user_concurrent_program_name = ‘&USER_CONCURRENT_PROGRAM_NAME’ AND
NVL (cqc.concurrent_queue_id, 0) = cq.concurrent_queue_id
AND NVL (cqc.queue_application_id, 0) = cq.application_id
AND cq.LANGUAGE = ‘US’
 
16.To see all the pending / Running requests per each manager wise 
SELECT request_id, phase_code, status_code, user_name,
user_concurrent_queue_name
FROM apps.fnd_concurrent_worker_requests cwr,
apps.fnd_concurrent_queues_tl cq,
apps.fnd_user fu
WHERE (cwr.phase_code = ‘P’ OR cwr.phase_code = ‘R’)
AND cwr.hold_flag != ‘Y’
AND cwr.requested_start_date <= SYSDATE
AND cwr.concurrent_queue_id = cq.concurrent_queue_id
AND cwr.queue_application_id = cq.application_id
AND cq.LANGUAGE = 'US'
AND cwr.requested_by = fu.user_id
ORDER BY 5

Note: The same information can be seen in Administer Concurrent Manager form for each
manager.

17 .Checking the incompatibilities between the programs


The below query can be used to find all incompatibilities in an application instance.

SELECT a2.application_name, a1.user_concurrent_program_name,


DECODE (running_type,
‘P’, ‘Program’,
‘S’, ‘Request set’,
‘UNKNOWN’
) “Type”,
b2.application_name “Incompatible App”,
b1.user_concurrent_program_name “Incompatible_Prog”,
DECODE (to_run_type,
‘P’, ‘Program’,
‘S’, ‘Request set’,
‘UNKNOWN’
) incompatible_type
FROM apps.fnd_concurrent_program_serial cps,
apps.fnd_concurrent_programs_tl a1,
apps.fnd_concurrent_programs_tl b1,
apps.fnd_application_tl a2,
apps.fnd_application_tl b2
WHERE a1.application_id = cps.running_application_id
AND a1.concurrent_program_id = cps.running_concurrent_program_id
AND a2.application_id = cps.running_application_id
AND b1.application_id = cps.to_run_application_id
AND b1.concurrent_program_id = cps.to_run_concurrent_program_id
AND b2.application_id = cps.to_run_application_id
AND a1.language = ‘US’
AND a2.language = ‘US’
AND b1.language = ‘US’
AND b2.language = ‘US’

The table apps.fnd_concurrent_program_serial has the information about incompatibilities.

18 .How to find if module is installed or not in Oracle Apps


We have 3 ways to find out if a module is installed in oracle apps
1 We can run the following script
cd $AD_TOP/sql/adutconf.sql
In this script, there is a section->”Product Installation Status, Version Info and Patch Level”
In this, status of installed means the product is installed.

2  Through OAM
In oracle apps, navigate to
OAM>Site Map>/License Manager>Reports>Licensed Products
Here filter the products by  using “Licensed”. These are the licensed and installed products
in oracle apps.

3 Using a sql query->

We can use the following query


SELECT a.application_name,a.product_code,
DECODE (b.status, ‘I’, ‘Installed’, ‘S’, ‘Shared’, ‘N/A’) status,
patch_level
FROM apps.fnd_application_vl a,
apps.fnd_product_installations b
WHERE a.application_id = b.application_id
and b.status=’I’
order by product_code asc;
19.How to Find out Product Installations and Patch Set level in Oracle Applications 11i ?
Use Following Query to find out Product Installation
SELECT application_name “Application Name”,
SUBSTR (application_short_name, 1, 10) “Short Name”,
RPAD (DECODE (fpi.status, ‘I’, ‘Installed’, ‘S’, ‘Shared Install’, ‘N’, ‘Not Installed’ ), 14, ‘ ‘ ) “Install
Status”, SUBSTR (patch_level, 1, 12) “Patch Level”, fa.BASEPATH “Basepath”
FROM fnd_product_installations fpi,
fnd_application fa,
fnd_application_tl fat
WHERE fa.application_id = fpi.application_id
AND fa.application_id = fat.application_id
ORDER BY fpi.application_id;

SELECT application_name,SUBSTR (application_short_name, 1, 10) “Short Name”,SUBSTR


(patch_level, 1, 12) “Patch Level”, fa.BASEPATH “Basepath” FROM fnd_product_installations
fpi,fnd_application fa,fnd_application_tl fat
WHERE fa.application_id = fpi.application_id  AND fa.application_id = fat.application_id order by
fa.BASEPATH;
Select product_version,patch_level from fnd_product_installations where patch_level like
‘%AP%’;

select BASEPATH from fnd_application order by BASEPATH;

20. How to Find Environment Variables from database table – Oracle E-


Business Suite

Are you running Oracle E-Business Suite (EBS) / Applications and want to get an operating
system level environment variable value from a database table, for example for use in
PL/SQL? Or perhaps to default a concurrent program parameter? Didn’t think environment
variables were stored in the database?
Try out out this query that shows you $FND_TOP:

select value from fnd_env_context where variable_name = ‘FND_TOP’ and


concurrent_process_id = ( select max(concurrent_process_id) from fnd_env_context );
VALUE ——————————————————————————–
/d01/oracle/VIS/apps/apps_st/appl/fnd/12.0.0
——————————————————————————-  Or
Did you want to find out the Product “TOP” directories e.g the full directory path values from
fnd_appl_tops under APPL_TOP?
col variable_name format a15 col value format a64 select variable_name, value from
fnd_env_context where variable_name like ‘%\_TOP’ escape ‘\’ and concurrent_process_id = (
select max(concurrent_process_id) from fnd_env_context ) order by 1; VARIABLE_NAME
VALUE ————— —————————————————————- AD_TOP
/d01/oracle/VIS/apps/apps_st/appl/ad/12.0.0 AF_JRE_TOP
/d01/oracle/VIS/apps/tech_st/10.1.3/appsutil/jdk/jre AHL_TOP
/d01/oracle/VIS/apps/apps_st/appl/ahl/12.0.0 AK_TOP
/d01/oracle/VIS/apps/apps_st/appl/ak/12.0.0 ALR_TOP
/d01/oracle/VIS/apps/apps_st/appl/alr/12.0.0 AME_TOP
/d01/oracle/VIS/apps/apps_st/appl/ame/12.0.0 AMS_TOP
/d01/oracle/VIS/apps/apps_st/appl/ams/12.0.0 AMV_TOP
/d01/oracle/VIS/apps/apps_st/appl/amv/12.0.0 AMW_TOP
/d01/oracle/VIS/apps/apps_st/appl/amw/12.0.0 APPL_TOP
/d01/oracle/VIS/apps/apps_st/appl AP_TOP /d01/oracle/VIS/apps/apps_st/appl/ap/12.0.0
AR_TOP /d01/oracle/VIS/apps/apps_st/appl/ar/12.0.0 …  21.How to find  the full directory path
to $APPLTMP?
select value from fnd_env_context where variable_name = ‘APPLTMP’ and
concurrent_process_id = ( select max(concurrent_process_id) from fnd_env_context );
VALUE ——————————————————————————–
/d01/oracle/VIS/inst/apps/VIS_demo/appltmp NB: These queries assume your concurrent
managers are running!
22. Script to Get OS user name with terminal name

REM: Script to Get Os user name with terminal name


REM:*****************************************
REM: NOTE: PLEASE TEST THIS SCRIPT BEFORE USE.
REM: Author will not be responsible for any damage that may be cause by this script.
REM:*****************************************

SELECT
DBA_USERS.USERNAME USERNAME,
DECODE(V$SESSION.USERNAME, NULL, ‘NOT CONNECTED’, ‘CONNECTED’) STATUS,
NVL(OSUSER, ‘-‘) OSUSER,
NVL(TERMINAL,’-‘) TERMINAL,
SUM(DECODE(V$SESSION.USERNAME, NULL, 0,1)) SESSIONS
FROM
DBA_USERS, V$SESSION
WHERE DBA_USERS.USERNAME = V$SESSION.USERNAME (+)
GROUP BY
DBA_USERS.USERNAME,
DECODE(V$SESSION.USERNAME, NULL, ‘NOT CONNECTED’, ‘CONNECTED’),
OSUSER,
TERMINAL
ORDER BY 1 ;

23 .Query to Identify the Concurrent Program for Long time…………………

Step1 :  Run the first query ,  this will list all the programs that currently running in Application.
Take the SID and use it in the second query.
SELECT
f.user_name
,a.request_id “Req Id”
,a.concurrent_program_id “Prg Id”
,a.RESPONSIBILITY_ID Responsibility
,a.phase_code,a.status_code
,b.os_process_id “OS”
,vs.sid
,vs.serial# “Serial#”
,vp.spid
,TO_CHAR(request_date,’DD-MON-YY hh24:mi:ss’) request_date
,(NVL(a.actual_completion_date,SYSDATE)-a.actual_start_date)*1440 “Time”
,c.concurrent_program_name||’ – ‘||c2.user_concurrent_program_name “Program”
FROM APPLSYS.fnd_Concurrent_requests a
,APPLSYS.fnd_concurrent_processes b
,applsys.fnd_concurrent_queues q
,APPLSYS.fnd_concurrent_programs_tl c2
,APPLSYS.fnd_concurrent_programs c
,APPLSYS.fnd_user f
,v$session vs
,v$process vp
WHERE
a.controlling_manager = b.concurrent_process_id
AND a.concurrent_program_id = c.concurrent_program_id
AND a.program_application_id = c.application_id
AND c2.concurrent_program_id = c.concurrent_program_id
AND c2.application_id = c.application_id
AND a.phase_code IN (‘I’,’P’,’R’,’T’)
AND a.requested_by = f.user_id
AND b.queue_application_id = q.application_id
AND b.concurrent_queue_id = q.concurrent_queue_id
AND c2.LANGUAGE = ‘US’
AND a.oracle_process_id = vp.spid
AND vs.paddr = vp.addr
ORDER BY 9
Step 2 : Get Sid from step1 and Keep on executing this query in SQL. This query will show the
currently running SQL in the DB, as your concurrent is submitted and running. You can now find
out the exact query  ( select / insert / update ) which is actually taking time in your concurrent
program.
SELECT sql_text FROM v$sqltext t,v$session s
WHERE t.ADDRESS = s.SQL_ADDRESS
AND t.HASH_VALUE = s.SQL_HASH_VALUE
AND s.sid = 100 – Get this value from step1
ORDER BY PIECE
 Step 3 :
————
The following query finds total run-time (in minutes) for a concurrent program. Thus, with a
little modification to this query, you can track which concurrent programs take (very) long
time to complete, and may need performance tuning.
Change the concurrent program name (tl.user_concurrent_program_name, see below)
according to your search criteria. In this example, my concurrent program is “Autoinvoice
Import Program”. You can also uncomment the “&Start_Date” line to get the list for a
specific date.

——————————————————————————-
— Query to find runtime for a concurrent program
——————————————————————————-
SELECT /*+ rule */
rq.parent_request_id                   “Parent Req. ID”,

rq.request_id                          “Req. ID”,

tl.user_concurrent_program_name        “Program Name”,

rq.actual_start_date                   “Start Date”,

rq.actual_completion_date              “Completion Date”,


ROUND((rq.actual_completion_date –
rq.actual_start_date) * 1440, 2)   “Runtime (in Minutes)”

FROM applsys.fnd_concurrent_programs_tl  tl,
applsys.fnd_concurrent_requests     rq

WHERE tl.application_id        = rq.program_application_id
AND tl.concurrent_program_id = rq.concurrent_program_id
AND tl.LANGUAGE              = USERENV(‘LANG’)
AND rq.actual_start_date IS NOT NULL
AND rq.actual_completion_date IS NOT NULL
AND tl.user_concurrent_program_name = ‘Autoinvoice Import Program’  —
— AND TRUNC(rq.actual_start_date) = ‘&start_date’  — uncomment this for a specific date
ORDER BY rq.request_id DESC;
*************************************************************

24 .Script to reset Oracle Apps front end User ID Password

Here is a  sample anonymous PL/SQL block which will reset the Oracle Apps frontend
password for a given user from backend

DECLARE
flag_value BOOLEAN;
BEGIN
flag_value :=
fnd_user_pkg.changepassword(username=> ‘NKUMAR2’
,newpassword => ‘welcome1’);
IF flag_value
THEN
DBMS_OUTPU.PUT_LINE(‘The password reset successfully’);
ELSE
DBMS_OUTPUT.PUT_LINE(‘The password reset has failed’);
END IF;

END;
/
COMMIT;

25 .Checking the duplicated schedules of the same program with the same arguments
The below query can be used to check the duplicated schedule of the same program with
the same arguments. This can be used to alert the users to cancel these duplicated
schedules.

Note: This query will return even though the request was submitted using a different
responsibility.
SELECT request_id, NAME, argument_text, user_name
FROM (SELECT cr.request_id,
DECODE (cp.user_concurrent_program_name,
‘Report Set’, ‘Report Set:’ || cr.description,
cp.user_concurrent_program_name
) NAME,
argument_text, fu.user_name
FROM apps.fnd_concurrent_programs_tl cp,
apps.fnd_concurrent_requests cr,
apps.fnd_user fu
WHERE cp.application_id = cr.program_application_id
AND cp.concurrent_program_id = cr.concurrent_program_id
AND cr.requested_by = fu.user_id
AND cr.phase_code = ‘P’
AND cr.requested_start_date > SYSDATE
AND cp.LANGUAGE = ‘US’
AND fu.user_name NOT LIKE ‘PPG%’) t1
WHERE EXISTS (
SELECT 1
FROM (SELECT cr.request_id,
DECODE (cp.user_concurrent_program_name,
‘Report Set’, ‘Report Set:’
|| cr.description,
cp.user_concurrent_program_name
) NAME,
argument_text, fu.user_name
FROM apps.fnd_concurrent_programs_tl cp,
apps.fnd_concurrent_requests cr,
apps.fnd_user fu
WHERE cp.application_id = cr.program_application_id
AND cp.concurrent_program_id =
cr.concurrent_program_id
AND cr.requested_by = fu.user_id
AND cr.phase_code = ‘P’
AND cr.requested_start_date > SYSDATE
AND cp.LANGUAGE = ‘US’
AND fu.user_name NOT LIKE ‘PPG%’) t2
WHERE t1.NAME = t2.NAME
AND t1.argument_text = t2.argument_text
AND t1.user_name = t2.user_name
GROUP BY NAME, argument_text, user_name
HAVING COUNT (*) > 1)
ORDER BY user_name, NAME;

 
26.Average pending time per request

This is a very useful query to check the performance of the concurrent


managers.

Average pending time for a request is calculated like below:


(“Highest of Requested_start_date or Date_submitted” – Actual_start_date ) / Total requests

A Request can be in Pending state for variety of reasons like conflict with other requests,
improperly tuned managers (sleep seconds / cache size / number of managers etc)

We can schedule this script to gather data regularly for historical analysis as we normally
purge the concurrent requests regularly.

SELECT TO_CHAR (actual_start_date, ‘DD-MON-YYYY’) DAY,


concurrent_queue_name,
(SUM ( ( actual_start_date
– (CASE
WHEN requested_start_date > request_date
THEN requested_start_date
ELSE request_date
END
)
)
* 24
* 60
* 60
)
)
/ COUNT (*) “Wait_Time_per_Req_in_Secs”
FROM apps.fnd_concurrent_requests cr,
apps.fnd_concurrent_processes fcp,
apps.fnd_concurrent_queues fcq
WHERE cr.phase_code = ‘C’
AND cr.actual_start_date IS NOT NULL
AND cr.requested_start_date IS NOT NULL
AND cr.controlling_manager = fcp.concurrent_process_id
AND fcp.queue_application_id = fcq.application_id
AND fcp.concurrent_queue_id = fcq.concurrent_queue_id
GROUP BY TO_CHAR (actual_start_date, ‘DD-MON-YYYY’), concurrent_queue_name
ORDER BY 2;

Note: Depending on the purging schedules some requests might miss if the corresponding
data in fnd_concurrent_processes is purged.
27.Script to Monitor Concurrent requests average run time

Do you need a daily  report which would give an average run time of all concurrent
requests in your environment?

So you would know which concurrent request is taking longer time and on which day:
The below script gives an average run time for all concurrent requests for the current day,
previous day, day before yesterday and for the whole week:

set pagesize 500


set echo off
set feedback off
set linesize 200
col USER_CONCURRENT_PROGRAM_NAME for a75
col wkly_Time Heading ‘Weekly Run | Time | Avg |(In Minutes) ‘
col dbydy_Tim Heading ‘Day Before|Yesterday | Run Time | Avg |(In Minutes) ‘
col ydy_Tim Heading ‘Yesterday | Run Time | Avg |(In Minutes) ‘
col tdy_Tim Heading ‘Today | Run Time | Avg |(In Minutes) ‘
col tdy_Tim Heading &_DATE
select  wkly.user_concurrent_program_name, wkly.wkly_time ,
to_char(nvl(dbydy.dbydy_time,’     Not Run’))  Dbydy_tim,to_char(nvl(ydy.ydy_time,’     Not
Run’))  ydy_tim,to_char(nvl(tdy.tdy_time,’     Not Run’))  tdy_tim
FROM
(SELECT user_concurrent_program_name,
to_char(avg(round((actual_completion_date- actual_start_date)*24*60)),’99999999.99′)
wkly_time
FROM apps.fnd_conc_req_summary_v
WHERE nvl(actual_start_date,sysdate) >= (sysdate-7)
AND phase_code=’C’ and status_code  in (‘C’,’G’)
group by user_concurrent_program_name) wkly,
(SELECT user_concurrent_program_name,
to_char(avg(round((actual_completion_date- actual_start_date)*24*60)),’99999999.99′)
dbydy_time
FROM apps.fnd_conc_req_summary_v
WHERE trunc(nvl(actual_start_date,sysdate)) = trunc((sysdate-2))
AND phase_code=’C’ and status_code  in (‘C’,’G’)
group by user_concurrent_program_name ) dbydy,
(SELECT user_concurrent_program_name,
to_char(avg(round((actual_completion_date- actual_start_date)*24*60)),’99999999.99′)
ydy_time
FROM apps.fnd_conc_req_summary_v
WHERE trunc(nvl(actual_start_date,sysdate)) = trunc((sysdate-1))
AND phase_code=’C’ and status_code  in (‘C’,’G’)
group by user_concurrent_program_name ) ydy,
(SELECT user_concurrent_program_name,
to_char(avg(round((actual_completion_date- actual_start_date)*24*60)),’99999999.99′)
tdy_time
FROM apps.fnd_conc_req_summary_v
WHERE trunc(nvl(actual_start_date,sysdate)) = trunc((sysdate))
AND phase_code=’C’ and status_code  in (‘C’,’G’)
group by user_concurrent_program_name ) tdy
WHERE wkly.user_concurrent_program_name =dbydy.user_concurrent_program_name (+)
AND   dbydy.user_concurrent_program_name = ydy.user_concurrent_program_name (+)
AND   ydy.user_concurrent_program_name  = tdy.user_concurrent_program_name (+)
order by wkly_time desc;

28. Find currently spooling temp file from request

col outfile format a30 col logfile format a30 select cp.plsql_dir || ‘/’ || cp.plsql_out outfile ,
cp.plsql_dir || ‘/’ || cp.plsql_log logfile from apps.fnd_concurrent_requests cr ,
apps.fnd_concurrent_processes cp where cp.concurrent_process_id =
cr.controlling_manager and cr.request_id = &request_id; OUTFILE LOGFILE
—————————— —————————— /usr/tmp/PROD/o0068190.tmp
/usr/tmp/PROD/l0068190.tmp REM Now tail log file on database node to see where it is at,
near realtime REM tail -f /usr/tmp/l0068190.tmp

29.Currently held locks per concurrent request

set lines 150 col object_name format a32 col mode_held format a15 select /*+ ordered */
fcr.request_id , object_name , object_type , decode( l.block , 0, ‘Not Blocking’ , 1, ‘Blocking’ ,
2, ‘Global’ ) status , decode( v.locked_mode , 0, ‘None’ , 1, ‘Null’ , 2, ‘Row-S (SS)’ , 3, ‘Row-X
(SX)’ , 4, ‘Share’ , 5, ‘S/Row-X (SSX)’ , 6, ‘Exclusive’ , to_char(lmode) ) mode_held from
apps.fnd_concurrent_requests fcr , gv$process pro , gv$session sess , gv$locked_object v ,
gv$lock l , dba_objects d where fcr.phase_code = ‘R’ and fcr.oracle_process_id = pro.spid (+)
and pro.addr = sess.paddr (+) and sess.sid = v.session_id (+) and v.object_id = d.object_id (+)
and v.object_id = l.id1 (+) ; REQUEST_ID OBJECT_NAME OBJECT_TYPE STATUS MODE_HELD
———- ——————————– ——————- ———— ————— 1070780
VIRTUATE_GL_OLAP_REFRESH TABLE Not Blocking Exclusive

——————————————————————————-
— Query to find concurrent request status related information
——————————————————————————-
SELECT fu.user_name                           “User ID”,
frt.responsibility_name                “Responsibility Used”,

fcr.request_id                         “Request ID”,

fcpt.user_concurrent_program_name      “Concurrent Program Name”,

DECODE(fcr.phase_code,
‘C’,  ‘Completed’,

‘P’,  ‘Pending’,
‘R’,  ‘Running’,

‘I’,  ‘Inactive’,

fcr.phase_code)                 “Phase”,

DECODE(fcr.status_code,
‘A’,  ‘Waiting’,

‘B’,  ‘Resuming’,

‘C’,  ‘Normal’,

‘D’,  ‘Cancelled’,

‘E’,  ‘Error’,

‘F’,  ‘Scheduled’,

‘G’,  ‘Warning’,

‘H’,  ‘On Hold’,

‘I’,  ‘Normal’,

‘M’,  ‘No Manager’,

‘Q’,  ‘Standby’,

‘R’,  ‘Normal’,

‘S’,  ‘Suspended’,

‘T’,  ‘Terminating’,

‘U’,  ‘Disabled’,

‘W’,  ‘Paused’,

‘X’,  ‘Terminated’,

‘Z’,  ‘Waiting’,
fcr.status_code)                “Status”,

fcr.request_date                       “Request Date”,

fcr.requested_start_date               “Request Start Date”,

fcr.hold_flag                          “Hold Flag”,

fcr.printer                            “Printer Name”,

fcr.parent_request_id                  “Parent Request ID”

— fcr.number_of_arguments,
— fcr.argument_text,
— fcr.logfile_name,
— fcr.outfile_name
FROM fnd_user                    fu,
fnd_responsibility_tl       frt,

fnd_concurrent_requests     fcr,

fnd_concurrent_programs_tl  fcpt

WHERE fu.user_id                 =  fcr.requested_by
AND fcr.concurrent_program_id  =  fcpt.concurrent_program_id
AND fcr.responsibility_id      =  frt.responsibility_id
AND frt.LANGUAGE               =  USERENV(‘LANG’)
AND fcpt.LANGUAGE              =  USERENV(‘LANG’)
— AND fcr.request_id = 7137350  —
AND fcpt.user_concurrent_program_name = ‘Autoinvoice Import Program’  —
ORDER BY fcr.request_date DESC;
 

30) CONCURRENT REQUEST MONITORING QUERIES

SQL TO FIND OUT CONCURRENT REQUESTS CURRENTLY RUNNING:


**********************************************************
set lines 180
set pages 1000
set verify off
undef spid
column req_id format 99999999999
column OPID format a10
column PPID format a8
column SPID format a8
column ST_CD format a1
column ph_cd format a1
column CNAME format a30
column event format a15
column user_name format a10
column program format a8
column serial# format 999999
column sid format 9999
column username format a8
select a.request_id “REQ_ID”,a.oracle_process_id “OPID”,a.os_process_id
“PPID”,
e.user_concurrent_program_name “CNAME”,
f.user_name,a.status_code “ST_CD”,a.phase_code “PH_CD”, b.username,b.sid,
b.serial#,b.program,g.event,
to_char(a.ACTUAL_START_DATE,’MON-DD-HH-MI-SS’) START_DATE,
to_char(a.ACTUAL_COMPLETION_DATE,’MON-DD-HH-MI-SS’) COMPL_DATE
from apps.fnd_concurrent_requests a,(select c.username,c.sid,c.serial#,
c.program,d.spid from v$session c, v$process d
where c.paddr=d.addr) b,
apps.fnd_concurrent_programs_tl e,
apps.fnd_user f,
v$session_wait g
where a.oracle_process_id=b.spid
and a.concurrent_program_id=e.concurrent_program_id
and e.language=’US’
and a.requested_by=f.user_id
and b.sid=g.sid
and a.status_code=’R’
and a.phase_code=’R’;
********************************************************
Retrieve a list of all responsibilities.
Parameters
None
*//
SELECT
(SELECT application_short_name
FROM fnd_application fa
WHERE fa.application_id = frt.application_id)
application
, frt.responsibility_id
, frt.responsibility_name
FROM apps.fnd_responsibility_tl frt;

//*
2. Menus Listing
Purpose/Description:
To see the Menus associated with a given responsibility
Parameters
responsibility_id that you can retrieve from query nr 1 (Responsibilities Listing)
*//
SELECT DISTINCT
a.responsibility_name
, c.user_menu_name
FROM
apps.fnd_responsibility_tl a
, apps.fnd_responsibility b
, apps.fnd_menus_tl c
, apps.fnd_menus d
, apps.fnd_application_tl e
, apps.fnd_application f
WHERE
a.responsibility_id(+) = b.responsibility_id
AND a.responsibility_id = 50103
AND b.menu_id = c.menu_id
AND b.menu_id = d.menu_id
AND e.application_id = f.application_id
AND f.application_id = b.application_id
AND a.LANGUAGE = ‘US’;

//*
3. Submenu And Function Listing
Purpose/Description:
By using this query you can check function and submenus attached to a specific menu
Parameters
User_menu_name that you can get by running query 2 (Menu Listing)
*//
SELECT
c.prompt
, c.description
FROM
apps.fnd_menus_tl a
, fnd_menu_entries_tl c
WHERE
a.menu_id = c.menu_id
AND a.user_menu_name = ‘Navigator Menu – System Administrator GUI’;

//*
4.User and Assigned Responsibility Listing
Purpose/Description:
You can use this query to check responsibilities assigned to users.
Parameters
None
*//
SELECT UNIQUE
u.user_id
, SUBSTR (u.user_name, 1, 30) user_name
, SUBSTR (r.responsibility_name, 1, 60) responsiblity
, SUBSTR (a.application_name, 1, 50) application
FROM
fnd_user u
, fnd_user_resp_groups g
, fnd_application_tl a
, fnd_responsibility_tl r
WHERE
g.user_id(+) = u.user_id
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
ORDER BY
SUBSTR (user_name, 1, 30)
, SUBSTR (a.application_name, 1, 50)
, SUBSTR (r.responsibility_name, 1, 60);

//*
5. Responsibility and assigned request group listing
Purpose/Description:
To find responsibility and assigned request groups.
Every responsibility contains a request group (The request group is basis of submitting requests)
Parameters
None
*//
SELECT
responsibility_name responsibility
, request_group_name
, frg.description
FROM
fnd_request_groups frg
, fnd_responsibility_vl frv
WHERE
frv.request_group_id = frg.request_group_id
ORDER BY responsibility_name

//*
6. Profile option with modification date and user
Purpose/Description:
Query that can be used to audit profile options.
Parameters
None
*//
SELECT
t.user_profile_option_name
, profile_option_value
, v.creation_date
, v.last_update_date
, v.creation_date – v.last_update_date “Change Date”
, (SELECT UNIQUE user_name
FROM fnd_user
WHERE user_id = v.created_by) “Created By”
, (SELECT user_name
FROM fnd_user
WHERE user_id = v.last_updated_by) “Last Update By”
FROM
fnd_profile_options o
, fnd_profile_option_values v
, fnd_profile_options_tl t
WHERE
o.profile_option_id = v.profile_option_id
AND o.application_id = v.application_id
AND start_date_active = SYSDATE
AND o.profile_option_name = t.profile_option_name
AND level_id = 10001
AND t.LANGUAGE IN (SELECT language_code
FROM fnd_languages
WHERE installed_flag = ‘B’
UNION
SELECT nls_language
FROM fnd_languages
WHERE installed_flag = ‘B’)
ORDER BY user_profile_option_name;

//*
7. Forms personalization Listing
Purpose/Description:
To get modified profile options.
Personalization is a feature available in 11.5.10.X.
Parameters
None
*//
SELECT
ffft.user_function_name “User Form Name”
, ffcr.SEQUENCE
, ffcr.description
, ffcr.rule_type
, ffcr.enabled
, ffcr.trigger_event
, ffcr.trigger_object
, ffcr.condition
, ffcr.fire_in_enter_query
, (SELECT user_name
FROM fnd_user fu
WHERE fu.user_id = ffcr.created_by) “Created By”
FROM
fnd_form_custom_rules ffcr
, fnd_form_functions_vl ffft
WHERE ffcr.ID = ffft.function_id
ORDER BY 1;
//*
8. Patch Level Listing
Purpose/Description:
Query that can be used to view the patch level status of all modules
Parameters
None
*//
SELECT
a.application_name
, DECODE (b.status, ‘I’, ‘Installed’, ‘S’, ‘Shared’, ‘N/A’) status
, patch_level
FROM
apps.fnd_application_vl a
, apps.fnd_product_installations b
WHERE
a.application_id = b.application_id;

//*
9. Request attached to responsibility listing
Purpose/Description:
To see all requests attached to a responsibility
Parameters
None
*//
SELECT
responsibility_name
, frg.request_group_name
, fcpv.user_concurrent_program_name
, fcpv.description
FROM
fnd_request_groups frg
, fnd_request_group_units frgu
, fnd_concurrent_programs_vl fcpv
, fnd_responsibility_vl frv
WHERE
frgu.request_unit_type = ‘P’
AND frgu.request_group_id = frg.request_group_id
AND frgu.request_unit_id = fcpv.concurrent_program_id
AND frv.request_group_id = frg.request_group_id
ORDER BY responsibility_name;

//*
10. Request listing application wise
Purpose/Description:
View all request types application wise
Parameters
None
*//
SELECT
fa.application_short_name
, fcpv.user_concurrent_program_name
, description
, DECODE (fcpv.execution_method_code
,’B’, ‘Request Set Stage Function’
,’Q’, ‘SQL*Plus’
,’H’, ‘Host’
,’L’, ‘SQL*Loader’
,’A’, ‘Spawned’
,’I’, ‘PL/SQL Stored Procedure’
,’P’, ‘Oracle Reports’
,’S’, ‘Immediate’
,fcpv.execution_method_code) exe_method
, output_file_type
, program_type
, printer_name
, minimum_width
, minimum_length
, concurrent_program_name
, concurrent_program_id
FROM
fnd_concurrent_programs_vl fcpv
, fnd_application fa
WHERE
fcpv.application_id = fa.application_id
ORDER BY description

//*
11. Count Reports per module
Purpose/Description:
To Count Reports
Parameters
None
*//
SELECT
fa.application_short_name
, DECODE (fcpv.execution_method_code
,’B’, ‘Request Set Stage Function’
,’Q’, ‘SQL*Plus’
,’H’, ‘Host’
,’L’, ‘SQL*Loader’
,’A’, ‘Spawned’
,’I’, ‘PL/SQL Stored Procedure’
,’P’, ‘Oracle Reports’
,’S’, ‘Immediate’
,fcpv.execution_method_code) exe_method
, COUNT (concurrent_program_id) COUNT
FROM
fnd_concurrent_programs_vl fcpv
, fnd_application fa
WHERE
fcpv.application_id = fa.application_id
GROUP BY
fa.application_short_name
, fcpv.execution_method_code
ORDER BY 1;

//*
12. Request Status Listing
Purpose/Description:
This query returns report/request processing time
Parameters
None
*//
SELECT
f.request_id
, pt.user_concurrent_program_name user_concurrent_program_name
, f.actual_start_date actual_start_date
, f.actual_completion_date actual_completion_date
, floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)
‘ HOURS ‘
floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) –
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)
‘ MINUTES ‘
round((((f.actual_completion_date-f.actual_start_date)*24*60*60) –
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600 –
(floor((((f.actual_completion_date-f.actual_start_date)*24*60*60) –
floor(((f.actual_completion_date-f.actual_start_date)*24*60*60)/3600)*3600)/60)*60) ))
‘ SECS ‘ time_difference
, DECODE(p.concurrent_program_name
,’ALECDC’
,p.concurrent_program_name’[‘
f.description’]‘
,p.concurrent_program_name) concurrent_program_name
, decode(f.phase_code
,’R’,’Running’
,’C’,’Complete’
,f.phase_code) Phase
, f.status_code
FROM
apps.fnd_concurrent_programs p
, apps.fnd_concurrent_programs_tl pt
, apps.fnd_concurrent_requests f
WHERE
f.concurrent_program_id = p.concurrent_program_id
AND f.program_application_id = p.application_id
AND f.concurrent_program_id = pt.concurrent_program_id
AND f.program_application_id = pt.application_id
AND pt.language = USERENV(‘Lang’)
AND f.actual_start_date is not null
ORDER by f.actual_completion_date-f.actual_start_date desc;

//*
13. User and responsibility listing
Purpose/Description:
Check responsibilities assigned to users
Parameters
None
*//
SELECT UNIQUE
u.user_id
, SUBSTR (u.user_name, 1, 30) user_name
, SUBSTR (r.responsibility_name, 1, 60) responsiblity
, SUBSTR (a.application_name, 1, 50) application
FROM
fnd_user u
, fnd_user_resp_groups g
, fnd_application_tl a
, fnd_responsibility_tl r
WHERE g.user_id(+) = u.user_id
AND g.responsibility_application_id = a.application_id
AND a.application_id = r.application_id
AND g.responsibility_id = r.responsibility_id
–AND a.application_name like ‘%Order Man%’
ORDER BY SUBSTR (user_name, 1, 30),
SUBSTR (a.application_name, 1, 50),
SUBSTR (r.responsibility_name, 1, 60)

//*
14. Applied Patch Listing
Purpose/Description:
Check Current Applied Patches
Parameters
None
*//
SELECT
patch_name
, patch_type
, maint_pack_level
, creation_date
FROM applsys.ad_applied_patches
ORDER BY creation_date DESC

15. How to check the System Administarator responsiblity for the users in ORACLE EBS ?
set lines 2000
set pages 5000
col USER_NAME for a45
Select b.user_name, c.responsibility_name, a.START_DATE, a.END_DATE
from fnd_user_resp_groups_direct a, fnd_user b, fnd_responsibility_tl c
where a.user_id = b.user_id
and a.responsibility_id = c.responsibility_id
and c.responsibility_name=’System Administrator’

How to Kill Long Running Concurrent Job in R12


Step 1) Find SID and Serial Number for Concurrent Job

SELECT a.request_id, d.sid, d.serial# ,d.osuser,


1 d.process , c.SPID ,d.inst_id
2 FROM apps.fnd_concurrent_requests a,
3 apps.fnd_concurrent_processes b,
4 gv$process c,
5 gv$session d
6 WHERE a.controlling_manager = b.concurrent_process_id
7 AND c.pid = b.oracle_process_id
8 AND b.session_id=d.audsid
9 AND a.request_id = 2063673
10 AND a.phase_code = 'R';
11

Step 2) Kill the long running session

--ALTER SYSTEM KILL SESSION 'SID, serial#' IMMEDIATE;


1 ALTER SYSTEM KILL SESSION '523, 4965' IMMEDIATE;
2

Step 3) Update fnd_concurrent_requests table to mark the request in error and completed

1 update fnd_concurrent_requests
2 set status_code='X', phase_code='C'
3 where request_id=2063673;
4
5 commit;
6
7 update fnd_concurrent_requests
8 set status_code='E', phase_code='C'
9 where request_id=2063673;
10
11 commit;
12

If this does not solve your problem then try restarting Standard Concurrent Manager and
Output Post Processor Concurrent Manager.

How to Analyze Long Running or Pending Concurrent


Requests jobs
a)
1.Run the script for any concurrent request which is going into
pending/running status and upload the output to SR.

Note 134033.1 ANALYZEPENDING.sql Script for Analyzing all Pending Requests


or
Note 134035.1 ANALYZEREQ.SQL – Detailed Analysis of One Concurrent Request
2. Verify the incompatibilities from the concurrent program definition
screen.

Sysadmin -> Concurrent -> Program -> Define ->


Query on the Program name
> Incompatibilities

See
How To Troubleshoot Only One Concurrent Job Running at a Time Note 1504743.1
II)
a. Check the value for the following profile options:

1. ‘Concurrent:Active Request Limit’


2. ‘Concurrent:Sequential Requests’
3. ‘Concurrent:Hold Requests’

They can affect the value of pending requests.


See
Note 740425.1 Active Request Limit Value at Site Level Incorrectly Overrides User Level
Setting
Note 372798.1 Concurrent Manager Only Processing One Request At A Time
b. Make sure no programs marked as run alone.

Reference From Oracle SR

Steps to tune long running concurrent request in oracle apps


 Step1:- Go to the Concurrent Program which is taking long Time and Enable the Trace for this
Concurrent Program.

System Administrator ==>Concurrent > Program > Define

Query the Concurrent Program which is taking long time.

Select the Enable Trace Checkbox


Turn On Tracing

Step3:- Go to the Oracle Profiles to Allow Debugging

System Administrator ==>Profiles > System

Query Profile "Concurrent: Allow Debugging" and set to yes.

Step4:- Go to the responsibility to run the Concurrent Program in oracle apps.

 In the Submit Request Screen click on Debug Options (B)

 Select the Checkbox for SQL Trace

Step5:- Copy the Concurrent Request Id for this Concurrent Program and Find the Log Trace File
for this Concurrent Request

SELECT request_id,oracle_process_id 'Trace id',


req.enable_trace,
dest.VALUE
 || '/'
 || LOWER (dbnm.VALUE)
 || '_ora_'
|| oracle_process_id
 || '.trc' 'Trace Name',
prog.user_concurrent_program_name ,

execname.execution_file_name 'File Name'


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 = :p_request_id
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;
 
Step 5:- Raw trace file to format the file using TKPROF.
 
$tkprof raw_trace_file.trc output_file explain=apps/ sort=(exeela,fchela) sys=no
 
Where: raw_trace_file.trc: Name of trace file
output_file: tkprof out file
explain: This option provides the explain plan for the sql statements
sort: his provides the sort criteria in which all sql statements will be sorted. This will bring the bad
sql at the top of the outputfile.
sys=no:Disables sql statements issued by user SYS
Concurrent request running longer than expected, Concurrent request is not
picking jobs , Concurrent request is not fetching/executing data etc these are very
frequent issue we get from development team.

Based on my experience I will share what all you need to check in Oracle Database
and Application in order to narrow down the issue. As soon as issue reported by the
application team DBA jumps into the database and application to resolve the issue.
But I believe that is not the correct way to troubleshoot. We may have to understand
the issue and always approach bottom down concept to troubleshoot the issue.

Following are the points which we have to ask the development


team:

1. Is there any code changes done in the concurrent program

2. Was this running long in last few run as well, or this time only

3. How much time does it normally takes to complete

4. Is this jobs fetching higher data compare to last run

5. Does this job runs any specific time or it can be run anytime

6. Does this job fetching data using DB Link

Now when you asked these question to development team in


meanwhile you can start your basic checks in your environment.

1. Check the load of the server using top command

2. Verify the mount space using df -hP

3. Check the tablespace size

4. Verify the status of the concurrent request using query:


select request_id ,phase_code, status_code from fnd_concurrent_requests where
request_id ='333333';

5. Check which CM is running this request. 

SELECT request_id, user_concurrent_program_name, status_code, phase_code,


completion_text FROM apps.fnd_conc_req_summary_v WHERE request_id
=&req_id ;

6. Confirm the Actual and target of the CM from above output

7. Confirm the Concurrent Manager Status and queue

8. Check the SID of the concurrent request using query:

SELECT a.request_id, d.sid, d.serial# ,d.osuser,d.process , c.SPID ,d.inst_id FROM


apps.fnd_concurrent_requests a,apps.fnd_concurrent_processes b,gv$process
c,gv$session d

WHERE a.controlling_manager = b.concurrent_process_id AND c.pid


= .oracle_process_id

AND b.session_id=d.audsid AND a.request_id =&req_id AND a.phase_code = 'R';

9. Query to get the row fetched using the SID from step 8.

column name format a30 word_wrapped

column vlu format 999,999,999,999

select b.name, a.value vlu from v$sesstat a, v$statname b where a.statistic# =


b.statistic# and sid =&sid and a.value != 0 and b.name like '%row%' /

col sid format 999999

col username format a20

col osuser format a15

select a.sid, a.serial#,a.username, a.osuser, b.spid from v$session a, v$process b


where .paddr= b.addr and a.sid='&sid' order by a.sid;

10. Check Database session status and what it is running


set echo off

set linesize 132

set verify off

set feedback off

set serveroutput on;

declare

   SID number        := 0 ;

   SERIAL number       := 0 ;

   username varchar(20)   := '';

   Status varchar(8)     := '';

   machine varchar(10)   := '';

   terminal  varchar(25)  := '';

   program  varchar(30)   := '';

   Module varchar(30)    := '';

   Action varchar(20)    := '';

   sql_hash_value number  := 0 ;

   logontime varchar(30)   := '';

   last_call_et number    := 0 ;

   proc number        := 0 ;

   spid number        := 0 ;

   event varchar(30)     := '';

   state varchar(30)     := '';

   sql_text varchar(2000)  := '';


cursor cur1 is

select a.sid sid,

   a.serial# serial,

   a.username username,

   a.status status ,

   a.machine machine,

   a.terminal terminal,

   a.program program,

   a.module module,

   a.action action,

   a.sql_hash_value sql_hash_value,

   to_char(a.logon_time,'DD-Mon-YYYY HH:MI:SS') logontime,

   a.last_call_et last_call_et,

   a.process proc,

   b.spid spid,

   sw.event event,

   sw.state state

from  gv$session a, gv$process b, gv$session_wait sw

where a.paddr=b.addr and a.inst_id=b.inst_id

   and a.sid='&1'

   and a.inst_id=sw.inst_id

   and a.sid=sw.sid;

begin
 DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------');

 DBMS_OUTPUT.PUT_LINE(' Database session detail for the shadow process ');

 DBMS_OUTPUT.PUT_LINE('-----------------------------------------------------------------');

for m in cur1

loop

DBMS_OUTPUT.ENABLE(50000);

  DBMS_OUTPUT.PUT_LINE(' ');

  DBMS_OUTPUT.PUT_LINE( 'SID............ : ' || m.sid );

  DBMS_OUTPUT.PUT_LINE('SERIAL#........ : ' || m.serial  );

  DBMS_OUTPUT.PUT_LINE('USERNAME....... : ' || m.username  );

  DBMS_OUTPUT.PUT_LINE('STATUS......... : ' || m.status   );

  DBMS_OUTPUT.PUT_LINE( 'Machine........ : ' || m.machine );

  DBMS_OUTPUT.PUT_LINE( 'Terminal....... : ' || m.terminal);

  DBMS_OUTPUT.PUT_LINE( 'Program........ : ' || m.program );

  DBMS_OUTPUT.PUT_LINE('Module......... : ' || m.module );

  DBMS_OUTPUT.PUT_LINE( 'Action......... : ' || m.action );

  DBMS_OUTPUT.PUT_LINE('SQL Hash Value. : ' || m.sql_hash_value );

  DBMS_OUTPUT.PUT_LINE( 'Logon Time..... : ' || m.logontime );

  DBMS_OUTPUT.PUT_LINE( 'Last Call Et... : ' || m.last_call_et );

  DBMS_OUTPUT.PUT_LINE( 'Process ID..... : ' || m.proc );

  DBMS_OUTPUT.PUT_LINE( 'SPID........... : ' || m.spid );

  DBMS_OUTPUT.PUT_LINE('Session Waiting for event:'||m.event );

  DBMS_OUTPUT.PUT_LINE('Session state ...........:'||m.state);


dbms_output.put_line('SQL_TEXT is..........:');

for rec in ( select sql_text from v$session s,v$sqltext v where

  s.sql_hash_value=v.hash_value and

  s.sql_address=v.address and s.sid=m.sid order by piece)

loop

dbms_output.put_line(rec.sql_text);

end loop;

  DBMS_OUTPUT.PUT_LINE('--------------------------------------------------------------------');

  DBMS_OUTPUT.PUT_LINE(' ');

end loop;

end;

11. Check which sql id it is running, you can get these details using above steps.

12. You should check the sql_id history and can run sql advisory against the 

   sql_id. this will give you incase of the sql query is not correct or may have 

   to see the recommendation based on the sql advisory 

13. Check the stale value of the tables which is used by the concurrent program.

    select table_name, stale_stats, last_analyzed from dba_tab_statistics where

   stale_stats='YES';

14. You may have to run the gather stats against those tables which are
having    stale value.

15. You can also use OEM and monitor the Session id.

After checking these above points you can definitely narrow down the issue and
based on your finding you can suggest the user corrective action item.

You might also like