11g的數據泵(expdp/impdp)還是有很多bug,經常遇到莫名的卡死現象,讓人不知所措,最近看了一篇文章,其實在進行數據泵導出導入的時候,可以進行日志跟蹤
啟用跟蹤功能,只需要在DataPump(expdp)或DataPump(impdp)的時候添加一個trace參數,對其指定一個7位數的十六進制。前三個數字啟用跟蹤特定的數據泵組件,而通常最後四位數字為:0300。任何前導零的可以省略,跟蹤參數指定的值是不區分大小寫的。
TRACE = 04A0300
or:
TRACE=4a0300
注意該參數的使用必須要有特定的權限,否則會報ORA-31631錯誤
% expdp scott/tiger DIRECTORY=my_dir DUMPFILE=expdp_s.dmp LOGFILE=expdp_s.log TABLES=emp TRACE=480300 Export: Release 10.2.0.3.0 - Production on Friday, 19 October, 2007 13:46:33 Copyright (c) 2003, 2005, Oracle. All rights reserved. Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - Production With the Partitioning, Oracle Label Security, OLAP and Data Mining Scoring Engine options ORA-31631: privileges are required這種情況,我們只需要授予 EXP_FULL_DATABASE 或者IMP_FULL_DATABASE角色
CONNECT / AS SYSDBA GRANT exp_full_database TO scott; % expdp scott/tiger DIRECTORY=my_dir DUMPFILE=expdp_s.dmp LOGFILE=expdp_s.log TABLES=emp TRACE=480300
這裡的參數為480300,其他Trace的參數及跟蹤的數據泵組件對應的例子有:
-- Example of combination (last 4 digits are usually 0300): 40300 to trace Process services 80300 to trace Master Control Process (MCP) 400300 to trace Worker process(es) -- + 4C0300 to trace Process services and Master Control and Worker processes生成的跟蹤日志的格式一般如下:
-- Run a Data Pump job with full tracing: -- This results in two trace files in BACKGROUND_DUMP_DEST: -- Master Process trace file: <SID>_dm<number>_<process_id>.trc -- Worker Process trace file: <SID>_dw<number>_<process_id>.trc -- And one trace file in USER_DUMP_DEST: -- Shadow Process trace file: <SID>_ora_<process_id>.trc
Data Pump trace files 寫在BACKGROUND_DUMP_DEST 和USER_DUMP_DEST.
<strong>Data Pump Master Control Process (MCP).</strong> Format : <SID>_dm<number>_<process_id>.trc Example: ORCL_dm00_2896.trc or: ORCL_dm01_3422.trc (for second active Master Control Process) Location: BACKGROUND_DUMP_DEST or <ADR_HOME>/trace <strong>Data Pump Worker Process trace file.</strong> Format : <SID>_dw<number>_<process_id>.trc Example: ORCL_dw01_2936.trc or: ORCL_dw01_2844.trc and ORCL_dw02_2986.trc (if PARALLEL=2) Location: BACKGROUND_DUMP_DEST or <ADR_HOME>/trace <strong>Data Pump Shadow Process trace file.</strong> Format : <SID>_ora_<process_id>.trc Example: ORCL_ora_3020.trc Location: USER_DUMP_DEST or <ADR_HOME>/trace
<pre name="code" class="sql">Trace file /u01/app/product/oracle/diag/rdbms/hnyy/hnyy1/trace/hnyy1_dm00_28574120.trc Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP, Data Mining and Real Application Testing options ORACLE_HOME = /u01/app/product/oracle/db_1 System name: AIX Node name: orcl1 Release: 1 Version: 6 Machine: 00F6C6C64C00 Instance name: hnyy1 Redo thread mounted by this instance: 1 Oracle process number: 559 Unix process pid: 28574120, image: oracle@orcl1 (DM00) *** 2014-12-05 13:06:38.154 *** SESSION ID:(8851.28833) 2014-12-05 13:06:38.154 *** CLIENT ID:() 2014-12-05 13:06:38.154 *** SERVICE NAME:(SYS$USERS) 2014-12-05 13:06:38.154 *** MODULE NAME:() 2014-12-05 13:06:38.154 *** ACTION NAME:() 2014-12-05 13:06:38.154 KUPP:13:06:38.142: Current trace/debug flags: 00480300 = 4719360 *** MODULE NAME:(Data Pump Master) 2014-12-05 13:06:38.195 *** ACTION NAME:(SYS_EXPORT_FULL_01) 2014-12-05 13:06:38.195 KUPC:13:06:38.194: Setting remote flag for this process to FALSE prvtaqis - Enter prvtaqis subtab_name upd prvtaqis sys table upd KUPM:13:06:38.336: Attached to control queue as MCP KUPM:13:06:38.345: While starting, control queue subscriber count is: 2 KUPP:13:06:38.346: Initialization complete for master process DM00 KUPM:13:06:38.405: Entered main loop KUPM:13:06:38.640: ****IN DISPATCH at 47198, request type=1001 KUPM:13:06:38.640: Current user is: SYSTEM KUPM:13:06:38.640: hand := DBMS_DATAPUMP.OPEN ('EXPORT', 'FULL', '', 'SYS_EXPORT_FULL_01', '', '2'); *** 2014-12-05 13:06:40.338 K UPM:13:06:40.337: Resumable enabled KUPM:13:06:40.346: Entered state: DEFINING KUPM:13:06:40.346: initing file system kwqberlst !retval block kwqberlst rqan->lagno_kwqiia 7 kwqberlst rqan->lascn_kwqiia > 0 block kwqberlst rqan->lascn_kwqiia 7 kwqberlst ascn -1500723611 lascn 22 KUPM:13:06:42.700: ****IN DISPATCH at 47202, request type=1035 KUPM:13:06:42.700: Current user is: SYSTEM KUPM:13:06:42.700: DBMS_DATAPUMP.SET_PARAMETER (hand, 'CLIENT_COMMAND', 'system/******** dumpfile=dump:full20141204b_%U_db.dmp logfile=dump:full_expdp1204b_db.log full=y exclude=STATISTICS,PACKAGE,FUNCTION,PROCEDURE,INDEX,TABLE:"IN (select table_name from dba_tab KUPM:13:06:42.700: les where table_name in ('電子病歷圖形','檢驗圖像結果','檢驗報告圖像') and owner='ZLHIS')" cluster=n TRACE=480300 '); KUPM:13:06:42.700: In Check_param_dependency with name: CLIENT_COMMAND KUPM:13:06:42.703: ****OUT DISPATCH, request type=1035, response type =2041 kwqberlst !retval block kwqberlst rqan->lagno_kwqiia 7 kwqberlst rqan->lascn_kwqiia > 0 block kwqberlst rqan->lascn_kwqiia 7 kwqberlst ascn -1500723611 lascn 22 KUPM:13:06:42.750: ****IN DISPATCH at 47202, request type=1022 KUPM:13:06:42.750: Current user is: SYSTEM KUPM:13:06:42.750: DBMS_DATAPUMP.ADD_FILE (hand, 'full20141204b_%U_db.dmp', 'DUMP', 0, , 1);