30
To see all the pending / Running requests per each manager wise 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 1=1 AND a.status_code in ('C','F','I','Q','R') --AND a.phase_code IN ('P','R') AND a.phase_code IN ('P') AND a.concurrent_program_id = b.concurrent_program_id AND b.LANGUAGE = 'US' AND c.user_id = a.requested_by and c.user_name like '05%' and trunc(requested_start_date) = trunc(sysdate) ORDER BY user_name,user_concurrent_program_name; How to Find Out Scheduled Concurrent Requests in Oracle Applications 11i SELECT req.request_id , fus.user_name as owner , decode (prg.user_concurrent_program_name, 'Report Set', 'Report Set:' || req.description, prg.user_concurrent_program_name) AS name , argument_text as parameters , req.resubmit_interval , nvl2 (req.resubmit_interval, 'Periodically', nvl2 (req.release_class_id, 'On specific days', 'Once')) AS schedule_type , decode (nvl2 (req.resubmit_interval, 'Periodically', nvl2 (req.release_class_id, 'On specific days', 'Once')), 'Periodically', 'Every ' || req.resubmit_interval || ' ' || lower(req.resubmit_interval_unit_code) || ' from ' || lower(req.resubmit_interval_type_code) || ' of previous run', 'Once', 'At :' || to_char (req.requested_start_date, 'DD-MON-RR HH24:MI'), 'Every: ' || crc.class_info) as schedule , to_char(requested_start_date,'DD-MON-YYYY HH24:MI:SS') as next_submission FROM apps.fnd_concurrent_programs_tl prg , apps.fnd_concurrent_requests req , apps.fnd_user fus

Detail Concurrent Request Queries

Embed Size (px)

DESCRIPTION

Concurrent Request Queries or Details

Citation preview

Page 1: Detail Concurrent Request Queries

To see all the pending / Running requests per each manager wise

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_idFROM applsys.fnd_concurrent_requests a,applsys.fnd_concurrent_programs_tl b,applsys.fnd_user cWHERE 1=1AND a.status_code in ('C','F','I','Q','R')--AND a.phase_code IN ('P','R')AND a.phase_code IN ('P')AND a.concurrent_program_id = b.concurrent_program_idAND b.LANGUAGE = 'US'AND c.user_id = a.requested_byand c.user_name like '05%'and trunc(requested_start_date) = trunc(sysdate)ORDER BY user_name,user_concurrent_program_name;

How to Find Out Scheduled Concurrent Requests in Oracle Applications 11i

SELECT req.request_id , fus.user_name as owner, decode (prg.user_concurrent_program_name, 'Report Set', 'Report Set:' || req.description, prg.user_concurrent_program_name) AS name, argument_text as parameters, req.resubmit_interval, nvl2 (req.resubmit_interval, 'Periodically', nvl2 (req.release_class_id, 'On specific days', 'Once')) AS schedule_type, decode (nvl2 (req.resubmit_interval, 'Periodically', nvl2 (req.release_class_id, 'On specific days', 'Once')), 'Periodically', 'Every ' || req.resubmit_interval || ' ' || lower(req.resubmit_interval_unit_code) || ' from ' || lower(req.resubmit_interval_type_code) || ' of previous run', 'Once', 'At :' || to_char (req.requested_start_date, 'DD-MON-RR HH24:MI'), 'Every: ' || crc.class_info) as schedule , to_char(requested_start_date,'DD-MON-YYYY HH24:MI:SS') as next_submissionFROMapps.fnd_concurrent_programs_tl prg , apps.fnd_concurrent_requests req, apps.fnd_user fus, apps.fnd_conc_release_classes crc WHERE 1=1AND prg.application_id = req.program_application_id AND prg.concurrent_program_id = req.concurrent_program_id AND req.requested_by = fus.user_id --AND req.phase_code in ('P','R')AND req.phase_code in ('P')--AND req.requested_start_date > sysdateAND trunc(req.requested_start_date) = trunc(sysdate)AND prg.language = 'US'

Page 2: Detail Concurrent Request Queries

AND crc.release_class_id(+) = req.release_class_id AND crc.application_id(+) = req.release_class_app_id--AND name like '%Requisition%'and fus.user_name like '05%'and decode (prg.user_concurrent_program_name, 'Report Set', 'Report Set:' || req.description, prg.user_concurrent_program_name) = '05 AR Autoinvoice Master Program'ORDER BY name,owner,parameters,next_submission;

----------------------------------------------------------------------select request_id from fnd_concurrent_requests where status_code in ('Q','I') and requested_start_date > SYSDATE and hold_flag = 'N';

Query to Pull up Concurrent Requests R12

SELECT r.request_id, DECODE (r.description, NULL, pt.user_concurrent_program_name, r.description || ' ( ' || pt.user_concurrent_program_name || ' ) ' ) program, r.phase_code, r.status_code, fnd_amp_private.get_phase (r.phase_code, r.status_code, r.hold_flag, p.enabled_flag, r.requested_start_date, r.request_id ) phase, fnd_amp_private.get_status (r.phase_code, r.status_code, r.hold_flag, p.enabled_flag, r.requested_start_date, r.request_id ) STATUS, u.user_name, rt.responsibility_name, AT.application_name, r.requested_start_date, r.actual_start_date, r.actual_completion_date, r.request_date, r.argument_text, r.oracle_session_id, r.completion_text, r.controlling_manager, r.requested_by, r.program_application_id, r.concurrent_program_id,

Page 3: Detail Concurrent Request Queries

r.is_sub_request, r.parent_request_id, r.queue_method_code, r.cd_id, r.hold_flag, p.enabled_flag, p.concurrent_program_name, p.user_concurrent_program_name, r.os_process_id, r.nls_language, r.nls_territory, r.nls_numeric_characters, r.description FROM fnd_concurrent_programs_tl pt, fnd_responsibility_tl rt, fnd_application_tl AT, fnd_concurrent_programs_vl p, fnd_user u, fnd_concurrent_requests r WHERE r.program_application_id = p.application_id AND r.concurrent_program_id = p.concurrent_program_id AND pt.concurrent_program_id = p.concurrent_program_id AND pt.application_id = p.application_id AND pt.LANGUAGE = USERENV ('LANG') AND u.user_id = r.requested_by AND rt.application_id = r.responsibility_application_id AND rt.responsibility_id = r.responsibility_id AND rt.LANGUAGE = USERENV ('LANG') AND AT.application_id = r.program_application_id AND AT.LANGUAGE = USERENV ('LANG') AND r.request_id = :request_id;

Scheduled concurrent requests

Lot of times we need to find out the concurrent programs scheduled. Users can schedule the concurrent requests in three ways (To run once at a specified time / To run periodically / To run on specific days of the month or week).

The below query will return all the concurrent requests which are scheduled using any of the above methods:

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',

Page 4: Detail Concurrent Request Queries

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;

 Note: The "SCHEDULE" column in the above query returns a string of zeros and ones for the requests which are scheduled on specific days of the month or week.

Positions 1 through 31: Specific day of the month. Position 32: Last day of the month Positions 33 through 39: Sunday through Saturday

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.

Page 5: Detail Concurrent Request Queries

SELECT request_id,user_name, NAME, argument_text 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 in ('P','R')AND cr.phase_code in ('P') --AND cr.requested_start_date > SYSDATEAND trunc(cr.requested_start_date) = trunc(SYSDATE) AND cp.LANGUAGE = 'US' AND fu.user_name LIKE '05%') 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,ARGUMENT_TEXT; 

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

Page 6: Detail Concurrent Request Queries

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.

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'

Page 7: Detail Concurrent Request Queries

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'

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.

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

Page 8: Detail Concurrent Request Queries

AND a1.language = 'US' AND a2.language = 'US' AND b1.language = 'US' AND b2.language = 'US'

 Concurrent Manager and program related scripts

SQL Script to Troubleshoot a long-running concurrent request

set term onset feedback onset echo onset arraysize 4set linesize 200set pages 9999set underline =;column username format A15column sid format 9990 heading SIDcolumn type format A4column lmode format 990 heading 'HELD'column request format 990 heading 'REQ'column id1 format 9999990column id2 format 9999990column sql_text format a100column name format a80break on id1 skip 1 dupundefine v_request_iddefine v_request_idundefine v_spiddefine v_spidundefine v_siddefine v_sidspool vj_concurrent_monitor.lst

Prompt Enter the concurrent_request_idAccept v_request_idprompt checking requestsselect oracle_process_id from fnd_concurrent_requests where request_id='&v_request_id';

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

Page 9: Detail Concurrent Request Queries

prompt Enter the session id for this concurrent requestaccept v_sidprompt memory usage for this sessionSELECT A.SID,A.USERNAME,B.VALUE,c.name FROM V$SESSION a,V$SESSTAT B,V$STATNAME C WHERE A.SID=B.SIDAND B.STATISTIC#=C.STATISTIC# AND C.NAME like'%memor%' and a.sid='&v_sid';

prompt resource usage for this sessionSELECT A.SID,A.USERNAME,B.VALUE,c.name FROM V$SESSION a,V$SESSTAT B,V$STATNAME C WHERE A.SID=B.SIDAND B.STATISTIC#=C.STATISTIC# and a.sid='&v_sid' order by b.value;

prompt this session waited onselect sid,event,wait_time,state from v$session_wait where sid='&v_sid' order by wait_time;

prompt current sql executing by this sessionselect 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 Cwhere 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 poolprompt nosql should take morethan 1mb in shared pool.prompt please ask the developers to tune the following sql statementsselect name,namespace,type,sharable_mem/(1024*1024) sharablemem,loads,executions,locks,pins,kept from v$db_object_cachewhere SHARABLE_MEM>3000000;

prompt sort segments using by this sessionSELECT s.username,s.sid,s.osuser,s.process,s.machine,u.extents, u.blocks,u.tablespace FROM v$session s, v$sort_usage uWHERE s.saddr=u.session_addr order by extents;and s.sid='&v_sid';

prompt current temp segments free in this instanceSELECT tablespace_name, extent_size, total_extents, used_extents, free_extents, max_used_size FROM v$sort_segment;

Page 10: Detail Concurrent Request Queries

prompt total system events at this timeselect 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 anySELECT latch#, name, gets, misses, sleeps FROM v$latch WHERE sleeps>0 ORDER BY sleeps ;

prompt the latch which is sleepingselect name, sleeps,latch# from v$latch_children where sleeps>4 order by sleeps;

spool offclear columnsclear 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_NAMEFROM APPLSYS.FND_CONCURRENT_QUEUE_CONTENT A, APPLSYS.FND_CONCURRENT_PROGRAMS B, APPS.FND_CONCURRENT_QUEUES_VL CWHERE 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.

SELECTrequest_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

Page 11: Detail Concurrent Request Queries

Hours”,(((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24)-(FLOOR((ACTUAL_COMPLETION_DATE- ACTUAL_START_DATE)*24)))*60 “In_Min”–requestor, program, user_concurrent_program_nameFROM fnd_conc_req_summary_vWHERE (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.SPIDFROM apps.fnd_concurrent_requests a,apps.fnd_concurrent_processes b,v$process c,v$session dWHERE a.controlling_manager = b.concurrent_process_idAND c.pid = b.oracle_process_idAND b.session_id=d.audsidAND a.request_id = &Request_IDAND a.phase_code = ‘R’;You need your concurrent request ID as an input.c.SPID= is the operating system process idd.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_requestsset phase_code='C',status_code='D'where phase_code = 'P'and concurrent_program_id not in (select concurrent_program_idfrom fnd_concurrent_programs_tlwhere 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 sysUPDATE applsys.fnd_concurrent_requests SET phase_code = 'C', status_code = 'X' WHERE phase_code = 'R' and status_code ='R'/

Page 12: Detail Concurrent Request Queries

commit

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

update applsys.fnd_concurrent_requestsset hold_flag='Y' where phase_code='P' and hold_flag='N'/commitupdate 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 managerupdate FND_CONCURRENT_QUEUE_SIZEset min_processes = 4where 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_code 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 (-

Page 13: Detail Concurrent Request Queries

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_PARAMETERSfrom FND_CP_SERVICESwhere SERVICE_ID = (select MANAGER_TYPE from FND_CONCURRENT_QUEUES where CONCURRENT_QUEUE_NAME = 'FNDCPOPP');

To increase heap size to 1024:update FND_CP_SERVICESset 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_ 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_idFROM applsys.fnd_concurrent_requests a,applsys.fnd_concurrent_programs_tl b,applsys.fnd_user cWHERE a.phase_code = 'P'

Page 14: Detail Concurrent Request Queries

AND a.concurrent_program_id = b.concurrent_program_idAND b.LANGUAGE = 'US'AND c.user_id = a.requested_byORDER BY user_concurrent_program_name;"

Cancel scheduled concurrent Request “Gather Schema Statistics” sqlplus apps/appssql> update fnd_concurrent_requestsset 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/appssql> update fnd_concurrent_requestsset 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 backendSQL> 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 124214213299

SQL> !kill -9 13348/bin/ksh: kill: 13348: No such process

Page 15: Detail Concurrent Request Queries

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 appsupdate fnd_concurrent_requestsset phase_code='C',status_code='D'WHERE phase_code = 'P'AND status_code in ('Q','I') and concurrent_program_id=32263;

Parameter:Entity : REQUESTMode : AgeMode 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/appspasswdSql>update fnd_concurrent_requestsset 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 AppjumpSelect system administrator ResponisibilityVerify whether Concurrent Request “Gather Schema Statistics” is running or notIf not running, schedule the request to run immediately with Parameters : ALL,10

To check status fo running requests:

Page 16: Detail Concurrent Request Queries

column REQUEST heading 'Request' format a8column PHASE heading 'Phase' format A8column STATUS heading 'Status' format A8column PROGRAM heading 'Program Name' format A40column SHORT heading 'Short Name' format A15column REQUESTOR heading 'Requestor' format A10column START_TIME heading 'Start Time' format A15column RUN_TIME justify left heading 'Time(m)' format 999999.9column OSPID heading 'OSPID' format a5column OS_PIDa heading 'OSPIDA' format a6column SID heading 'SID' format 99999column 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 pwhere fcrv.phase_code = 'R'and fcrv.request_id = fcr.request_idand s.paddr = p.addrand fcr.oracle_process_id = p.spidand fcrv.concurrent_program_id not in ('40112','40113','36887')

Page 17: Detail Concurrent Request Queries

--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') DETAILSfrom fnd_profile_options a, fnd_profile_option_values bwhere a.APPLICATION_ID = b.APPLICATION_IDand a.PROFILE_OPTION_ID = b.PROFILE_OPTION_IDand 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_PROCESSESfrom FND_CONCURRENT_QUEUESwhere CONCURRENT_QUEUE_NAME like 'FNDSM%';

Page 18: Detail Concurrent Request Queries

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 bwhere a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_IDand a.APPLICATION_ID = b.PROGRAM_APPLICATION_IDand b.STATUS_CODE = 'R'and b.PHASE_CODE = 'R'and ((sysdate - b.actual_start_date) * 24) > 4

Page 19: Detail Concurrent Request Queries

and a.CONCURRENT_PROGRAM_ID NOT IN(36887,43393,38121,42789,31556)

Excludes:36887 - Workflow Mailer43393 - ITM Adapter38121 - Gather Schema Statistics42789 - OAM Applications Dashboard Collection31556 - 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 bwhere a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_IDand a.APPLICATION_ID = b.PROGRAM_APPLICATION_IDand 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_codefrom APPS.FND_CONCURRENT_PROGRAMS_VL a,APPS.FND_CONCURRENT_REQUESTS bwhere a.CONCURRENT_PROGRAM_ID = b.CONCURRENT_PROGRAM_IDand a.APPLICATION_ID = b.PROGRAM_APPLICATION_IDand b.STATUS_CODE IN ('E')and b.actual_completion_date > sysdate - 1/48

Find request which are put on holdSQL> 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"",

Page 20: Detail Concurrent Request Queries

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 fileprompt accept request prompt 'Please enter the concurrent request id for the appropriate concurrent program:prompt

column traceid format a8column tracename format a80column user_concurrent_program_name format a40column execname format a15column enable_trace format a12set lines 80set pages 22set 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.modulefrom fnd_concurrent_requests req, v$session ses, v$process proc,v$parameter dest, v$parameter dbnm, fnd_concurrent_programs_vl prog,fnd_executables execnamewhere 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_idand req.program_application_id = prog.application_idand prog.application_id = execname.application_idand prog.executable_id=execname.executable_id

To check failed jobs submitted by an userset lines 1000 pages 100clear columnscol "Submitted By" format a15 word_wrapselect 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"

Page 21: Detail Concurrent Request Queries

from applsys.fnd_concurrent_requests cr,applsys.fnd_user uwhere u.user_id = cr.requested_byand user_name like '%BATCH%'and cr.status_code ='E'and cr.phase_code ='C'and cr.request_date > sysdate - 1order by 1

Statement to put the jobs on hold and release them lateronTo 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

Page 22: Detail Concurrent Request Queries

To submit active user request from backendCONCSUB APPS/APPS SYSADMIN "System Administrator" SYSADMIN CONCURRENT FND FNDSCURS PROGRAM_NAME='"Active Users"'

sql program to submit request from backend"SET SERVEROUTPUT ONdeclarereq_id number;beginDBMS_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');elseDBMS_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 - WaitingB - ResumingC - NormalD - CancelledE - ErrorF - ScheduledG - WarningH - On HoldI - NormalM - No ManagerQ - StandbyR - NormalS - SuspendedT - Terminating

Page 23: Detail Concurrent Request Queries

U - DisabledW - PausedX - TerminatedZ - Waiting

PHASE_CODE column

C - CompletedI - InactiveP - PendingR - Running

selectprog.user_concurrent_program_name "program name",prog.concurrent_program_name "program short name",appl.application_name "program application name",prog.description "program description",exe.executable_name "executable name",exe.execution_file_name "executable file name"--exe.description "executable description"--decode( exe.execution_method_code, 'I', 'PLSQL Stored Procedure', 'P', 'Report', 'L', 'SQL Loader', exe.execution_method_code) "execution method"fromapps.fnd_executables exe,apps.fnd_application_tl appl,apps.fnd_concurrent_programs_vl progwhere prog.application_id = appl.application_idAND exe.executable_id = prog.executable_id--AND prog.user_concurrent_program_name =--AND prog.concurrent_program_name =--AND exe.execution_file_name = AND exe.execution_method_code = 'P'and prog.USER_CONCURRENT_PROGRAM_NAME LIKE '05%ONT%'and nvl(prog.enabled_flag,'N') = 'Y'ORDER BY 1

select B.*from fnd_concurrent_programs a,fnd_concurrent_programs_tl bwhere 1=1and a.concurrent_program_id = b.concurrent_program_idand USER_CONCURRENT_PROGRAM_NAME like '05%ONT%'and a.enabled_flag = 'Y'and execution_method_code ='P'