An expdp or impdp job runs as a master process and several workers, each a separate database session. When a job is slow or stuck, this maps the job name to those sessions and their OS process IDs, so you can see what each is doing and find it in top.
Usage
SQL> @dp.sql
-- dp.sql: sessions and OS processes behind each running Data Pump job
-- Copyright (c) HASHJOIN. MIT License (https://hashjoin.com/kb/license/)
-- https://hashjoin.com/kb/oracle/data-pump-job-sessions/
--
-- Usage: @dp.sql
set lines 200
set trims on
col username format a20
select to_char(LOGON_TIME,'YYYY-MM-DD HH24:MI:SS') LOGON_TIME, s.program, s.sid,
s.status, s.username, d.job_name, p.spid, s.serial#, p.pid
from v$session s, v$process p, dba_datapump_sessions d
where p.addr=s.paddr and s.saddr=d.saddr;curl -O https://hashjoin.com/kb/oracle/data-pump-job-sessions/dp.sql
Reading the output
One row per Data Pump session: logon time, program (DM00 is the master, DW00, DW01… are workers), SID, status, user, job name and SPID. Take a worker's SID to drill into one session to see its SQL and wait.
Gotchas
- Stop a job through Data Pump, not by killing sessions:
expdp user attach=JOB_NAME, thenSTOP_JOB(resumable) orKILL_JOB. Killed sessions leave the master table behind and the job half-finished. - It reads
v$views, so on RAC it shows the sessions on the instance you're connected to.
What it reads
dba_datapump_sessions v$session v$process
Tired of fixing the same thing twice?
HASHJOIN turns the checks and fixes your on-call runs by hand into tooling that gives the same answer every time. Fixed scope, and you own all of the code.
New fixes and field notes by email, about once a month.