Skip to main content

Important SQL scripts for Concurrent Request ID Monitoring and Analyzing

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

Refer
REQUESTS.sql Script for Parent/Child Request IDs and Trace File IDs (Doc ID 280295.1)



If you like please follow and comment

Comments

Popular posts from this blog

WebLogic migration to OCI using WDT tool

WebLogic migration to OCI using WDT tool Oracle WebLogic Deploy Tool (WDT) is an open-source project designed to simplify and streamline the management of Oracle WebLogic Server domains. With WDT, you can export configuration and application files from one WebLogic Server domain and import them into another, making it a highly effective tool for tasks like migrating on-premises WebLogic configurations to Oracle Cloud. This blog outlines a detailed step-by-step process for using WDT to migrate WebLogic resources and configurations. Supported WLS versions Why Use WDT for Migration? When moving Oracle WebLogic resources from an on-premises environment to Oracle Cloud (or another WebLogic Server), WDT provides an efficient and reliable approach to: Discover and export domain configurations and application binaries. Create reusable models and archives for deployment in a target domain. Key Pre-Requisites Source System: An Oracle WebLogic Server with pre-configured resources such as: Applica...

How to Validate TDE Wallet Password in Oracle Database

How to Validate TDE Wallet Password in Oracle Database Validating the Transparent Data Encryption (TDE) wallet password is crucial, especially when ensuring that the password is correct without using the OPEN or CLOSE commands in the database. This blog post explains a straightforward method to validate the TDE password using the mkstore utility. Steps to Validate TDE Wallet Password Follow these steps to validate the TDE wallet password: Step 1: Copy the Keystore/Wallet File Navigate to your existing TDE wallet directory. Copy only the ewallet.p12 file to a new directory. If a cwallet.sso file exists, do not copy it . The absence of cwallet.sso ensures that the wallet does not use auto-login, forcing the utility to prompt for the password. Step 2: Validate Using mkstore Use the mkstore utility to check the contents of the wallet file. The mkstore utility will prompt you for the TDE wallet password, allowing you to validate its correctness. Command Syntax To display the conten...

Rename a PDB in Oracle Database Multitenant Architecture in TDE and Non TDE Environment

Rename a PDB in Oracle Database Multitenant Architecture I am sharing a step-by-step guide to help you rename a PDB. This approach uses SQL commands. Without TDE or encryption Wallet Initial Check Check the Current Database Name and Open Mode: SQL > SELECT NAME, OPEN_MODE FROM V$DATABASE; NAME OPEN_MODE --------- -------------------- BEECDB READ WRITE List Current PDBs: SQL > SHOW PDBS; CON_ID CON_NAME OPEN MODE RESTRICTED ---------- ------------------------------ ---------- ---------- 2 PDB$SEED READ ONLY NO 3 FUAT READ WRITE NO We need to RENAME FUAT to BEE  Steps to Rename the PDB Step 1: Export ORACLE_SID Set the Oracle SID to the Container Database (CDB): export ORACLE_SID=BEECDB Step 2: Verify Target PDB Name Availability If the target PDB name is different from the current PDB name, ensure no service exists with the target PDB name. Run SQL to Check Exi...