Monday, September 21, 2026

Oracle Database Performance Troubleshooting – Complete SQL Diagnostic Toolkit

Oracle Database Performance Troubleshooting – Complete SQL Diagnostic Toolkit

Oracle Database performance issues can originate from many areas: long-running SQL statements, blocking sessions, database waits, inefficient execution plans, stale object statistics, SQL plan changes, excessive I/O, or application-level workload.

Instead of checking each area separately, an Oracle DBA can use a structured set of SQL queries to quickly move from a database-level overview to session-level and SQL-level diagnostics.

This post provides a practical troubleshooting approach that can be used for Oracle Database and Oracle E-Business Suite environments, including RAC environments where GV$ views are required.


1. Performance Troubleshooting Flow

A practical troubleshooting sequence is:

  1. Capture database and instance information.
  2. Review total database connections.
  3. Identify active and inactive sessions.
  4. Find currently executing SQL.
  5. Check SQL Monitor information.
  6. Identify blocking sessions.
  7. Drill down into the affected SID and instance.
  8. Review session wait events.
  9. Check long-running operations.
  10. Generate SQL Monitor reports.
  11. Retrieve the complete SQL statement.
  12. Review bind variables.
  13. Compare historical SQL performance.
  14. Determine where the SQL spends its time.
  15. Check table and index statistics.
  16. Review execution plans from memory and AWR.
  17. Check SQL Profiles and SQL Plan Baselines.

2. Generate a Timestamped Diagnostic Output File

Before collecting diagnostic information, spool the results into a timestamped file. This makes it easier to preserve evidence for incident analysis and RCA.

set echo off
set trimspool on
set define on

column filename new_value filename
select to_char(sysdate,'yyyymmdd-hh-mi-ss') filename from dual;

column dbname new_value dbname noprint
select name dbname from v$pdbs;

spool &dbname-&filename..txt

3. Database and Instance Information

Always capture the database name, PDB, database role, instance name, host name and Oracle version before starting detailed analysis.

set lines 750 pages 9999

select name CDB_NAME,
       (select name from v$pdbs) PDB_NAME,
       database_role
from v$database;

select INSTANCE_NAME,
       HOST_NAME,
       logins,
       VERSION
from v$instance;

4. Check Total Database Connections

The following query summarizes active and inactive connections by database username.

set lines 750 pages 9999

break on report
compute SUM of tot on report
compute SUM of active on report
compute SUM of inactive on report

col username for a50

select DECODE(username,NULL,'INTERNAL',USERNAME) Username,
       count(*) TOT,
       COUNT(DECODE(status,'ACTIVE',STATUS)) ACTIVE,
       COUNT(DECODE(status,'INACTIVE',STATUS)) INACTIVE
from gv$session
where status in ('ACTIVE','INACTIVE')
group by username;

This is useful for identifying connection growth, application connection pools, unusually high inactive sessions and overall workload distribution.


5. Session Details

Once a workload issue is suspected, identify the sessions currently connected to the database.

set linesize 750 pages 9999

column box format a30
col serial# for 999999
column spid format a10
column username format a30
column program format a30
column os_user format a20
col LOGON_TIME for a20

select b.inst_id,
       b.sid,
       b.serial#,
       a.spid,
       substr(b.machine,1,30) box,
       to_char(b.logon_time,'dd-mon-yyyy hh24:mi:ss') logon_time,
       substr(b.username,1,30) username,
       substr(b.osuser,1,20) os_user,
       substr(b.program,1,30) program,
       status,
       b.last_call_et AS last_call_et_secs,
       b.sql_id
from gv$session b,
     gv$process a
where b.paddr = a.addr
and a.inst_id = b.inst_id
and type='USER'
order by b.inst_id,b.sid;

Important columns include INST_ID, SID, SERIAL#, operating-system process ID, application program, session status and current SQL ID.


6. Find SQL Currently Executing

column sid format 9999
column username format a15
column PARSING_SCHEMA_NAME format a15
column sql_text format a50
column module format a35

select a.inst_id,
       a.sid,
       a.username,
       b.PARSING_SCHEMA_NAME,
       a.module,
       a.sql_id,
       a.sql_child_number child,
       b.hash_value,
       to_char(a.sql_exec_start,'dd-Mon-yyyy hh24:mi:ss') sql_exec_start,
       (sysdate-sql_exec_start)*24*60*60 SECS,
       b.rows_processed,
       a.status,
       substr(b.sql_text,1,50) sql_text
from gv$session a,
     gv$sqlarea b
where a.sql_hash_value = b.hash_value
and a.sql_address = b.address
and a.module not like '%emagent%'
and a.module not like '%oraagent.bin%'
and a.username is not null
order by a.status;

7. SQL Monitor – Currently Executing SQL

Real-Time SQL Monitoring is extremely useful when investigating resource-intensive SQL statements.

set lines 1000 pages 9999

SELECT *
FROM
(
 SELECT status,
        inst_id,
        sid,
        SESSION_SERIAL# as Serial,
        username,
        sql_id,
        SQL_PLAN_HASH_VALUE,
        program,
        TO_CHAR(sql_exec_start,'dd-mon-yyyy hh24:mi:ss') AS sql_exec_start,
        ROUND(elapsed_time/1000000) AS "Elapsed (s)",
        ROUND(cpu_time/1000000) AS "CPU (s)",
        substr(sql_text,1,30) sql_text
 FROM gv$sql_monitor
 WHERE status='EXECUTING'
 and module not like '%emagent%'
 ORDER BY sql_exec_start desc
);

8. Identify Blocking Sessions

Blocking sessions should be checked early during performance incidents because one blocker can affect multiple application sessions.

set lines 750 pages 9999
col blocking_status for a100

select s1.inst_id,
       s2.inst_id,
       s1.username || '@' || s1.machine ||
       ' ( SID=' || s1.sid || ' ) is blocking ' ||
       s2.username || '@' || s2.machine ||
       ' ( SID=' || s2.sid || ' ) ' AS blocking_status
from gv$lock l1,
     gv$session s1,
     gv$lock l2,
     gv$session s2
where s1.sid=l1.sid
and s2.sid=l2.sid
and s1.inst_id=l1.inst_id
and s2.inst_id=l2.inst_id
and l1.BLOCK=1
and l2.request > 0
and l1.id1 = l2.id1
and l2.id2 = l2.id2
order by s1.inst_id;

9. Drill Down Using SID and Instance ID

accept sid default '' -
'Please provide the sid: '

accept inst_id default '' -
'Please provide the inst_id: '

In RAC environments, always capture both SID and INST_ID. A SID alone does not uniquely identify a session across all RAC instances.


10. What Is the Session Waiting For?

COLUMN username FORMAT A20
COLUMN sid FORMAT 9999
COLUMN serial# FORMAT 999999
COLUMN event FORMAT A40

SELECT NVL(s.username,'(oracle)') AS username,
       s.sid,
       s.serial#,
       se.event,
       se.total_waits,
       se.total_timeouts,
       se.time_waited,
       se.average_wait,
       se.max_wait,
       se.time_waited_micro
FROM gv$session_event se,
     gv$session s
WHERE s.sid = se.sid
AND s.sid = &sid
AND s.inst_id = se.inst_id
AND s.inst_id = &inst_id
ORDER BY se.time_waited DESC;

Wait events help determine whether the session is spending time on I/O, locking, concurrency, network activity, commit activity or other database resources.


11. Current Session Wait

col WAIT_CLASS for a10

SELECT sw.inst_id,
       NVL(s.username,'(oracle)') AS username,
       s.sid,
       s.serial#,
       sw.event,
       sw.wait_class,
       sw.wait_time,
       sw.seconds_in_wait,
       sw.state
FROM gv$session_wait sw,
     gv$session s
WHERE s.sid = sw.sid
and s.inst_id = sw.inst_id
and s.sid = &sid
and s.inst_id = &inst_id
ORDER BY sw.seconds_in_wait DESC;

12. Check Long-Running Operations

SET VERIFY OFF

SELECT a.sid,
       RPAD(a.opname,30),
       a.sofar,
       a.totalwork,
       a.ELAPSED_SECONDS,
       ROUND(((a.sofar)*100)/a.totalwork,3) "%_COMPLETED",
       time_remaining,
       RPAD(a.username,10) username,
       a.SQL_HASH_VALUE,
       B.STATUS
FROM GV$SESSION_LONGOPS a,
     gv$session b
WHERE a.sid=&sid
and b.inst_id=&inst_id
AND a.sofar<>a.totalwork;

This can help monitor operations such as full scans, RMAN operations, index builds and other operations exposed through V$SESSION_LONGOPS.


13. Real-Time SQL Resource Consumption

SELECT *
FROM
(
 SELECT status,
        sql_id,
        sql_exec_id,
        TO_CHAR(sql_exec_start,'dd-mon-yyyy hh24:mi:ss') AS sql_exec_start,
        ROUND(elapsed_time/1000000) AS "Elapsed (s)",
        ROUND(cpu_time/1000000) AS "CPU (s)",
        buffer_gets,
        ROUND(physical_read_bytes/(1024*1024)) AS "Phys reads (MB)",
        ROUND(physical_write_bytes/(1024*1024)) AS "Phys writes (MB)"
 FROM gv$sql_monitor
 WHERE sid=&sid
 and inst_id=&inst_id
 ORDER BY elapsed_time DESC
)
WHERE rownum<=20;

This quickly shows whether the SQL is CPU intensive, performing significant physical reads/writes or generating large numbers of buffer gets.


14. Generate SQL Monitor Report

set pagesize 0
set echo off
set timing off
set linesize 1000
set trimspool on
set trim on
set long 2000000
set longchunksize 2000000

select DBMS_SQLTUNE.REPORT_SQL_MONITOR(
       sql_id=>'&sql_id',
       report_level=>'ALL',
       type=>'TEXT')
from dual;

15. Retrieve Full SQL Statement

set lines 1000 pages 9999
set long 20000
col sql_text for a500

select sql_text
from dba_hist_sqltext
where sql_id = '&sql_id';

16. Check Bind Variables

col VALUE_STRING for a50

SELECT NAME,
       POSITION,
       DATATYPE_STRING,
       VALUE_STRING
FROM gv$sql_bind_capture
WHERE sql_id='&sql_id'
and inst_id=&inst_id;

Bind values are particularly useful when SQL performance differs depending on input values or data distribution.


17. SQL Historical Performance

One of the most important troubleshooting techniques is comparing current SQL performance against historical AWR information.

Useful measurements include:

  • Plan hash value
  • Executions
  • Rows per execution
  • Elapsed time per execution
  • CPU time per execution
  • I/O wait time
  • Cluster wait time
  • Application wait time
  • Concurrency wait time
  • PL/SQL execution time
  • Java execution time

A change in PLAN_HASH_VALUE combined with a significant increase in elapsed time is an important clue when investigating SQL performance regressions.


18. What Is the SQL ID Waiting On?

select sql_id,
       event,
       time_waited "time_waited(s)",
       case
         when time_waited = 0 then 0
         else round(time_waited*100 / sum(time_waited) Over(),2)
       end "percentage"
from
(
 select sql_id,
        event,
        sum(time_waited) time_waited
 from gv$active_session_history
 where sql_id='&sql_id'
 and inst_id=&inst_id
 group by sql_id,event
)
order by time_waited desc;

This provides a useful wait-event breakdown for the SQL ID using Active Session History.


19. Check Table Statistics

col table_name for a40
col owner for a30

select distinct owner,
       table_name,
       STALE_STATS,
       last_analyzed,
       stattype_locked
from dba_tab_statistics
where (owner,table_name) in
(
 select distinct owner,table_name
 from dba_tables
 where table_name in
 (
  select object_name
  from gv$sql_plan
  where upper(sql_id)=upper('&sql_id')
  and inst_id=&inst_id
  and object_name is not null
 )
);

Pay attention to STALE_STATS, LAST_ANALYZED and locked statistics before deciding whether statistics collection is required.


20. Check Index Statistics

After identifying the objects used by the SQL, review the indexes participating in its execution plan.

Important attributes include:

  • Index owner
  • Index name
  • Table name
  • Last analyzed date
  • Sample size
  • Number of rows
  • Partitioned status
  • Global statistics

21. Execution Plan from Cursor Cache

select *
from table(
 dbms_xplan.display_cursor(
   '&sql_id',
   NULL,
   'ALLSTATS LAST'
 )
);

ALLSTATS LAST is particularly useful because it can expose actual execution statistics for the most recent execution when those statistics are available.


22. Execution Plan from AWR

select *
from table(
 dbms_xplan.display_awr(
   '&sql_id',
   NULL,
   null,
   'ALLSTATS LAST'
 )
);

Comparing the current cursor plan with historical AWR plans can help identify execution-plan changes associated with a performance regression.


23. Check SQL Profiles

set lines 1000 pages 9999

col name for a30
col task_exec_name for a16
col category for a10
col created for a30
col sql_text for a150

select sql.sql_id,
       sql.child_number as child,
       prof.name,
       prof.category,
       prof.created,
       prof.task_exec_name,
       prof.FORCE_MATCHING,
       prof.status,
       prof.SIGNATURE
from dba_sql_profiles prof,
     gv$sql sql
where sql.sql_id in ('&sql_id')
order by created;

24. Check SQL Plan Baselines

col SQL_HANDLE for a30
col origin for a16
col last_modified for a30
col last_verified for a30

select sql_handle,
       plan_name,
       origin,
       created,
       last_modified,
       last_verified,
       ENABLED,
       ACCEPTED,
       FIXED,
       REPRODUCED
from dba_sql_plan_baselines
where signature in
(
 select force_matching_signature
 from gv$sql
 where sql_id='&sql_id'
 and inst_id=&inst_id
);

When troubleshooting a plan regression, check whether a SQL Plan Baseline already exists and whether it is enabled, accepted, fixed and reproducible.


25. End the Diagnostic Collection

undef sid
undef sql_id
undef inst_id

spool off;

Recommended DBA Troubleshooting Sequence

Performance Issue
       |
       v
Check DB / Instance
       |
       v
Check Connections
       |
       v
Check Active Sessions
       |
       v
Identify SQL_ID
       |
       +-------------------+
       |                   |
       v                   v
Blocking?              Long Running?
       |                   |
       v                   v
Find Blocker          SQL Monitor
       |                   |
       +---------+---------+
                 |
                 v
           Check Wait Events
                 |
                 v
          Review SQL History
                 |
                 v
         Compare Plan Hashes
                 |
                 v
       Check Object Statistics
                 |
                 v
       Review Execution Plans
                 |
                 v
     SQL Profile / Baseline Check
                 |
                 v
          Identify Root Cause

Important Notes

  • Run diagnostic queries using an appropriately privileged database account.
  • Use GV$ views when troubleshooting Oracle RAC.
  • Always capture INST_ID together with the SID in RAC environments.
  • Do not kill a session simply because it appears long-running.
  • Confirm the blocker, wait event and business impact before terminating sessions.
  • Compare current and historical execution plans before concluding that a plan change caused a regression.
  • Check statistics before gathering them; do not gather statistics blindly in production.
  • AWR, ASH, SQL Monitor and some tuning functionality may require the appropriate Oracle licensing.

Conclusion

Oracle performance troubleshooting becomes much easier when the investigation follows a consistent sequence rather than jumping directly to individual SQL statements.

Start with database and session activity, identify the affected SID and SQL ID, analyze waits and SQL Monitor data, compare historical performance and execution plans, and finally check statistics, SQL Profiles and SQL Plan Baselines.

For Oracle E-Business Suite environments, this approach is particularly useful when investigating slow concurrent programs, online application performance issues, blocked transactions, expensive SQL statements and sudden SQL plan regressions.

AppsDBAStuff
Oracle E-Business Suite | Oracle Database | Performance Tuning | Apps DBA

Oracle E-Business Suite Apps DBA – Essential SQL Queries and Administration Scripts

 

Oracle E-Business Suite Apps DBA – Essential SQL Queries and Administration Scripts

This technical reference consolidates useful Oracle E-Business Suite administration and troubleshooting queries commonly required by Apps DBAs. The scripts cover database sessions, Concurrent Processing, Workflow Mailer, patching, ADOP, profile options, application users, tablespaces, performance troubleshooting and other day-to-day administration activities.

Important: Validate every command in a non-production environment before using it in Production. Queries that modify EBS application tables, terminate operating system processes, alter ADOP metadata or expose credentials should not be executed as routine troubleshooting procedures.

1. Blocking Sessions and Locks

Blocking-session analysis is one of the most common database-level troubleshooting activities for an Oracle E-Business Suite DBA.

Find Blocking Sessions

set lines 130
set pages 200

column module format a20
column program format a20
column username format a15

select s.sid,
       s.serial#,
       s.status,
       p.spid,
       s.module,
       s.action,
       s.program
from   v$session s,
       v$process p
where  s.sid in
       (select session_id
          from dba_locks
         where blocking_others = 'Blocking')
and    s.paddr = p.addr;
Do not terminate a database session solely because it appears as a blocker. First identify the application process, transaction, request, user and business impact.

Find Locked Objects

column object_name format a40

SELECT a.object_id,
       a.session_id,
       b.object_name
FROM   v$locked_object a,
       dba_objects b
WHERE  a.object_id = b.object_id
AND    b.owner = 'AP';

2. Concurrent Processing

Concurrent Processing is a core component of Oracle E-Business Suite. The following queries are useful when investigating running requests, pending requests, manager capacity and request execution.

Running Concurrent Requests

SELECT DISTINCT
       c.user_concurrent_program_name,
       ROUND(((SYSDATE-a.actual_start_date)*24*60),2)
          AS process_time_minutes,
       a.request_id,
       a.parent_request_id,
       a.request_date,
       a.actual_start_date,
       a.actual_completion_date,
       d.user_name,
       a.phase_code,
       a.status_code,
       a.argument_text,
       a.priority
FROM   apps.fnd_concurrent_requests a,
       apps.fnd_concurrent_programs b,
       apps.fnd_concurrent_programs_tl c,
       apps.fnd_user d
WHERE  a.concurrent_program_id = b.concurrent_program_id
AND    b.concurrent_program_id = c.concurrent_program_id
AND    a.requested_by = d.user_id
AND    a.status_code = 'R'
ORDER BY process_time_minutes DESC;

Pending Requests Waiting for Managers

set lines 130

col user_concurrent_queue_name format a39

SELECT b.user_concurrent_queue_name,
       COUNT(*)
FROM   apps.fnd_concurrent_worker_requests a,
       apps.fnd_concurrent_queues_vl b
WHERE  a.phase_code = 'P'
AND    a.hold_flag != 'Y'
AND    a.requested_start_date <= SYSDATE
AND    a.concurrent_queue_id != 1003
AND    a.concurrent_queue_id = b.concurrent_queue_id
GROUP BY b.user_concurrent_queue_name,
         a.status_code;

3. Long Running Concurrent Requests

The following example identifies requests that have been running for more than four hours.

set lines 130

column start_time format a15
column user_concurrent_program_name format a40

SELECT b.request_id,
       a.user_concurrent_program_name,
       b.phase_code,
       (SYSDATE-b.actual_start_date)*24 AS running_hours,
       TO_CHAR(b.request_date,
               'MM/DD/YYYY HH24:MI') AS request_date,
       TO_CHAR(b.actual_start_date,
               'MM/DD/YYYY HH24:MI') AS start_time
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;

4. Scheduled and Pending Requests

Count Scheduled Requests

SELECT 'Scheduled requests:' schedt,
       COUNT(*) schedcnt
FROM   fnd_concurrent_requests
WHERE  (requested_start_date > SYSDATE
        OR status_code = 'P')
AND    phase_code = 'P';

Requests on Hold

SELECT 'Requests on hold:' schedt,
       COUNT(*) schedcnt
FROM   fnd_concurrent_requests
WHERE  hold_flag = 'Y'
AND    phase_code = 'P';

5. Output Post Processor

Find OPP Log for a Concurrent Request

SELECT fcpa.concurrent_request_id req_id,
       fcp.node_name,
       fcp.logfile_name
FROM   fnd_conc_pp_actions fcpa,
       fnd_concurrent_processes fcp
WHERE  fcpa.processor_id = fcp.concurrent_process_id
AND    fcpa.action_type = 6
AND    fcpa.concurrent_request_id = :P_REQUEST_ID;

6. Workflow Mailer

Workflow Mailer Configuration

set lines 130
set pages 200

col value format a30

SELECT p.parameter_id,
       p.parameter_name,
       v.parameter_value value
FROM   apps.fnd_svc_comp_param_vals_v v,
       apps.fnd_svc_comp_params_b p,
       apps.fnd_svc_components c
WHERE  c.component_type = 'WF_MAILER'
AND    v.component_id = c.component_id
AND    v.parameter_id = p.parameter_id
AND    p.parameter_name IN
       ('OUTBOUND_SERVER',
        'INBOUND_SERVER',
        'ACCOUNT',
        'FROM',
        'NODENAME',
        'REPLYTO',
        'DISCARD',
        'PROCESS',
        'INBOX')
ORDER BY p.parameter_name;

7. Profile Option Auditing

Profile-option history can be useful when troubleshooting a problem that started after an application configuration change.

SELECT tl.user_profile_option_name "Profile Option",
       val.profile_option_value "Value",
       val.last_update_date "Set On",
       usr.user_name "Set By"
FROM   fnd_profile_options opt,
       fnd_profile_option_values val,
       fnd_profile_options_tl tl,
       fnd_user usr
WHERE  opt.profile_option_id = val.profile_option_id
AND    opt.profile_option_name = tl.profile_option_name
AND    usr.user_id = val.last_updated_by
ORDER BY val.last_update_date DESC;

8. Installed Products and Patch Levels

SELECT a.application_name,
       a.product_code,
       DECODE(b.status,
              'I','Installed',
              'S','Shared',
              'N/A') status,
       b.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 a.product_code;

AD and TXK Code Levels

SELECT abbreviation,
       codelevel
FROM   ad_trackable_entities
WHERE  abbreviation IN ('ad','txk');

9. EBS 12.2 Online Patching / ADOP

Oracle E-Business Suite Release 12.2 uses the ADOP online patching cycle. A normal patching cycle follows the prepare, apply, finalize, cutover and cleanup phases.

source <EBS_ROOT>/EBSapps.env run

adop phase=prepare

adop phase=apply patches=<PATCH_NUMBER>

adop phase=finalize

adop phase=cutover

source <EBS_ROOT>/EBSapps.env run

adop phase=cleanup

Review Recent ADOP Sessions

column id format 99
column nn format a10
column nt format a6

SELECT adop_session_id id,
       prepare_status,
       apply_status,
       finalize_status,
       cutover_status,
       cleanup_status,
       abort_status,
       status,
       node_name nn,
       node_type nt
FROM   ad_adop_sessions
ORDER BY adop_session_id DESC;

Review Patches Associated with ADOP Sessions

SELECT adop_session_id,
       bug_number,
       patchrun_id,
       status,
       node_name,
       CAST(end_date AS TIMESTAMP) end_date,
       driver_file_name,
       patch_top
FROM   ad_adop_session_patches
ORDER BY end_date DESC;
Do not manually update AD_ADOP_SESSIONS or other ADOP metadata tables as a routine recovery method. Investigate the failed ADOP session and use Oracle-supported recovery procedures appropriate to the failure.

10. Database Session Diagnostics

Find Oracle SID from Operating-System Process ID

SELECT a.sid,
       a.serial#,
       b.spid,
       a.username,
       a.osuser,
       a.status,
       a.module
FROM   v$session a,
       v$process b
WHERE  a.paddr = b.addr
AND    b.spid = '&SPID';

11. Tablespace Monitoring

SELECT t.tablespace,
       t.totalspace AS "Total Space (MB)",
       ROUND(t.totalspace-fs.freespace,2) AS "Used Space (MB)",
       fs.freespace AS "Free Space (MB)",
       ROUND(((t.totalspace-fs.freespace)/t.totalspace)*100,2)
          AS "% Used",
       ROUND((fs.freespace/t.totalspace)*100,2)
          AS "% Free"
FROM
(
  SELECT ROUND(SUM(bytes)/(1024*1024)) totalspace,
         tablespace_name tablespace
  FROM   dba_data_files
  GROUP BY tablespace_name
) t,
(
  SELECT ROUND(SUM(bytes)/(1024*1024)) freespace,
         tablespace_name tablespace
  FROM   dba_free_space
  GROUP BY tablespace_name
) fs
WHERE t.tablespace = fs.tablespace
ORDER BY t.tablespace;

Segment Size

SELECT owner,
       segment_name,
       segment_type,
       tablespace_name,
       bytes/1024/1024 MB
FROM   dba_segments
WHERE  owner = UPPER('&OWNER')
AND    segment_name = UPPER('&SEGMENT_NAME');

12. Performance Diagnostics

Monitor Long Operations

SELECT sid,
       serial#,
       opname,
       sofar,
       totalwork,
       ROUND(sofar/totalwork*100,2) "% Complete"
FROM   v$session_longops
WHERE  totalwork > 0
AND    sofar < totalwork;
Some performance scripts based on DBA_HIST_* views access AWR data. Use of AWR and related Diagnostics Pack functionality should be checked against the Oracle licensing applicable to the environment.

13. Users and Responsibilities

List Responsibilities

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
ORDER BY frt.responsibility_name;

Users and Assigned Responsibilities

SELECT DISTINCT
       u.user_id,
       SUBSTR(u.user_name,1,30) user_name,
       SUBSTR(r.responsibility_name,1,60) responsibility,
       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 user_name,
         application,
         responsibility;

14. Concurrent Request Trace and Diagnostics

Identify Request and Database Process

SELECT request_id,
       oracle_process_id,
       phase_code,
       status_code,
       actual_start_date,
       actual_completion_date
FROM   apps.fnd_concurrent_requests
WHERE  request_id = '&REQUEST_ID';

The Oracle process ID can then be correlated with V$PROCESS and V$SESSION to identify the database session servicing the request.

15. Production Safety Notes

Avoid indiscriminate process termination.
Commands that terminate every FNDLIBR process using kill -9 can affect multiple concurrent requests and Concurrent Manager processes. Identify the exact process and understand its application impact before taking any termination action.
Avoid direct updates to EBS application tables.
Directly changing phase/status values in FND_CONCURRENT_REQUESTS, ADOP metadata or other EBS-owned tables can leave application metadata inconsistent. Prefer supported application interfaces and documented recovery procedures.
Do not publish or extract database-link passwords.
Credential-recovery SQL and commands containing APPS or other database passwords should not be included in operational documentation or public blog posts.
Recommended practice: Use these scripts primarily for diagnostics and evidence collection. Before executing a command that changes data, terminates a process, modifies patching metadata or changes configuration, confirm the procedure against the documentation appropriate to your exact Oracle E-Business Suite and database release.

Conclusion

A well-organized Apps DBA SQL toolkit can significantly reduce the time required to troubleshoot Oracle E-Business Suite incidents. The most useful approach is to separate read-only diagnostic queries from commands that modify application state, terminate processes or alter configuration.

For day-to-day support, the core areas to monitor are database sessions, Concurrent Processing, Workflow components, application configuration, tablespace utilization, patching status and SQL performance.

Saturday, September 12, 2026

72 Golden Rules Every Oracle DBA and Enterprise Architect Should Live By

 

72 Golden Rules Every Oracle DBA and Enterprise Architect Should Live By

Battle-tested operational principles for Oracle E-Business Suite, Core DBA, RAC, ASM, Data Guard, RMAN, performance forensics, incident response, and engineering leadership.

Production systems rarely fail because somebody forgot a command. They fail because a technically valid command was executed at the wrong time, against the wrong target, without sufficient evidence or without a safe rollback path.

These golden rules are built around the most common operational anti-pattern: taking a premature, drastic, or misdirected action before establishing the actual cause. They are deliberately punchy, but each one reflects a serious lesson from running mission-critical Oracle environments.

The governing principle: Evidence first. Hypothesis second. Controlled action third. Validation always.

1. Apps DBA — Oracle E-Business Suite R12/12.2

This section covers Concurrent Managers, online patching, AutoConfig, WebLogic, application-tier services, and cloning.

  1. We don’t bounce the entire EBS application tier until we identify which service, managed server, or node is actually unhealthy! ๐ŸŽฏ

  2. We don’t restart Concurrent Managers until we inspect FND_CONCURRENT_REQUESTS, FND_CONCURRENT_QUEUES, FND_CONCURRENT_PROCESSES, and the Internal Manager log! ๐Ÿ”

  3. We don’t blame the Internal Concurrent Manager for pending requests until incompatibilities, specialization rules, work shifts, target processes, and node assignments are validated! ๐Ÿงญ

  4. We don’t terminate a long-running concurrent request until its database session, SQL ID, wait event, blocking chain, and business criticality are confirmed! ๐Ÿ›‘

  5. We don’t delete rows directly from FND_CONCURRENT_REQUESTS when Oracle provides supported purge programs and retention controls! ๐Ÿงน

  6. We don’t run adop phase=abort until the current session, failed phase, worker logs, AD_ADOP_SESSIONS, and recovery options are understood! ๐Ÿšง

  7. We don’t execute adop cleanup_mode=full as a magic broom until the failed patching cycle and filesystem synchronization state are documented! ๐Ÿช„

  8. We don’t apply an EBS patch because its README looks friendly until prerequisites, supersedence, ETCC results, code levels, and interoperability notes are checked! ๐Ÿ“š

  9. We don’t use adpatch casually in an online-patching-enabled EBS 12.2 environment when the patch belongs inside an adop cycle! ⚠️

  10. We don’t run AutoConfig everywhere until the correct context file, RUN filesystem, node role, shared filesystem design, and pending configuration changes are verified! ๐Ÿงฉ

  11. We don’t edit generated files under $INST_TOP, OHS, WebLogic, or application configuration directories until we know whether AutoConfig will overwrite them! ✍️

  12. We don’t declare an EBS clone successful when the login page opens until Concurrent Managers, Workflow Mailer, OPP, forms, integrations, printers, profiles, database links, and scheduled jobs are validated! ๐Ÿงช

2. Core DBA and Architecture

These rules address RAC, ASM, storage, RMAN, Data Guard, disaster recovery, and platform architecture.

  1. We don’t restart a RAC database until crsctl stat res -t, srvctl status database, instance health, services, and cluster interconnect symptoms identify the failing layer! ๐Ÿง 

  2. We don’t relocate a RAC service during an incident until connection pools, transaction affinity, FAN/TAF behavior, and surviving-instance capacity are confirmed! ๐Ÿ”€

  3. We don’t evict a RAC node manually until CSS, voting-disk, interconnect, and OS evidence explains why the cluster is threatening to do it for us! ๐Ÿ—ณ️

  4. We don’t add ASM disks until failure groups, allocation-unit size, rebalance power, usable capacity, and storage-path redundancy are validated! ๐Ÿ’ฟ

  5. We don’t drop an ASM disk until V$ASM_OPERATION, rebalance status, redundancy, and partner-disk health prove the data is safely redistributed! ๐Ÿงจ

  6. We don’t blame ASM for latency until iostat, sar, V$ASM_DISK_IOSTAT, database wait events, multipathing, and storage-array metrics tell the same story! ๐Ÿ“Š

  7. We don’t increase DB_FILE_MULTIBLOCK_READ_COUNT to cure slow storage until execution plans and actual I/O latency prove that multiblock reads are the problem! ๐Ÿข

  8. We don’t activate a Data Guard standby until the failover decision, redo gap, data-loss exposure, application fencing, and no-return point are formally accepted! ๐Ÿšจ

  9. We don’t restart managed recovery until V$ARCHIVE_GAP, V$DATAGUARD_STATUS, transport errors, standby redo logs, and broker state are inspected! ๐Ÿ“ก

  10. We don’t call a backup successful because RMAN returned exit code zero until logs, backup-piece availability, retention, control-file protection, and restore validation are checked! ๐ŸŽญ

  11. We don’t trust an untested backup when RESTORE VALIDATE, VALIDATE DATABASE, block checks, and a recovery rehearsal have never met it! ๐Ÿงฏ

  12. We don’t design DR around an RPO/RTO PowerPoint until bandwidth, redo rate, restore throughput, dependency sequencing, DNS, certificates, and application recovery are measured! ⏱️

3. Performance Tuning and Forensics

Performance engineering begins with workload evidence—not parameter roulette.

  1. We don’t tune CPU when the database is waiting on I/O, locks, commits, network responses, or application think time! ๐Ÿฉบ

  2. We don’t tune a SQL statement from elapsed time alone until DB time, CPU time, wait profile, executions, rows processed, and business context are known! ๐Ÿ”ฌ

  3. We don’t add an index until predicates, selectivity, clustering factor, DML overhead, plan alternatives, and existing index coverage are evaluated! ๐Ÿ—‚️

  4. We don’t drop an allegedly unused index until DBA_HIST_SQL_PLAN, index-monitoring limitations, reporting cycles, and emergency workloads have been considered! ๐Ÿชฆ

  5. We don’t flush the shared pool when one SQL statement misbehaves until child cursors, mutex waits, invalidations, bind behavior, and dependency churn are understood! ๐Ÿšฟ

  6. We don’t purge a SQL plan from the cursor cache until we have captured its SQL ID, plan hash value, outline, bind information, and reproducible evidence! ๐Ÿ“ธ

  7. We don’t gather schema-wide statistics during peak hours until stale objects, sampling strategy, histograms, incremental statistics, and plan-change risk are assessed! ๐ŸŽฒ

  8. We don’t delete histograms because bind peeking looks suspicious until V$SQL_SHARED_CURSOR, adaptive cursor sharing, column skew, and workload diversity are verified! ๐Ÿ“

  9. We don’t increase SGA_TARGET, PGA_AGGREGATE_TARGET, or HugePages until swapping, paging, NUMA placement, PGA spills, and OS memory headroom are measured! ๐Ÿง 

  10. We don’t treat db file sequential read as automatically bad until latency, call volume, access path, storage tier, and rows returned per execution are correlated! ๐Ÿงต

  11. We don’t blame log file sync entirely on storage until commit frequency, log file parallel write, redo allocation, LGWR CPU scheduling, and application commit design are compared! ๐Ÿงพ

  12. We don’t use one AWR snapshot pair to explain an intermittent incident until ASH, baselines, peak intervals, time models, and OS telemetry reconstruct the actual timeline! ๐Ÿ•ต️

4. Troubleshooting and Root Cause Analysis

Troubleshooting is the disciplined elimination of possibilities—not a contest to see who can restart something first.

  1. We don’t change a parameter until we can state the hypothesis, expected metric movement, validation window, and rollback command! ๐Ÿงช

  2. We don’t troubleshoot five layers simultaneously until the failure is isolated across client, load balancer, OHS, WebLogic, database, network, and OS boundaries! ๐Ÿง…

  3. We don’t blame the database because the application says “database error” until listener logs, JDBC errors, connection-pool state, SQL*Net evidence, and database alert logs agree! ๐Ÿ™ƒ

  4. We don’t blame the network because ping is slow until TCP throughput, packet loss, MTU, retransmissions, routing, firewall inspection, and application-port tests are measured! ๐ŸŒ

  5. We don’t accept “the server is slow” until CPU utilization, run queue, paging, filesystem latency, network errors, and top processes are timestamped! ๐Ÿ–ฅ️

  6. We don’t kill a blocker until V$SESSION, V$LOCK, DBA_BLOCKERS, DBA_WAITERS, transaction age, object ownership, and rollback cost are reviewed! ๐Ÿ”’

  7. We don’t kill an OS process with kill -9 until graceful database or application termination has failed and process identity is proven beyond PID coincidence! ☠️

  8. We don’t enable event 10046 or broad SQL tracing in production until scope, level, duration, trace-file growth, and performance overhead are controlled! ๐Ÿ”ฆ

  9. We don’t enable system-wide debug logging until targeted component logging has failed to capture the evidence and filesystem capacity can survive the experiment! ๐Ÿชต

  10. We don’t declare corruption from one ORA-01578 until DBV, RMAN validation, V$DATABASE_BLOCK_CORRUPTION, object mapping, and storage evidence confirm its scope! ๐Ÿงฑ

  11. We don’t call an issue intermittent when timestamps, time zones, request IDs, SQL IDs, hostnames, session identifiers, and correlation IDs were never captured! ⌚

  12. We don’t close an incident because the symptom disappeared until the trigger, failure mechanism, corrective action, and recurrence-detection method are documented! ๐Ÿงพ

5. Crisis Management and War Rooms

During a critical incident, uncontrolled technical activity can become a second outage layered on top of the first.

  1. We don’t start a SEV1 bridge without one incident commander, one technical lead, one communications owner, and one timestamped action log! ๐ŸŽ–️

  2. We don’t let ten engineers execute ten ideas until hypotheses are ranked, owners are assigned, and mutually conflicting actions are stopped! ๐Ÿšฆ

  3. We don’t restart everything because executives joined the bridge until the failing component and expected recovery mechanism are identified! ๐ŸŽช

  4. We don’t make a production change during a crisis until the exact command, target, blast radius, success signal, and rollback path are read back! ๐Ÿ“ฃ

  5. We don’t combine multiple fixes in one emergency change until each action’s effect can still be isolated and reversed! ๐Ÿงฌ

  6. We don’t fail over to DR until the primary is fenced and split-brain, data-loss, DNS, routing, integration, and reconciliation risks are accepted! ⚔️

  7. We don’t promote a standby because replication is “almost caught up” until the business signs off on the exact recoverable SCN or timestamp! ๐Ÿ•ฐ️

  8. We don’t restore a database over the suspected source until forensic evidence, logs, control files, and recovery artifacts are safely preserved! ๐ŸงŠ

  9. We don’t announce recovery when the homepage responds until transactions, batch processing, integrations, authentication, monitoring, and data consistency pass validation! ๐ŸŸข

  10. We don’t allow stakeholder pressure to redefine technical truth until metrics demonstrate stability across an agreed observation window! ๐ŸŒก️

  11. We don’t end the bridge until temporary workarounds, monitoring thresholds, ownership, next update, and customer-impact statements are recorded! ๐Ÿ“‹

  12. We don’t call rollback a failure when rollback was the engineered control that prevented a larger outage! ๐Ÿช‚

6. Engineering Leadership and Operational Culture

Reliable platforms require more than technical skill. They require disciplined automation, meaningful ownership, useful documentation, and a culture that learns from failure.

  1. We don’t automate a broken process until its inputs, ownership, exception paths, and desired outcome are understood! ๐Ÿค–

  2. We don’t automate destructive commands until dry-run mode, target validation, logging, idempotency, failure handling, and recovery controls exist! ๐Ÿ›ก️

  3. We don’t replace human toil with silent cron failures until alerting, exit-code handling, lock files, retention, and operational ownership are built in! ⏰

  4. We don’t call a script production-ready until it handles spaces, nulls, timeouts, concurrent execution, partial failure, credentials, and reruns safely! ๐Ÿงฐ

  5. We don’t accept a dashboard full of green boxes until every metric has a source, threshold, timestamp, owner, and actionable response! ๐Ÿšฅ

  6. We don’t write an RCA around who clicked the button until we explain why one click could bypass review, safeguards, testing, or rollback! ๐Ÿซต

  7. We don’t conduct a blameless retrospective without evidence, because “blameless” does not mean “factless”! ๐Ÿ”Ž

  8. We don’t close a problem record with “human error” until process design, access control, automation gaps, training, and workload conditions are examined! ๐Ÿง‘‍⚖️

  9. We don’t carry a manual operational step forever when its frequency, error rate, recovery cost, and automation value justify eliminating the toil! ๐Ÿ—️

  10. We don’t postpone technical debt indefinitely until the accumulated outage risk, security exposure, delivery drag, and support cost are visible to decision-makers! ๐Ÿ’ณ

  11. We don’t approve architecture by diagram beauty until failure modes, capacity limits, observability, operability, upgrade paths, and ownership are demonstrated! ๐Ÿ›️

  12. We don’t call knowledge transfer complete until another engineer can diagnose, operate, recover, and safely change the platform without calling its original builder! ๐Ÿง‘‍๐Ÿš€

Final Takeaway

Production does not reward confidence without evidence.
It rewards engineers who preserve evidence, control the blast radius, understand dependencies, prepare rollback options, and validate the complete business service—not merely the component they restarted.

The best Oracle DBA is not the person who remembers the most commands. It is the person who knows which command should be executed, why it should be executed, what could go wrong, how to reverse it, and how to prove that the system is genuinely healthy afterward.

Before touching production, ask four questions:

  • What evidence supports the proposed action?
  • What is the expected technical outcome?
  • What is the blast radius if the hypothesis is wrong?
  • How will we roll back and validate recovery?

If those questions cannot be answered clearly, the next command should probably be a diagnostic command.


Topics: Oracle DBA, Oracle E-Business Suite, Apps DBA, RAC, ASM, Data Guard, RMAN, Performance Tuning, Incident Management, AWR, ASH and Enterprise Architecture

Wednesday, September 9, 2026

in

SELECT
    sql_id,
    executions,
    elapsed_time/1000000 elapsed_sec,
    elapsed_time/1000/NULLIF(executions,0) ms_per_exec,
    cpu_time/1000000 cpu_sec,
    buffer_gets,
    disk_reads,
    rows_processed
FROM v$sql
WHERE sql_id = '0bujgc94rg3fj';

And find whether it is executing right now:

SELECT
    s.sid,
    s.serial#,
    s.username,
    s.status,
    s.event,
    s.wait_class,
    s.seconds_in_wait,
    s.sql_id,
    s.module,
    s.action,
    s.program,
    s.machine
FROM v$session s
WHERE s.sql_id = '0bujgc94rg3fj';



What is this SQL waiting on when it becomes slow?

That is where ASH/AWR becomes important.

Run this first:

SELECT
    sql_id,
    plan_hash_value,
    executions,
    elapsed_time/1000000 elapsed_sec,
    cpu_time/1000000 cpu_sec,
    buffer_gets,
    disk_reads,
    rows_processed
FROM v$sql
WHERE sql_id = '0bujgc94rg3fj';

Then check whether there are multiple child cursors:

SELECT
    child_number,
    plan_hash_value,
    executions,
    elapsed_time/1000000 elapsed_sec,
    cpu_time/1000000 cpu_sec,
    buffer_gets,
    disk_reads,
    loads,
    invalidations,
    parse_calls
FROM v$sql
WHERE sql_id = '0bujgc94rg3fj'
ORDER BY child_number;

More importantly, use ASH:

SELECT
    event,
    wait_class,
    session_state,
    COUNT(*) samples
FROM v$active_session_history
WHERE sql_id = '0bujgc94rg3fj'
GROUP BY
    event,
    wait_class,
    session_state
ORDER BY samples DESC;

If Diagnostic Pack/AWR is available, check historical ASH:

SELECT
    event,
    wait_class,
    session_state,
    COUNT(*) samples
FROM dba_hist_active_sess_history
WHERE sql_id = '0bujgc94rg3fj'
GROUP BY
    event,
    wait_class,
    session_state
ORDER BY samples DESC;

Also check SQL performance over time:

SELECT
    sn.begin_interval_time,
    ss.plan_hash_value,
    ss.executions_delta,
    ROUND(ss.elapsed_time_delta/1000000,2) elapsed_sec,
    ROUND(
        ss.elapsed_time_delta /
        NULLIF(ss.executions_delta,0) / 1000,
        2
    ) ms_per_exec,
    ss.buffer_gets_delta,
    ss.disk_reads_delta
FROM dba_hist_sqlstat ss,
     dba_hist_snapshot sn
WHERE ss.snap_id = sn.snap_id
AND ss.dbid = sn.dbid
AND ss.instance_number = sn.instance_number
AND ss.sql_id = '0bujgc94rg3fj'
ORDER BY sn.begin_interval_time DESC;



++++++++++++++


SELECT
       NVL(sql_id,'NO_SQL_ID') sql_id,
       NVL(event,'ON CPU') event,
       wait_class,
       session_state,
       COUNT(*) samples
FROM dba_hist_active_sess_history
WHERE top_level_sql_id = '0bujgc94rg3fj'
GROUP BY
       sql_id,
       event,
       wait_class,
       session_state
ORDER BY samples DESC;

This is probably the most valuable query at this point.

It may reveal something like:

TOP LEVEL
WF_EVENT.LISTEN

        |
        +--> SQL A against WF_EVENT_SUBSCRIPTIONS
        |
        +--> SQL B against WF_EVENTS
        |
        +--> SQL C against AQ queue
        |
        +--> SQL D ...

Then we can identify which one is burning the CPU and logical reads.

Also run this version

This will give us the internal SQL IDs ranked by activity:

SELECT
       sql_id,
       COUNT(*) samples,
       SUM(CASE
             WHEN session_state = 'ON CPU'
             THEN 1
             ELSE 0
           END) cpu_samples,
       SUM(CASE
             WHEN session_state = 'WAITING'
             THEN 1
             ELSE 0
           END) wait_samples
FROM dba_hist_active_sess_history
WHERE top_level_sql_id = '0bujgc94rg3fj'
GROUP BY sql_id
ORDER BY samples DESC;

Send me that result.


One more thing I noticed in your AWR screenshot

You have identical BEGIN_INTERVAL_TIME values appearing more than once, for example around 04-Aug.

That could be because the database has multiple instances. Your query currently doesn't display INSTANCE_NUMBER.

If this is RAC, we absolutely need to know which instance is experiencing the problem.

Modify the AWR query to:

SELECT
       sn.begin_interval_time,
       ss.instance_number,
       ss.plan_hash_value,
       ss.executions_delta,

       ROUND(
         ss.elapsed_time_delta / 1000000,
         2
       ) elapsed_sec,

       ROUND(
         ss.elapsed_time_delta /
         NULLIF(ss.executions_delta,0) /
         1000,
         2
       ) ms_per_exec,

       ss.buffer_gets_delta,

       ROUND(
         ss.buffer_gets_delta /
         NULLIF(ss.executions_delta,0)
       ) buffer_gets_per_exec,

       ss.disk_reads_delta

FROM dba_hist_sqlstat ss,
     dba_hist_snapshot sn

WHERE ss.snap_id = sn.snap_id
AND ss.dbid = sn.dbid
AND ss.instance_number = sn.instance_number
AND ss.sql_id = '0bujgc94rg3fj'

ORDER BY sn.begin_interval_time DESC,
         ss.instance_number;

++++++++++++++++++



Find the exact execution-plan operation where ASH is accumulating

SELECT
       sql_plan_line_id,
       sql_plan_operation,
       sql_plan_options,
       event,
       session_state,
       COUNT(*) samples
FROM dba_hist_active_sess_history
WHERE top_level_sql_id = '0bujgc94rg3fj'
AND sql_id = 'b2jckdvl94knx'
GROUP BY
       sql_plan_line_id,
       sql_plan_operation,
       sql_plan_options,
       event,
       session_state
ORDER BY samples DESC;



Find which Oracle object is generating the reads

Run this one as well:

SELECT
       ash.current_obj#,
       obj.owner,
       obj.object_name,
       obj.object_type,
       ash.event,
       COUNT(*) samples
FROM dba_hist_active_sess_history ash
LEFT JOIN dba_objects obj
       ON obj.object_id = ash.current_obj#
WHERE ash.top_level_sql_id = '0bujgc94rg3fj'
AND ash.sql_id = 'b2jckdvl94knx'
AND ash.current_obj# > 0
GROUP BY
       ash.current_obj#,
       obj.owner,
       obj.object_name,
       obj.object_type,
       ash.event
ORDER BY samples DESC;



       sql_id,
       child_number,
       plan_hash_value,
       executions,
       ROUND(elapsed_time/1000000,2) elapsed_sec,
       ROUND(cpu_time/1000000,2) cpu_sec,
       buffer_gets,
       disk_reads,
       rows_processed,
       sql_fulltext
FROM v$sql
WHERE sql_id = 'b2jckdvl94knx';

If it is no longer in shared pool:

SELECT
       sql_id,
       DBMS_LOB.SUBSTR(sql_text,4000,1) sql_text
FROM dba_hist_sqltext
WHERE sql_id = 'b2jckdvl94knx';






The next query should therefore combine everything into one result.

SELECT
       sql_id,
       SUM(executions) executions,
       ROUND(SUM(elapsed_time)/1000000,2) elapsed_sec,
       ROUND(SUM(cpu_time)/1000000,2) cpu_sec,
       SUM(buffer_gets) buffer_gets,
       SUM(disk_reads) disk_reads,

       ROUND(
          SUM(elapsed_time) /
          NULLIF(SUM(executions),0) /
          1000,
          2
       ) ms_per_exec,

       ROUND(
          SUM(buffer_gets) /
          NULLIF(SUM(executions),0),
          2
       ) buffer_gets_per_exec,

       ROUND(
          SUM(disk_reads) /
          NULLIF(SUM(executions),0),
          2
       ) disk_reads_per_exec

FROM gv$sql

WHERE sql_id IN
(
 '8nzx90zdhgfgc',
 '63v1yg88zt6gs',
 'd119xbzfdqyar',
 'cyly9yv9y91hb'
)

GROUP BY sql_id
ORDER BY elapsed_sec DESC;

That result is much more meaningful.

Also determine why there are multiple rows

Run:

SELECT
       inst_id,
       sql_id,
       child_number,
       plan_hash_value,
       executions,
       ROUND(elapsed_time/1000000,2) elapsed_sec,
       ROUND(cpu_time/1000000,2) cpu_sec,
       buffer_gets,
       disk_reads
FROM gv$sql
WHERE sql_id IN
(
 '8nzx90zdhgfgc',
 '63v1yg88zt6gs',
 'd119xbzfdqyar',
 'cyly9yv9y91hb'
)
ORDER BY sql_id,
         inst_id,
         child_number;




Now get the SQL text

This is the most important next piece:

SELECT DISTINCT
       sql_id,
       DBMS_LOB.SUBSTR(sql_fulltext,4000,1) sql_text
FROM gv$sql
WHERE sql_id IN
(
 '8nzx90zdhgfgc',
 '63v1yg88zt6gs',
 'd119xbzfdqyar',
 'cyly9yv9y91hb'
);




SELECT
       event,
       wait_class,
       session_state,
       COUNT(*) samples
FROM dba_hist_active_sess_history
WHERE sql_id = '8nzx90zdhgfgc'
GROUP BY
       event,
       wait_class,
       session_state
ORDER BY samples DESC;

Then:

SELECT
       ash.current_obj#,
       obj.owner,
       obj.object_name,
       obj.object_type,
       ash.event,
       COUNT(*) samples
FROM dba_hist_active_sess_history ash
LEFT JOIN dba_objects obj
       ON obj.object_id = ash.current_obj#
WHERE ash.sql_id = '8nzx90zdhgfgc'
AND ash.current_obj# > 0
GROUP BY
       ash.current_obj#,
       obj.owner,
       obj.object_name,
       obj.object_type,
       ash.event
ORDER BY samples DESC;

Diagnosing Workflow Mailer Email Storms and Delayed PO Email Approvals — A Read-Only Production RCA Runbook

Oracle EBS 12.2: Diagnosing Workflow Mailer Email Storms and Delayed PO Email Approvals — A Read-Only Production RCA Runbook

A common production scenario in Oracle E-Business Suite 12.2: the Workflow Notification Mailer starts bouncing under a flood of notification emails, and users complain that Purchase Orders approved via email take a long time to reflect in EBS. This post is a complete, production-safe, READ-ONLY investigation runbook — every query and OS check needed to find exactly where the email approval is spending its time, before touching anything.

Ground rules: no purges, no updates to Workflow tables, no mailer bounces, no queue cleanup — diagnostics only. Baseline is EBS 12.2.x on Oracle 19c with APPS access and OS access to the Concurrent Manager node.


Architecture recap — why an outbound email storm delays inbound PO approvals

The Notification Mailer is one Java service container (WFMLRSVC / FNDCPGSC) that runs both the outbound processors (dequeue WF_NOTIFICATION_OUT → SMTP) and the inbound processors (poll IMAP → enqueue WF_NOTIFICATION_IN). Therefore:

  1. An outbound storm can saturate the mailer's threads/heap → OutOfMemory / hang → GSM restarts the container ("bouncing").
  2. Every bounce interrupts IMAP polling → user approval replies sit unread in the INBOX.
  3. Even after the reply is enqueued to WF_NOTIFICATION_IN, a separate component — the Workflow Inbound Notifications Agent Listener — must dequeue it and call the respond API.
  4. The post-response PO workflow activities may be deferred, i.e. parked on WF_DEFERRED for the Workflow Deferred Agent Listener (and, for timed-out/stuck activities, the Workflow Background Process).

So the end-to-end delay can accumulate in four independent places: mailer-outbound, mailer-inbound (IMAP), WF_NOTIFICATION_IN listener, WF_DEFERRED engine processing. The phases below measure each one.


PHASE 1 — Immediate 5-minute production health check

1.1 Service component status

Purpose: Confirm the four critical components are RUNNING right now.

SELECT fsc.component_id,
       fsc.component_name,
       fsc.component_status,
       fsc.component_type,
       fsc.startup_mode,
       fcq.concurrent_queue_name AS container
FROM   fnd_svc_components     fsc,
       fnd_concurrent_queues  fcq
WHERE  fsc.concurrent_queue_id = fcq.concurrent_queue_id (+)
AND    fsc.component_type LIKE 'WF_%'
ORDER  BY fsc.component_type, fsc.component_name;

Expected normal: Workflow Notification Mailer, Workflow Agent Listener components (Workflow Deferred Agent Listener, Workflow Deferred Notification Agent Listener, Workflow Inbound Notifications Agent Listener, Workflow Error Agent Listener, Java listeners) all RUNNING with startup_mode = AUTOMATIC.

Problem indicators:

component_status Meaning Next step
STOPPED / DEACTIVATED_USER Someone stopped it Find who/when in mailer log; do NOT restart yet
STOPPED_ERROR Crashed after max auto-restarts Phase 7 log analysis — this is your smoking gun
SUSPENDED Manually or schedule-suspended Check OAM schedule
STARTING (persistently) Container thrashing / can't initialize Phase 7 — IMAP/SMTP connect errors, OOM

1.2 Are the service containers themselves alive, and are they bouncing?

Purpose: WFMLRSVC (Mailer container) and WFALSNRSVC (Agent Listener container) restarts show up as multiple recent process rows. Frequent restarts = "mailer bouncing" confirmed with timestamps.

SELECT q.concurrent_queue_name,
       p.concurrent_process_id,
       p.process_status_code,
       TO_CHAR(p.process_start_date,'DD-MON HH24:MI:SS') AS started,
       p.node_name,
       p.logfile_name
FROM   fnd_concurrent_queues    q,
       fnd_concurrent_processes p
WHERE  q.concurrent_queue_id = p.concurrent_queue_id
AND    q.concurrent_queue_name IN ('WFMLRSVC','WFALSNRSVC')
AND    p.process_start_date > SYSDATE - 2
ORDER  BY q.concurrent_queue_name, p.process_start_date DESC;

Expected normal: exactly one A (Active) row per container, started days/weeks ago. Problem: several rows in the last 24 h (statuses K/S/T followed by new A rows) = container is being killed/restarted repeatedly. Save the logfile_name values — they are the Phase 7 inputs.

1.3 30-second queue snapshot

Purpose: Instant view of the two queues that gate email approvals.

SELECT 'WF_NOTIFICATION_OUT' q, msg_state, COUNT(*) cnt,
       TO_CHAR(CAST(MIN(enq_time) AS DATE),'DD-MON HH24:MI') oldest
FROM   applsys.aq$wf_notification_out GROUP BY msg_state
UNION ALL
SELECT 'WF_NOTIFICATION_IN', msg_state, COUNT(*),
       TO_CHAR(CAST(MIN(enq_time) AS DATE),'DD-MON HH24:MI')
FROM   applsys.aq$wf_notification_in GROUP BY msg_state
UNION ALL
SELECT 'WF_DEFERRED', msg_state, COUNT(*),
       TO_CHAR(CAST(MIN(enq_time) AS DATE),'DD-MON HH24:MI')
FROM   applsys.aq$wf_deferred GROUP BY msg_state
UNION ALL
SELECT 'WF_ERROR', msg_state, COUNT(*),
       TO_CHAR(CAST(MIN(enq_time) AS DATE),'DD-MON HH24:MI')
FROM   applsys.aq$wf_error GROUP BY msg_state;

Expected normal: READY counts low (tens–low hundreds) with oldest READY only minutes old. Problem: thousands of READY and/or oldest READY hours old. A big count with a young oldest-READY is throughput pressure, not a stall; a stall is proven by AGE, not count — Phase 2 measures both.

1.4 New-notification arrival rate (storm confirmation, 10 seconds)

SELECT COUNT(*) notifications_last_hour
FROM   wf_notifications
WHERE  begin_date > SYSDATE - 1/24;

Compare against your known baseline (pull the same hour yesterday/last week in Phase 3). 5–10× baseline = storm.


PHASE 2 — Workflow AQ queue backlog analysis

AQ view column notes (applies to all AQ$<queue_table> views): msg_state: READY (waiting to be dequeued), WAIT (delay not yet elapsed), PROCESSED (dequeued, retained until retention time expires), EXPIRED (exceeded max retries → moved to the exception queue). enq_time/deq_time are TIMESTAMP WITH TIME ZONECAST(... AS DATE) before date arithmetic. PROCESSED rows exist only while queue retention keeps them; treat their absence as "retention=0", not "no throughput".

2.1 WF_NOTIFICATION_IN — inbound approval emails

What it does: the Mailer enqueues every valid inbound email response here; the Workflow Inbound Notifications Agent Listener dequeues it and executes the response (calls the Respond API → Workflow Engine).

2.1a State summary, oldest/newest, age

SELECT msg_state,
       COUNT(*)                                          cnt,
       TO_CHAR(CAST(MIN(enq_time) AS DATE),'DD-MON-YYYY HH24:MI:SS') oldest,
       TO_CHAR(CAST(MAX(enq_time) AS DATE),'DD-MON-YYYY HH24:MI:SS') newest,
       ROUND((SYSDATE - CAST(MIN(enq_time) AS DATE))*24*60,1)        oldest_age_min
FROM   applsys.aq$wf_notification_in
GROUP  BY msg_state
ORDER  BY msg_state;

2.1b Expired / retried messages (poison messages)

SELECT msg_state, retry_count, COUNT(*) cnt
FROM   applsys.aq$wf_notification_in
GROUP  BY msg_state, retry_count
ORDER  BY retry_count DESC;

2.1c Arrival vs processing rate per hour (this is the "faster in than out?" answer)

-- Arrivals per hour (enqueue by mailer)
SELECT TO_CHAR(CAST(enq_time AS DATE),'DD-MON HH24') hr, COUNT(*) enqueued
FROM   applsys.aq$wf_notification_in
WHERE  CAST(enq_time AS DATE) > SYSDATE - 1
GROUP  BY TO_CHAR(CAST(enq_time AS DATE),'DD-MON HH24')
ORDER  BY 1;

-- Dequeues per hour (inbound listener throughput) — needs retention > 0
SELECT TO_CHAR(CAST(deq_time AS DATE),'DD-MON HH24') hr, COUNT(*) dequeued
FROM   applsys.aq$wf_notification_in
WHERE  deq_time IS NOT NULL
AND    CAST(deq_time AS DATE) > SYSDATE - 1
GROUP  BY TO_CHAR(CAST(deq_time AS DATE),'DD-MON HH24')
ORDER  BY 1;
Result pattern Interpretation
READY ≈ 0, oldest READY < 5 min Inbound listener healthy — delay is upstream (IMAP/mailer/mail server)
READY large, oldest READY old, dequeues/hr ≈ 0 Cause E — Inbound Agent Listener down/stuck (check 1.1, Phase 6 sessions, Phase 7 listener log)
READY large but dequeues/hr healthy and enq/hr larger Cause D-as-symptom — listener keeping up but flooded; look at what's flooding it
enq/hr near zero while users report replying Emails never reaching WF_NOTIFICATION_IN — Cause B/C/J (mailer down, IMAP backlog, mail-server delay) → Phase 4/7/10

2.2 WF_DEFERRED — deferred Workflow Engine work

What it does: activities the engine defers (cost above threshold) plus most Business Events, including oracle.apps.wf.notification.send (which stages outbound notifications). Processed by the Workflow Deferred Agent Listener (and Java counterpart on WF_JAVA_DEFERRED).

SELECT msg_state,
       COUNT(*) cnt,
       TO_CHAR(CAST(MIN(enq_time) AS DATE),'DD-MON-YYYY HH24:MI:SS') oldest,
       TO_CHAR(CAST(MAX(enq_time) AS DATE),'DD-MON-YYYY HH24:MI:SS') newest,
       ROUND((SYSDATE - CAST(MIN(enq_time) AS DATE))*24*60,1)        oldest_age_min
FROM   applsys.aq$wf_deferred
GROUP  BY msg_state;

Which events are backlogged (corr_id = event name):

SELECT corr_id, msg_state, COUNT(*) cnt,
       TO_CHAR(CAST(MIN(enq_time) AS DATE),'DD-MON HH24:MI') oldest
FROM   applsys.aq$wf_deferred
WHERE  msg_state IN ('READY','WAIT')
GROUP  BY corr_id, msg_state
ORDER  BY cnt DESC
FETCH FIRST 25 ROWS ONLY;

Expected normal: READY drains within minutes. Problem: oldest READY > 30–60 min = Cause F (deferred backlog). If the dominant corr_id is APPS:oracle.apps.wf.notification.send, the storm is choking notification staging — outbound and engine progress both suffer. If it's an application event, that names your storm source.

2.3 WF_NOTIFICATION_OUT — outbound emails awaiting SMTP send

What it does: the Mailer's outbound feed. One message per email to be sent. This is where an email storm physically piles up.

SELECT msg_state,
       COUNT(*) cnt,
       TO_CHAR(CAST(MIN(enq_time) AS DATE),'DD-MON-YYYY HH24:MI:SS') oldest,
       ROUND((SYSDATE - CAST(MIN(enq_time) AS DATE))*24*60,1)        oldest_age_min
FROM   applsys.aq$wf_notification_out
GROUP  BY msg_state;

-- Mailer send throughput per hour (needs retention > 0)
SELECT TO_CHAR(CAST(deq_time AS DATE),'DD-MON HH24') hr, COUNT(*) sent
FROM   applsys.aq$wf_notification_out
WHERE  deq_time IS NOT NULL
AND    CAST(deq_time AS DATE) > SYSDATE - 1
GROUP  BY TO_CHAR(CAST(deq_time AS DATE),'DD-MON HH24')
ORDER  BY 1;

Problem: tens of thousands READY + mailer restarts in 1.2 = Causes A + B + K interacting. A WAIT state spike here usually means failed sends waiting for retry (SMTP trouble).

2.4 Other relevant queues

Queue Role Why it matters here
WF_JAVA_DEFERRED Java-subscription deferred events Java listeners stuck → some notifications never stage
WF_ERROR / WF_JAVA_ERROR Errored activities/events → WFERROR notifications An error loop generates emails — classic storm engine
WF_IN / WF_OUT Legacy external agent queues Usually idle; backlog = old integrations misbehaving
WF_CONTROL Container control messages (GSM ↔ components) Don't judge by counts; messages expire by design
SELECT 'WF_JAVA_DEFERRED' q, msg_state, COUNT(*) cnt,
       ROUND((SYSDATE - CAST(MIN(enq_time) AS DATE))*24*60,1) oldest_age_min
FROM applsys.aq$wf_java_deferred GROUP BY msg_state
UNION ALL
SELECT 'WF_JAVA_ERROR', msg_state, COUNT(*),
       ROUND((SYSDATE - CAST(MIN(enq_time) AS DATE))*24*60,1)
FROM applsys.aq$wf_java_error GROUP BY msg_state
UNION ALL
SELECT 'WF_ERROR', msg_state, COUNT(*),
       ROUND((SYSDATE - CAST(MIN(enq_time) AS DATE))*24*60,1)
FROM applsys.aq$wf_error GROUP BY msg_state;

Interpretation: large/growing WF_ERROR READY → find the failing item type (Phase 3.4) — an ERROR retry loop mailing SYSADMIN is one of the most common EBS email storms.


PHASE 3 — Email-volume / notification-storm analysis

All queries here are on WF_NOTIFICATIONS (one row per notification, begin_date = creation time). Change the window (SYSDATE - 1/24, - 6/24, - 1) to get the 1 h / 6 h / 24 h views.

3.1 STATUS and MAIL_STATUS distribution (last 24 h)

SELECT status, mail_status, COUNT(*) cnt
FROM   wf_notifications
WHERE  begin_date > SYSDATE - 1
GROUP  BY status, mail_status
ORDER  BY cnt DESC;

Status meanings — read these before concluding anything:

Column Value Meaning Caution
STATUS OPEN Awaiting response/close Normal for FYI + pending approvals
STATUS CLOSED Responded/closed
STATUS CANCELED Canceled (e.g., re-approval reset) Mass CANCELED bursts can themselves send "canceled" mails
MAIL_STATUS MAIL Queued for the mailer, email not yet confirmed sent Big MAIL count = outbound backlog, says nothing about inbound
MAIL_STATUS SENT Mailer sent the email No timestamp of send stored here
MAIL_STATUS ERROR Send failed Check mailer log for the SMTP error
MAIL_STATUS WAIT Awaiting retry/more info
MAIL_STATUS INVALID Bad/unresolvable address Spikes after HR/user changes
MAIL_STATUS NULL No email required (recipient preference, or closed before send) NULL/SENT on an approved-but-stuck PO does NOT mean the inbound response arrived — inbound progress is proven only by WF_COMMENTS / activity end_date (Phase 5)

3.2 Notifications per hour (find the storm start time)

SELECT TO_CHAR(begin_date,'DD-MON HH24') hr, COUNT(*) cnt
FROM   wf_notifications
WHERE  begin_date > SYSDATE - 2
GROUP  BY TO_CHAR(begin_date,'DD-MON HH24')
ORDER  BY 1;

Problem indicator: a step-change hour. That timestamp is your correlation anchor for mailer restarts (1.2), queue growth (Phase 2) and log errors (Phase 7).

3.3 Top generators — by type, message, recipient

-- Top 30 by item type + message (change window: 1/24, 6/24, 1)
SELECT message_type, message_name, COUNT(*) cnt,
       MIN(begin_date) first_seen, MAX(begin_date) last_seen
FROM   wf_notifications
WHERE  begin_date > SYSDATE - 1/24
GROUP  BY message_type, message_name
ORDER  BY cnt DESC
FETCH FIRST 30 ROWS ONLY;

-- Top 30 recipients (a single role/user drowning in mail = loop or bad routing rule)
SELECT recipient_role, COUNT(*) cnt
FROM   wf_notifications
WHERE  begin_date > SYSDATE - 1/24
GROUP  BY recipient_role
ORDER  BY cnt DESC
FETCH FIRST 30 ROWS ONLY;

-- Hour x type matrix for the top offenders
SELECT TO_CHAR(begin_date,'DD-MON HH24') hr, message_type, COUNT(*) cnt
FROM   wf_notifications
WHERE  begin_date > SYSDATE - 1
GROUP  BY TO_CHAR(begin_date,'DD-MON HH24'), message_type
HAVING COUNT(*) > 100
ORDER  BY 1, 3 DESC;

Typical storm signatures:

Signature Likely source
message_type = WFERROR, recipient SYSADMIN Error retry loop (check WF_ERROR queue + the erroring item type)
ALR-prefixed / Alert messages Oracle Alert firing per-row instead of per-batch
Same message_name + same recipient_role every few seconds Looping workflow / bad activity transition
POAPPRV surge PO mass interface/requisition import or approval-hierarchy misconfig
Huge counts with STATUS=OPEN forever on FYI messages Notifications not being closed → re-send/reminder logic piling up

3.4 Workflow item creation rate (catches loops even before notifications)

SELECT item_type, COUNT(*) cnt, MIN(begin_date) first_seen
FROM   wf_items
WHERE  begin_date > SYSDATE - 1
GROUP  BY item_type
ORDER  BY cnt DESC
FETCH FIRST 20 ROWS ONLY;

3.5 Open notifications and aging

-- Open > 30 minutes, overall and PO-only
SELECT message_type, COUNT(*) cnt,
       ROUND((SYSDATE - MIN(begin_date))*24,1) oldest_open_hrs
FROM   wf_notifications
WHERE  status = 'OPEN'
AND    begin_date < SYSDATE - 30/1440
GROUP  BY message_type
ORDER  BY cnt DESC;

SELECT notification_id, recipient_role, subject, begin_date, mail_status
FROM   wf_notifications
WHERE  status = 'OPEN'
AND    message_type = 'POAPPRV'
AND    begin_date < SYSDATE - 30/1440
ORDER  BY begin_date
FETCH FIRST 50 ROWS ONLY;

Caution: OPEN + old is normal for approvals humans haven't answered. It only indicates a system problem when the user says "I already replied" — then trace that specific NID in Phase 5.


PHASE 4 — Workflow Mailer and Agent Listener analysis

4.1 Mailer configuration snapshot (READ-ONLY)

Purpose: capture thread counts, polling frequency, IMAP/SMTP hosts before touching anything.

SELECT c.component_name, p.parameter_name, v.parameter_value
FROM   fnd_svc_components        c,
       fnd_svc_comp_param_vals   v,
       fnd_svc_comp_params_b     p
WHERE  c.component_id = v.component_id
AND    v.parameter_id = p.parameter_id
AND    c.component_type = 'WF_MAILER'
AND    p.parameter_name NOT LIKE '%PASSWORD%'
ORDER  BY p.parameter_name;

Key parameters to note down:

Parameter Meaning Storm relevance
PROCESSOR_OUT_THREAD_COUNT Outbound sender threads 1 thread vs storm volume = Cause K
PROCESSOR_IN_THREAD_COUNT Inbound IMAP processing threads 0/low = inbound starvation
PROCESSOR_READ_TIMEOUT / PROCESSOR_MAX_LOOP_SLEEP Polling cadence Long sleeps add fixed latency
INBOUND_SERVER / ACCOUNT / OUTBOUND_SERVER IMAP/SMTP endpoints For Phase 10 checks
MAX_INVALID_ADDR_LIST_SIZE, EXPUNGE_ON_CLOSE Inbox hygiene Giant unexpunged INBOX slows IMAP polls

4.2 Listener/mailer processing evidence in the DB

Throughput per hour was already measured in 2.1c / 2.3 (deq_time). Combine:

Evidence Healthy Unhealthy
WF_NOTIFICATION_OUT deq/hr vs WF_NOTIFICATIONS created/hr Roughly matching Created ≫ sent → outbound falling behind (B/K)
WF_NOTIFICATION_IN enq/hr vs user replies expected Matching Near zero → replies not reaching EBS (C/J or mailer down)
WF_NOTIFICATION_IN deq lag (deq_time − enq_time) Seconds See 4.3

4.3 Inbound listener latency distribution (the single most useful inbound metric)

SELECT ROUND(AVG((CAST(deq_time AS DATE) - CAST(enq_time AS DATE))*24*60),1) avg_min,
       ROUND(MAX((CAST(deq_time AS DATE) - CAST(enq_time AS DATE))*24*60),1) max_min,
       COUNT(*) sample
FROM   applsys.aq$wf_notification_in
WHERE  deq_time IS NOT NULL
AND    CAST(enq_time AS DATE) > SYSDATE - 1;

Expected normal: avg well under a minute. Problem: minutes/hours → the listener (E) or its downstream engine work (F/G/H) is the bottleneck — Phase 6 tells you which (waiting session vs blocked session vs no session).


PHASE 5 — Trace one delayed PO approval end-to-end

Inputs: PO number (+ org), NID if known, user, approx time of email approval. ⚠ Joins marked [impl-varies] can differ if the PO approval workflow is customized (custom item type, custom notification, AME). Verify item_type before trusting results.

5.1 PO → workflow item key

SELECT poh.po_header_id, poh.segment1 po_number, poh.org_id,
       poh.authorization_status, poh.approved_flag, poh.approved_date,
       poh.wf_item_type, poh.wf_item_key,
       poh.last_update_date, poh.last_updated_by
FROM   po_headers_all poh
WHERE  poh.segment1 = '&po_number'
AND    poh.org_id   = &org_id;      -- omit org_id only if segment1 is globally unique

5.2 Full activity history for that item (current + history)

SELECT ias.item_type, ias.item_key,
       pa.instance_label            activity,
       ias.activity_status,
       ias.activity_result_code,
       ias.notification_id          group_id,        -- joins wf_notifications.group_id
       TO_CHAR(ias.begin_date,'DD-MON HH24:MI:SS') act_begin,
       TO_CHAR(ias.end_date,  'DD-MON HH24:MI:SS') act_end,
       ias.error_name
FROM   wf_item_activity_statuses ias,
       wf_process_activities     pa
WHERE  ias.item_type = 'POAPPRV'                 -- [impl-varies] custom item types exist
AND    ias.item_key  = '&wf_item_key'
AND    ias.process_activity = pa.instance_id
UNION ALL
SELECT h.item_type, h.item_key, pa.instance_label, h.activity_status,
       h.activity_result_code, h.notification_id,
       TO_CHAR(h.begin_date,'DD-MON HH24:MI:SS'),
       TO_CHAR(h.end_date,  'DD-MON HH24:MI:SS'),
       h.error_name
FROM   wf_item_activity_statuses_h h,
       wf_process_activities       pa
WHERE  h.item_type = 'POAPPRV'
AND    h.item_key  = '&wf_item_key'
AND    h.process_activity = pa.instance_id
ORDER  BY act_begin;

What to look for: the notification activity should show NOTIFIED while waiting, then COMPLETE with result (e.g., APPROVED) once the response is processed. The gap between the user's email-send time and act_end of the notification activity IS the system delay you're hunting. A row stuck in DEFERRED afterwards points to F; ERROR points to I (check error_name + WF_ERROR queue).

5.3 The notification itself + the recorded response

-- Notification (join by GROUP_ID — an activity NID is the group id, not always the row NID)
SELECT n.notification_id, n.group_id, n.recipient_role, n.status, n.mail_status,
       TO_CHAR(n.begin_date,'DD-MON HH24:MI:SS') created,
       TO_CHAR(n.end_date,  'DD-MON HH24:MI:SS') closed,
       n.original_recipient, n.responder, n.subject
FROM   wf_notifications n
WHERE  n.group_id = &group_id_from_5_2
ORDER  BY n.notification_id;

-- Response values captured on the notification
SELECT na.name, na.text_value, na.number_value, na.date_value
FROM   wf_notification_attributes na
WHERE  na.notification_id = &notification_id
AND    na.name IN ('RESULT','RESPONDER','#FROM_ROLE');   -- RESULT = APPROVED/REJECTED

-- Response arrival record (12.2 stores responses/actions in WF_COMMENTS)
SELECT wc.notification_id, wc.from_role, wc.to_role, wc.action, wc.action_type,
       TO_CHAR(wc.comment_date,'DD-MON HH24:MI:SS') comment_time,
       SUBSTR(wc.user_comment,1,200) user_comment
FROM   wf_comments wc
WHERE  wc.notification_id = &notification_id
ORDER  BY wc.comment_date;

wf_comments.comment_date for the RESPOND/email action is your best DB-side approximation of "when EBS processed the reply". Comparing it with the user's mail-client send time isolates the mail-server + IMAP + mailer-inbound legs (which the DB cannot see) from the DB-side legs (which it can).

5.4 PO approval action record [impl-varies]

SELECT pah.sequence_num, pah.action_code,
       TO_CHAR(pah.action_date,'DD-MON HH24:MI:SS') action_time,
       pah.employee_id, pah.note
FROM   po_action_history pah
WHERE  pah.object_id        = &po_header_id
AND    pah.object_type_code IN ('PO','PA')
ORDER  BY pah.sequence_num;

PHASE 6 — Notification response timing model

For one NID, assemble this table. Bold rows are stored in the database; the rest need logs.

# Stage Timestamp source Stored in DB?
1 Notification created wf_notifications.begin_date Yes
2 Staged for mailer aq$wf_notification_out.enq_time (while retained) Partly
3 Email sent (SMTP) Mailer log only (mail_status=SENT has no timestamp) No
4 User clicked Approve / sent reply User's mail client / mail-server logs No
5 Reply landed in WF IMAP inbox Mail-server logs / message Received: headers No
6 Mailer enqueued reply aq$wf_notification_in.enq_time Yes
7 Listener dequeued reply aq$wf_notification_in.deq_time (retention>0) Yes
8 Response recorded wf_comments.comment_date (RESPOND) Yes
9 Notification closed wf_notifications.end_date Yes
10 Notification activity completed wf_item_activity_statuses(.._h).end_date Yes
11 PO approved/updated po_action_history.action_date, po_headers_all.approved_date Yes

Delay attribution:

Large gap between Root-cause bucket
4 → 6 B / C / J (mailer down or slow IMAP polling, mailbox backlog, corporate mail routing)
6 → 7 D / E (WF_NOTIFICATION_IN backlog / inbound listener)
7 → 9/10 F / G / H / I (deferred backlog, engine, DB blocking, PO workflow logic)
10 → 11 I (post-approval PO activities, doc manager, custom code)

PHASE 7 — Database session / blocking / performance analysis

7.1 Workflow-related sessions

SELECT s.inst_id, s.sid, s.serial#, s.username, s.status,
       s.module, s.action, s.program, s.sql_id, s.event, s.wait_class,
       s.seconds_in_wait, s.blocking_session, s.last_call_et,
       TO_CHAR(s.logon_time,'DD-MON HH24:MI') logon
FROM   gv$session s
WHERE  s.username = 'APPS'
AND (  UPPER(s.module) LIKE '%WF%'
    OR UPPER(s.module) LIKE '%WORKFLOW%'
    OR UPPER(s.action) LIKE '%WF%'
    OR UPPER(s.program) LIKE '%FNDSM%'
    OR s.module LIKE 'e:FND:cp:%' )
ORDER  BY s.blocking_session NULLS LAST, s.last_call_et DESC;

(Single instance: use v$session and drop inst_id.) Mailer/listener JDBC sessions typically show program = JDBC Thin Client with WF modules/actions.

Expected normal: mostly INACTIVE (idle between polls) or short ACTIVE bursts; waits like AQ: ... idle waits are fine. Problem: ACTIVE with high last_call_et, non-idle waits (enq: TX - row lock contention, buffer busy waits, db file sequential read storms), or a populated blocking_session.

7.2 Blocking tree and locked WF/PO objects

-- Who blocks whom
SELECT LPAD(' ',2*(LEVEL-1)) || s.sid blocked_tree, s.serial#, s.username,
       s.event, s.sql_id, s.seconds_in_wait, s.module
FROM   gv$session s
WHERE  LEVEL > 1 OR EXISTS
       (SELECT 1 FROM gv$session x WHERE x.blocking_session = s.sid)
CONNECT BY PRIOR s.sid = s.blocking_session
START WITH s.blocking_session IS NULL;

-- Locks held on WF_/PO_ tables
SELECT o.owner, o.object_name, lo.session_id, lo.oracle_username,
       lo.locked_mode, s.module, s.event
FROM   v$locked_object lo, dba_objects o, v$session s
WHERE  lo.object_id = o.object_id
AND    s.sid = lo.session_id
AND   (o.object_name LIKE 'WF\_%' ESCAPE '\' OR o.object_name LIKE 'PO\_%' ESCAPE '\');

Problem: row-lock contention on WF_NOTIFICATIONS / WF_ITEM_ACTIVITY_STATUSES / PO_HEADERS_ALL = Cause H. Note the blocker's module — a stuck form/user session or a batch job holding a PO row will serialize every approval behind it. Do not kill anything; record SID/SQL_ID.

7.3 What SQL the listener/engine is grinding on

SELECT sql_id, executions, ROUND(elapsed_time/1e6/NULLIF(executions,0),3) sec_per_exec,
       buffer_gets, disk_reads, SUBSTR(sql_text,1,120) sql_text
FROM   v$sqlarea
WHERE  (UPPER(sql_text) LIKE '%WF_NOTIFICATION%' OR UPPER(sql_text) LIKE '%WF_ITEM_ACTIVITY%')
AND    parsing_schema_name = 'APPS'
ORDER  BY elapsed_time DESC
FETCH FIRST 20 ROWS ONLY;

High sec_per_exec on WF queries often points at bloated WF tables/queues (millions of never-purged rows) degrading every dequeue/update — a capacity finding for the post-RCA remediation list, not for now.


PHASE 8 — Concurrent processing checks

SELECT r.request_id, t.user_concurrent_program_name prog, r.phase_code, r.status_code,
       TO_CHAR(r.actual_start_date,'DD-MON HH24:MI') started,
       TO_CHAR(r.actual_completion_date,'DD-MON HH24:MI') ended,
       ROUND((NVL(r.actual_completion_date,SYSDATE)-r.actual_start_date)*24*60) run_min,
       r.argument_text
FROM   fnd_concurrent_requests    r,
       fnd_concurrent_programs_tl t
WHERE  r.concurrent_program_id = t.concurrent_program_id
AND    r.program_application_id = t.application_id
AND    t.language = 'US'
AND    t.user_concurrent_program_name LIKE 'Workflow%'
AND    r.requested_start_date > SYSDATE - 1
ORDER  BY r.actual_start_date DESC;

Role clarification — Workflow Background Process (FNDWFBG): It is NOT in the email-response path. Inbound responses are processed online by the Inbound Notifications Agent Listener → Workflow Engine. FNDWFBG matters only indirectly:

  • it processes deferred activities (if scheduled with deferred=Y) — so if the PO workflow defers activities after the response, a missing/slow FNDWFBG (or Deferred Agent Listener) delays the final PO status update;
  • it processes timed-out and stuck items — relevant to cleanup, not to response latency.

Problem indicators: FNDWFBG not scheduled at all, erroring, or running for hours (a symptom of WF_DEFERRED bloat / storm volume, i.e., evidence for A/F, not a cause to fix by itself).


PHASE 9 — Workflow Mailer / Agent Listener log analysis

9.1 Which logs

Component Log Location
Notification Mailer (WFMLRSVC container) FNDCPGSC<pid>.txt $APPLCSF/$APPLLOG on the CM node (exact path = logfile_name from query 1.2)
Agent Listener service (WFALSNRSVC container) FNDCPGSC<pid>.txt (separate pid) same
GSM / Service Manager FNDSM* / ICM log $APPLCSF/$APPLLOG
DB-side AQ/WF errors alert log + FND_LOG_MESSAGES (if AFLOG enabled) DB node / query below
-- If FND logging was on for WF (module 'wf.%'):
SELECT TO_CHAR(timestamp,'DD-MON HH24:MI:SS') ts, module, SUBSTR(message_text,1,200) msg
FROM   fnd_log_messages
WHERE  module LIKE 'wf%'
AND    timestamp > SYSDATE - 1
ORDER  BY timestamp DESC FETCH FIRST 200 ROWS ONLY;

9.2 OS-level search (READ-ONLY)

cd $APPLCSF/$APPLLOG      # CM node from 1.2

# Errors and exceptions in mailer/listener container logs, last-modified first
ls -lt FNDCPGSC*.txt | head
egrep -in 'ORA-|WFMAIL|SQLException|OutOfMemory|Exception' FNDCPGSC<mailer_pid>.txt | tail -100
egrep -in 'imap|smtp|socket|timeout|authentication|unable to connect|connection re(set|fused)' \
      FNDCPGSC<mailer_pid>.txt | tail -100

# Inbound processing + a specific notification id (NIDs appear as e.g. 2846290/1)
egrep -in 'inbound|processing message|moved message|discard|unsolicited' FNDCPGSC<mailer_pid>.txt | tail -100
grep  -in '&NID' FNDCPGSC<mailer_pid>.txt

# Restart/bounce evidence
egrep -in 'shutting down|shutdown|starting|started|deactivat|restart' FNDCPGSC<mailer_pid>.txt
egrep -in 'WFMLRSVC|Workflow Mailer' $APPLCSF/$APPLLOG/FNDSM*.txt | tail -50

9.3 Correlating a delayed approval with the logs

  1. From Phase 5/6 take: user reply time (T4), enq_time into WF_NOTIFICATION_IN (T6).
  2. In the mailer log between T4 and T6, find the IMAP poll cycles: long silent gaps = mailer down or sleeping; repeated unable to connect/auth errors = IMAP problem; "processing message"/NID lines show exactly when the reply was read.
  3. If the log shows the reply read at T4+minutes but enq_time is much later → DB-side enqueue stall (rare; check Phase 7 waits at that time).
  4. If the log shows nothing until long after T4 and the container restarted repeatedly (9.2 restart grep) → the bounce loop is the inbound delay: every restart re-initializes IMAP and re-scans the inbox — with a storm-bloated inbox each scan is slow, compounding the loop.

If log level is too low to see message-level lines, the increase (Log Level = STATEMENT via OAM) is a config change — park it for the remediation phase, don't do it mid-RCA unless approved.


PHASE 10 — Mailbox / IMAP stage isolation

Leg How to test (read-only) Delay here means
User → corporate mail server Received: headers of the reply message (mail team pulls one sample) J — client/relay delay, not EBS
Corporate server → WF IMAP inbox Mail-server delivery logs for the WF account; header timestamps J/C
WF INBOX → Mailer read Mailbox counts (below) + mailer log poll cycle B/C/K
Mailer → WF_NOTIFICATION_IN mailer log "processing" line vs enq_time rare; DB waits
WF_NOTIFICATION_IN → Listener 4.3 latency query D/E
Listener → Engine → PO Phase 5/6 gaps 7→11 F/G/H/I

Mailbox counts (ask mail team, or view the WF account mailbox read-only): message counts and oldest-message age in INBOX, PROCESS, and DISCARD folders.

Observation Interpretation
INBOX piling up, PROCESS moving Mailer reading slower than arrival (threads/capacity — K)
INBOX piling up, PROCESS static Mailer not polling at all (down/bouncing — B)
Thousands of old messages never expunged Every poll rescans them → slow polls; also check DISCARD growth from auto-replies/bounces
Auto-reply/out-of-office storm to the WF account Mail loop: outbound storm → OOO replies → inbound flood — A feeding C/D

PHASE 11 — Root-cause decision matrix

Correlate — never classify from one number:

# Evidence combination Classification
1 3.2 step-change + one dominant generator in 3.3 A — email storm (name the item/message)
2 NOTIFICATION_OUT huge/old + mailer OOM/restarts (1.2, 9.2) B (+ K if threads minimal)
3 INBOX old messages + PROCESS static + mailer log gaps C (driven by B)
4 NOTIFICATION_IN READY old + listener RUNNING + slow deq D/E — listener capacity or stuck session (7.1)
5 4.3 latency high + listener STOPPED_ERROR E
6 WF_DEFERRED oldest READY hours + 5.2 rows DEFERRED after respond F
7 Sessions ACTIVE, non-idle waits, no blockers, all queues aging G (engine/DB throughput)
8 blocking_session populated, TX locks on WF/PO tables H
9 5.2 shows response processed fast but PO activities slow/ERROR I
10 Header timestamps show delay before WF inbox J
11 Thread counts=1, inbox never expunged, undersized JVM in log K

Most common storyline matching your symptoms: A → B (+K) → C → intermittent D. The storm floods WF_NOTIFICATION_OUT, the mailer JVM thrashes and GSM bounces it, IMAP polling stops during every bounce, approval replies age in the INBOX, and each restart's inbox rescan is slower because of the storm's own bounce-backs. The inbound listener and engine are often healthy — verify with 4.3 before blaming them.


Final summary table (fill during execution)

Check Current Evidence Normal Problem Indicator Likely Cause Next Action
Component status (1.1) All RUNNING STOPPED_ERROR / thrashing B/E/K Phase 9 logs
Container restarts (1.2) 1 old Active row Multiple starts <24 h B Phase 9 restart grep
WF_NOTIFICATION_OUT (2.3) READY low, young Huge + old A/B/K 3.3 top generators
WF_NOTIFICATION_IN age (2.1) oldest READY < 5 min Hours old D/E 4.3 + 7.1
IN latency deq−enq (4.3) < 1 min avg Minutes+ E/G/H 7.1/7.2
WF_DEFERRED age (2.2) Drains in minutes Hours old F corr_id breakdown
WF_ERROR growth (2.4) Stable Growing fast A (error loop) Failing item type
Notifications/hr (3.2) Baseline Step change A Storm start anchor
Top generator (3.3) Spread One dominant A Owner of that workflow
Traced PO gap 4→6 (Ph.6) < 2–3 min Large B/C/J Mail logs / Phase 10
Traced PO gap 6→7 Seconds Large D/E Listener
Traced PO gap 7→11 Seconds–min Large F/G/H/I 5.2 statuses + 7.2
Blocking (7.2) None TX locks on WF/PO H Record blocker
FNDWFBG (Ph.8) Scheduled, minutes Missing/erroring/hours F symptom After storm fixed

End of runbook. Corrective actions (mailer tuning, queue drain strategy, storm-source fix, inbox hygiene) to be designed only after the matrix above is filled in and the cause classified.


Disclaimer: run all queries with a read-only mindset on production; validate object names against your patch level. Corrective actions (mailer tuning, storm-source fixes, queue drain strategy, inbox hygiene) belong to a separate remediation phase — only after the root cause is classified.