When Data pump is running slowly or when it is hanging, determining which query is currently running will help in understanding the problem. The following script will show the SQL statement executed with the current wait event every 10 minutes.
First, create a script named dp_current_sql.sql that contains the following code.
dp_current_sql.sql
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 |
spool current_sql.out oradebug setospid &spid select to_char (sysdate, 'YYYY-MM-DD HH24:MI:SS') from dual; oradebug current_sql break by 1; select w.event, w.wait_time,w.seconds_in_wait, w.p1,w.p2,w.p3 from v$session s, v$process p, v$session_wait w where s.paddr=p.addr and s.module='Data Pump Worker' and s.sid=w.sid; exec DBMS_LOCK.SLEEP(600); select to_char (sysdate, 'YYYY-MM-DD HH24:MI:SS') from dual; oradebug current_sql break by 1; select w.event, w.wait_time,w.seconds_in_wait, w.p1,w.p2,w.p3 from v$session s, v$process p, v$session_wait w where s.paddr=p.addr and s.module='Data Pump Worker' and s.sid=w.sid; exec DBMS_LOCK.SLEEP(600); select to_char (sysdate,'YYYY-MM-DD HH24:MI:SS') from dual; oradebug current_sql break by 1; select w.event, w.wait_time,w.seconds_in_wait, w.p1,w.p2,w.p3 from v$session s, v$process p, v$session_wait w where s.paddr=p.addr and s.module='Data Pump Worker' and s.sid=w.sid; spool off; |
Connect with sqlplus as SYSDBA. Determine the SPID of the Data Pump Worker (DW00) process with the following query.
1 2 3 4 5 6 7 8 |
set lines 150 pages 100 numwidth 7 col program for a38 col username for a10 col spid for a7 select to_char (sysdate,'YYYY-MM-DD HH24:MI:SS') "DATE", 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; |
Run the dp_current_sql.sql script you created above from sqlplus. When asked for the spid value, enter the SPID value detected in the above step.
1 2 |
SQL> @dp_current_sql.sql Enter value for spid: |
When you run the script, it will produce output similar to the following. You can also find the output in the current_sql.out file in the current directory.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 |
SQL> @dp_current_sql.sql Enter value for spid: 70112 Oracle pid: 129, Unix process pid: 70112, image: oracle@oradb.oracle.local (DW00) TO_CHAR(SYSDATE,'YY ------------------- 2018-10-13 17:29:42 insert /*+ OPT_PARAM('_parallel_syspls_obey_force' 'false') */ into sys.dbms_stats_id_map_tab (c5, c1, c2, cn) select /*+ leading(s) index(s) */ distinct s.c5, s.c1, s.c2, i.partition_name cn from "SYS"."IMPDP_STATS" s, dba_ind_partitions i where s.c5 = :1 and s.c1 = :2 and s.type in ('I','i') and s.n13 is not null and s.c2 like 'SYS_%' and s.c3 is null and s.c5 = i.index_owner and s.c1 = i.index_name and s.n13 = i.partition_position and s.c2 != i.partition_name and s.statid is null EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- db file sequential read -1 2 1 151735 1 wait for unread message on broadcast channel 0 2 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 3 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 3 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 2 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 2 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 2 9981956688 1.0534E+10 0 16 rows selected. PL/SQL procedure successfully completed. TO_CHAR(SYSDATE,'YY ------------------- 2018-10-13 17:39:43 merge /*+ OPT_PARAM('_parallel_syspls_obey_force' 'false') */ into optstat_user_prefs$ d using (select o.obj#, s.c2 pname, s.n1 valnum, s.cl1 valchar, s.d1 chgtime, s.n2 spare1 from "SYS"."IMPDP_STATS" s, obj$ o, user$ u where s.c5= :ownname and s.c1= :tabname and s.type = 'P' and SYS_OP_MAP_NONNULL(s.statid) = SYS_OP_MAP_NONNULL(:stid) and o.owner#=u.user# and u.name= :ownname and o.type# = 2 and o.name= :tabname ) s on (d.obj#=s.obj# and d.pname=s.pname) when matched then update set valchar=s.valchar when NOT matched then insert (obj#, pname, valnum, valchar, chgtime, spare1) values(s.obj#, s.pname, s.valnum, s.valchar, s.chgtime, s.spare1) EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- db file sequential read -1 5 1 163263 1 wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 2 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 2 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 3 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 3 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 3 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 16 rows selected. PL/SQL procedure successfully completed. TO_CHAR(SYSDATE,'YY ------------------- 2018-10-13 17:49:43 insert /*+ OPT_PARAM('_parallel_syspls_obey_force' 'false') */ into sys.dbms_stats_id_map_tab (c5, c1, c2, cn) select /*+ leading(s) index(s) */ distinct s.c5, s.c1, s.c2, d.partition_name cn from "SYS"."IMPDP_STATS" s, (select u.name table_owner, op.name table_name, op.subname partition_name, tp.part# partition_position from user$ u, obj$ op, (select obj#, part# from tabpartv$ where bo# = :1 union all select obj#, part# from tabcompartv$ where bo# = :2 ) tp where u.user# = op.owner# and op.type# = 19 and op.obj# = tp.obj# ) d where s.c5 = :3 and s.c1 = :4 and s.type in ('T','C','E', EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- db file sequential read -1 497 1 137287 1 wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 2 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 2 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 4 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 3 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 3 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 3 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 wait for unread message on broadcast channel 0 5 9981956688 1.0534E+10 0 EVENT WAIT_TIME ---------------------------------------------------------------- ---------- SECONDS_IN_WAIT P1 P2 P3 --------------- ---------- ---------- ---------- wait for unread message on broadcast channel 0 1 9981956688 1.0534E+10 0 16 rows selected. SQL> |