Check concurrent programs terminated that still running in the database

Please find the script to get the session running in database for terminated program. Query tested on 10g and 11g both.



SELECT v.SID||','||v.serial# sid_serial#,v.process os_process,v.status session_status,reqs.request_id,
    DECODE(reqs.phase_code,
    'C', 'Completed', 'P', 'Pending',
    'R', 'Running', 'I', 'Inactive',
         reqs.phase_code) || '/'||
  DECODE(reqs.status_code,
    'A', 'Waiting', 'B', 'Resuming',
    'C', 'Normal', 'D', 'Cancelled', 'E', 'Error',
    'G', 'Warning', 'H', 'On Hold', 'I', 'Normal',
    'Q', 'Standby', 'R', 'Normal', 'S', 'Suspended',
    'U', 'Disabled', 'W', 'Paused', 'X', 'Terminated',
    'F', 'Scheduled', 'M', 'NO Manager', 'T', 'Terminated',
    'Z', 'Waiting', reqs.status_code)                         conc_status,
usr.user_name owner,resp.responsibility_name responsibility,
       NVL (LTRIM(reqs.description), prg.user_concurrent_program_name) program,
       argument_text PARAMETERS
    ,'alter system kill session ''' ||v.SID||','||v.serial#||''';' kill_statement
FROM
  applsys.fnd_user usr,
  apps.fnd_conc_requests_form_v reqs,
  apps.fnd_concurrent_programs_tl prg,
  applsys.fnd_responsibility_tl resp,
  v$session v
WHERE reqs.concurrent_program_id = prg.concurrent_program_id
  AND prg.language = 'US'
  AND reqs.requested_by = usr.user_id
  AND reqs.responsibility_application_id = resp.application_id
  AND reqs.responsibility_ID = resp.responsibility_ID
  AND resp.language = 'US' 
  AND reqs.phase_code = 'C'
  AND reqs.status_code = 'X'
  AND v.process = reqs.os_process_id
  AND v.status in ('ACTIVE', 'KILLED');

Comments

Popular posts from this blog

Workflow Agent Listener Service WF_DEFERRED + Business Event not processing

Output Post Processor - EBS 12.2.4 Troubleshoot

How to Diagnose Workflow Notification Mailer Issue