快速导出导入expdp/impdp的停止与重启动

发表于:2007-05-25来源:作者:点击数: 标签:expdpimpdp导出停止导入
通过API调用,把传统的expimp类交互模式的操作转变成为 数据库 内部的job任务 从而实现了任务的可中止与重启动 当然,重启动还依赖于另外一个数据结构MT(master table),任务主表该表用于记录导出导入任务的进度. 1. 主要参数说明 我们先看一下Oracle的帮助说

  通过API调用,把传统的expimp类交互模式的操作转变成为数据库内部的job任务
  
  从而实现了任务的可中止与重启动
  
  当然,重启动还依赖于另外一个数据结构MT(master table),任务主表该表用于记录导出导入任务的进度.
  
  1. 主要参数说明
  
  我们先看一下Oracle的帮助说明
  
  代码
  
  Cexpdp -help
  
  Export Release 10.1.0.2.0 - Production on 星期三, 19 5月, 2004 2327
  
  Copyright (c) 2003, Oracle. All rights reserved.
  
  数据泵导出实用程序提供了一种用于在 Oracle 数据库之间传输数据对象的机制。该实用程序可以使用以下命令进行调用
  
    示例 expdp scotttiger DIRECTORY=dmpdir DUMPFILE=scott.dmp
  
  您可以控制导出的运行方式。具体方法是 在 'expdp' 命令后输入各种参数。要指定各参数, 请使用关键字
  
    格式 expdp KEYWORD=value 或 KEYWORD=(value1,value2,...,valueN)
    示例 expdp scotttiger DUMPFILE=scott.dmp DIRECTORY=dmpdir SCHEMAS=scott
          或 TABLES=(T1P1,T1P2), 如果 T1 是分区表
  
  USERID 必须是命令行中的第一个参数。
  
  关键字        说明 (默认)
  ------------------------------------------------------------------------------
  ATTACH        连接到现有作业, 例如 ATTACH [=作业名]。
  CONTENT        指定要卸载的数据, 其中有效关键字为
             (ALL), DATA_ONLY 和 METADATA_ONLY。
  DIRECTORY       供转储文件和日志文件使用的目录对象。
  DUMPFILE       目标转储文件 (expdat.dmp) 的列表,
             例如 DUMPFILE=scott1.dmp, scott2.dmp, dmpdirscott3.dmp。
  ESTIMATE       计算作业估计值, 其中有效关键字为
             (BLOCKS) 和 STATISTICS。
  ESTIMATE_ONLY     在不执行导出的情况下计算作业估计值。
  EXCLUDE        排除特定的对象类型, 例如 EXCLUDE=TABLEEMP。
  FILESIZE       以字节为单位指定每个转储文件的大小。
  FLASHBACK_SCN     用于将会话快照设置回以前状态的 SCN。
  FLASHBACK_TIME    用于获取最接近指定时间的 SCN 的时间。
  FULL         导出整个数据库 (N)。
  HELP         显示帮助消息 (N)。
  INCLUDE        包括特定的对象类型, 例如 INCLUDE=TABLE_DATA。
  JOB_NAME       要创建的导出作业的名称。
  LOGFILE        日志文件名 (export.log)。
  NETWORK_LINK     链接到源系统的远程数据库的名称。
  NOLOGFILE       不写入日志文件 (N)。
  PARALLEL       更改当前作业的活动 worker 的数目。
  PARFILE        指定参数文件。
  QUERY         用于导出表的子集的谓词子句。
  SCHEMAS        要导出的方案的列表 (登录方案)。
  STATUS        在默认值 (0) 将显示可用时的新状态的情况下,
             要监视的频率 (以秒计) 作业状态。
  TABLES        标识要导出的表的列表 - 只有一个方案。
  TABLESPACES      标识要导出的表空间的列表。
  TRANSPORT_FULL_CHECK 验证所有表的存储段 (N)。
  TRANSPORT_TABLESPACES 要从中卸载元数据的表空间的列表。
  VERSION        要导出的对象的版本, 其中有效关键字为
             (COMPATIBLE), LATEST 或任何有效的数据库版本。
  
  下列命令在交互模式下有效。
  注 允许使用缩写
  
  命令        说明
  ------------------------------------------------------------------------------
  ADD_FILE       向转储文件集中添加转储文件。
             ADD_FILE=dirobjdumpfile-name
  CONTINUE_CLIENT    返回到记录模式。如果处于空闲状态, 将重新启动作业。
  EXIT_CLIENT      退出客户机会话并使作业处于运行状态。
  HELP         总结交互命令。
  KILL_JOB       分离和删除作业。
  PARALLEL       更改当前作业的活动 worker 的数目。
             PARALLEL=worker 的数目。
  START_JOB       启动恢复当前作业。
  STATUS        在默认值 (0) 将显示可用时的新状态的情况下,
             要监视的频率 (以秒计) 作业状态。
             STATUS=[interval]
  STOP_JOB       顺序关闭执行的作业并退出客户机。
             STOP_JOB=IMMEDIATE 将立即关闭
             &n
  
  其中最关键的几个命令是
  
  代码
  
  '
  CONTINUE_CLIENT    返回到记录模式。如果处于空闲状态, 将重新启动作业。
  
  START_JOB       启动恢复当前作业。
  STATUS        在默认值 (0) 将显示可用时的新状态的情况下,
             要监视的频率 (以秒计) 作业状态。
             STATUS=[interval]
  STOP_JOB       顺序关闭执行的作业并退出客户机。
             STOP_JOB=IMMEDIATE 将立即关闭
             数据泵作业。
  
  '
   
  2.执行过程中终止导出
  
  首先启动expdp执行导出操作
  注意,这里可以指定一个job_name,这个名称将是你数据库中创建的MT表的名称,如果忽略,Oracle会自动命名
  
  代码
  
  $ expdp eygleeygle directory=dpdata dumpfile=full.dmp full=y job_name=expfull
  
  Export Release 10.1.0.2.0 - 64bit Production on Monday, 26 April, 2004 1945
  
  Copyright (c) 2003, Oracle. All rights reserved.
  
  Connected to Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
  With the Partitioning, OLAP and Data Mining options
  FLASHBACK automatically enabled to preserve database integrity.
  Starting EYGLE.EXPFULL 
  
  ok,在此,你可以通过ctrl + c,退出当前交互模式退出之后,导出操作不会停止这不同于Oracle以前的exp以前的exp,如果退出交互模式,就会出错终止导出任务在10g,由于expdp是数据库内部定义的任务已经与客户端无关.
  
  退出交互之后,会进入export的命令行模式此时支持status等察看命令.
  
  代码
  
  ^C
  Export status
  
  Job EXPFULL
   Operation EXPORT            
   Mode FULL             
   State EXECUTING           
   Bytes Processed 0
   Current Parallelism 1
   Job Error Count 0
   Dump File optoracledpdatafull.dmp
    bytes written 4,096
  
   
  Worker 1 Status
   State EXECUTING           
   Object Schema WMSYS
   Object Name WM$EVENT_TYPE
   Object Type DATABASE_EXPORTSCHEMATYPETYPE_SPEC
   Completed Objects 15
   Total Objects 15
  '
  
  如果此时,想要停止该任务可以发出stop_job命令,确认后停止
  
  代码
  
  Export stop_job
  Are you sure you wish to stop this job ([y]n)
  
  $
   
  3.导出主表
  
  进入数据库,我们可以看到创建的MT表
  
  代码
  $ sqlplus eygleeygle
  
  SQLPlus Release 10.1.0.2.0 - Production on Mon Apr 26 194816 2004
  
  Copyright (c) 1982, 2004, Oracle. All rights reserved.
  
  
  Connected to
  Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
  With the Partitioning, OLAP and Data Mining options
  
  SQL select from tab where tname='EXPFULL';
  
  TNAME             TABTYPE CLUSTERID
  ------------------------------ ------- ----------
  EXPFULL            TABLE
  
  SQL desc expfull
   Name                   Null  Type
   ----------------------------------------- -------- ----------------------------
   PROCESS_ORDER                   NUMBER
   DUPLICATE                     NUMBER
   DUMP_FILEID                    NUMBER
   DUMP_POSITION                   NUMBER
   DUMP_LENGTH                    NUMBER
   DUMP_ALLOCATION                  NUMBER
   COMPLETED_ROWS                   NUMBER
   ERROR_COUNT                    NUMBER
   ELAPSED_TIME                    NUMBER
   OBJECT_TYPE_PATH                  VARCHAR2(200)
   OBJECT_PATH_SEQNO                 NUMBER
   OBJECT_TYPE                    VARCHAR2(30)
   IN_PROGRESS                    CHAR(1)
   OBJECT_NAME                    VARCHAR2(500)
   OBJECT_LONG_NAME                  VARCHAR2(4000)
   OBJECT_SCHEMA                   VARCHAR2(30)
   ORIGINAL_OBJECT_SCHEMA               VARCHAR2(30)
   PARTITION_NAME                   VARCHAR2(30)
   SUBPARTITION_NAME                 VARCHAR2(30)
   FLAGS                       NUMBER
   PROPERTY                      NUMBER
   COMPLETION_TIME                  DATE
   OBJECT_TABLESPACE                 VARCHAR2(30)
   SIZE_ESTIMATE                   NUMBER
   OBJECT_ROW                     NUMBER
   PROCESSING_STATE                  CHAR(1)
   PROCESSING_STATUS                 CHAR(1)
   BASE_PROCESS_ORDER                 NUMBER
   BASE_OBJECT_TYPE                  VARCHAR2(30)
   BASE_OBJECT_NAME                  VARCHAR2(30)
   BASE_OBJECT_SCHEMA                 VARCHAR2(30)
   ANCESTOR_PROCESS_ORDER               NUMBER
   DOMAIN_PROCESS_ORDER                NUMBER
   PARALLELIZATION                  NUMBER
   UNLOAD_METHOD                   NUMBER
   GRANULES                      NUMBER
   SCN                        NUMBER
   GRANTOR                      VARCHAR2(30)
   XML_CLOB                      CLOB
   NAME                        VARCHAR2(30)
   VALUE_T                      VARCHAR2(4000)
   VALUE_N                      NUMBER
   IS_DEFAULT                     NUMBER
   FILE_TYPE                     NUMBER
   USER_DIRECTORY                   VARCHAR2(4000)
   USER_FILE_NAME                   VARCHAR2(4000)
   FILE_NAME                     VARCHAR2(4000)
   EXTEND_SIZE                    NUMBER
   FILE_MAX_SIZE                   NUMBER
   PROCESS_NAME                    VARCHAR2(30)
   LAST_UPDATE                    DATE
   WORK_ITEM                     VARCHAR2(30)
   OBJECT_NUMBER                   NUMBER
   COMPLETED_BYTES                  NUMBER
   TOTAL_BYTES                    NUMBER
   METADATA_IO                    NUMBER
   DATA_IO                      NUMBER
   CUMULATIVE_TIME                  NUMBER
   PACKET_NUMBER                   NUMBER
   OLD_VALUE                     VARCHAR2(4000)
   SEED                        NUMBER
   LAST_FILE                     NUMBER
   USER_NAME                     VARCHAR2(30)
   OPERATION                     VARCHAR2(30)
   JOB_MODE                      VARCHAR2(30)
   CONTROL_QUEUE                   VARCHAR2(30)
   STATUS_QUEUE                    VARCHAR2(30)
   REMOTE_LINK                    VARCHAR2(4000)
   VERSION                      NUMBER
   DB_VERSION                     VARCHAR2(30)
   TIMEZONE                      VARCHAR2(64)
   STATE                       VARCHAR2(30)
   PHASE                       NUMBER
   GUID                        RAW(16)
   START_TIME                     DATE
   BLOCK_SIZE                     NUMBER
   METADATA_BUFFER_SIZE                NUMBER
   DATA_BUFFER_SIZE                  NUMBER
   DEGREE                       NUMBER
   PLATFORM                      VARCHAR2(100)
   ABORT_STEP                     NUMBER
   INSTANCE                      VARCHAR2(60)
   
  4.重新加入导出
  
  代码
  
  $ expdp eygleeygle attach=expfull
  
  Export Release 10.1.0.2.0 - 64bit Production on Monday, 26 April, 2004 1955
  
  Copyright (c) 2003, Oracle. All rights reserved.
  
  Connected to Oracle Database 10g Enterprise Edition Release 10.1.0.2.0 - 64bit Production
  With the Partitioning, OLAP and Data Mining options
  
  Job EXPFULL
   Owner EYGLE             
   Operation EXPORT            
   Creator Privs FALSE             
   GUID D8F7E955AB006291E034080020C47ED1
   Start Time Monday, 26 April, 2004 1955
   Mode FULL             
   Instance eygle
   Max Parallelism 1
   EXPORT Job Parameters
   Parameter Name   Parameter Value
     CLIENT_COMMAND    'eygle directory=dpdata dumpfile=full.dmp full=y job_name=expfull '
     DATA_ACCESS_METHOD  AUTOMATIC               
     ESTIMATE       BLOCKS                 
     INCLUDE_METADATA   1
     LOG_FILE_DIRECTORY  DPDATA                 
     LOG_FILE_NAME     export.log               
     TABLE_CONSISTENCY   0
   State IDLING             '------------注意这里'
   Bytes Processed 0
   Current Parallelism 1
   Job Error Count 0
   Dump File optoracledpdatafull.dmp
    bytes written 221,184
   
  Worker 1 Status
   State
  
  5.重新启动导出
  
  Export start_job
  
  显示输出
  
  Export continue_client
  Job EXPFULL has been reopened at Monday, 26 April, 2004 1955
  Restarting EYGLE.EXPFULL eygle directory=dpdata dumpfile=full.dmp full=y job_name=expfull
  Processing object type DATABASE_EXPORTSCHEMATABLEPRE_TABLE_ACTION
  Processing object type DATABASE_EXPORTSCHEMATABLEGRANTDE_S_TABLE_OWNER_OBJGRANTOBJECT_GRANT
  Processing object type DATABASE_EXPORTSCHEMATABLEGRANTDE_S_TABLE_NOTWGO_OBJGRANTOBJECT_GRANT
  Processing object type DATABASE_EXPORTSCHEMATABLEINDEXINDEX
  Processing object type DATABASE_EXPORTSCHEMATABLECONSTRAINTCONSTRAINT
  Processing object type DATABASE_EXPORTSCHEMATABLEINDEXSTATISTICSINDEX_STATISTICS
  Processing object type DATABASE_EXPORTSCHEMATABLESTATISTICSTABLE_STATISTICS
  Processing object type DATABASE_EXPORTSCHEMATABLECOMMENT
  Processing object type DATABASE_EXPORTSCHEMAPACKAGEPACKAGE_SPEC
  Processing object type DATABASE_EXPORTSCHEMAFUNCTIONFUNCTION
  Processing object type DATABASE_EXPORTSCHEMAFUNCTIONGRANTOBJECT_GRANT
  Processing object type DATABASE_EXPORTSCHEMAPROCEDUREPROCEDURE
  Processing object type DATABASE_EXPORTSCHEMAPACKAGECOMPILE_PACKAGEPACKAGE_SPECALTER_PACKAGE_SPEC
  Processing object type DATABASE_EXPORTSCHEMAFUNCTIONALTER_FUNCTION
  Processing object type DATABASE_EXPORTSCHEMAPROCEDUREALTER_PROCEDURE
  Processing object type DATABASE_EXPORTSCHEMAVIEWVIEW
  Processing object type DATABASE_EXPORTSCHEMAVIEWGRANTDE_S_VIEW_OWNER_OBJGRANTOBJECT_GRANT
  Processing object type DATABASE_EXPORTSCHEMAVIEWGRANTDE_S_VIEW_NOTWGO_OBJGRANTOBJECT_GRANT
  Processing object type DATABASE_EXPORTSCHEMAVIEWCOMMENT
  Processing object type DATABASE_EXPORTSCHEMATABLECONSTRAINTREF_CONSTRAINT
  Processing object type DATABASE_EXPORTSCHEMADE_S_PACKAGE_BODYPACKAGEPACKAGE_BODY
  Processing object type DATABASE_EXPORTSCHEMADE_S_TYPE_BODYTYPETYPE_BODY
  Processing object type DATABASE_EXPORTSCHEMATABLEPOST_TABLE_ACTION
  Processing object type DATABASE_EXPORTSCHEMATABLETRIGGER
  Processing object type DATABASE_EXPORTSCHEMATABLEDE_TABLE_POSTINST_ACTOBJSPROCACT_INSTANCE
  Processing object type DATABASE_EXPORTSCHEMATABLEDE_TABLE_POSTINST_ACTOBJSPROCDEPOBJ
  Processing object type DATABASE_EXPORTSCHEMADE_POST_SCHEMA_PROCOBJACTPROCOBJ
  Processing object type DATABASE_EXPORTSCHEMADE_POST_SCHEMA_PROCOBJACTPROCACT_SCHEMA
  . . exported EYGLE.BIG_TABLE 9.008 MB 100000 rows
  . . exported EYGLE.SP_TRANS_SUB 6.886 MB 136659 rows
  . . exported EYGLE.SP_ITEM 3.171 MB 29770 rows
  . . exported EYGLE.SP_RECEIVE_SUB 3.869 MB 36742 rows
  . . exported EYGLE.SP_CHK_SUB 2.662 MB 36532 rows
  . . exported EYGLE.SP_TRANS 1.948 MB 34483 rows
  . . exported EYGLE.SP_RECEIVE 739.0 KB 7822 rows
  . . exported EYGLE.T1 819.3 KB 9152 rows
  . . exported EYGLE.T2 809.7 KB 9153 rows
  . . exported EYGLE.SP_CHK 568.3 KB 7759 rows
  . . exported SYSTEM.HELP 47.65 KB 959 rows
  . . exported SYSTEM.REPCAT$_AUDIT_ATTRIBUTE 5.953 KB 2 rows
  . . exported SYSTEM.REPCAT$_OBJECT_TYPES 6.507 KB 28 rows
  . . exported SYSTEM.REPCAT$_RESOLUTION_METHOD 5.648 KB 19 rows
  . . exported SYSTEM.REPCAT$_TEMPLATE_STATUS 5.296 KB 3 rows
  . . exported SYSTEM.REPCAT$_TEMPLATE_TYPES 5.914 KB 2 rows
  . . exported TEST.RATES 5.273 KB 1 rows
  . . exported WMSYS.AQ$_WM$EVENT_QUEUE_TABLE_S 7.718 KB 1 rows
  . . exported WMSYS.WM$ENV_VARS 5.289 KB 2 rows
  . . exported WMSYS.WM$EVENTS_INFO 5.562 KB 12 rows
  . . exported WMSYS.WM$NEXTVER_TABLE 5.890 KB 1 rows
  . . exported WMSYS.WM$SYSPARAM_ALL_VALUES 6.171 KB 16 rows
  . . exported WMSYS.WM$VERSION_HIERARCHY_TABLE 5.593 KB 1 rows
  . . exported WMSYS.WM$WORKSPACES_TABLE 12.20 KB 1 rows
  . . exported WMSYS.WM$WORKSPACE_PRIV_TABLE 6.375 KB 8 rows
  . . exported OUTLN.OL$ 0 KB 0 rows
  . . exported OUTLN.OL$HINTS 0 KB 0 rows
  . . exported OUTLN.OL$NODES 0 KB 0 rows
  . . exported SYSTEM.DEF$_AQCALL 0 KB 0 rows
  . . exported SYSTEM.DEF$_AQERROR 0 KB 0 rows
  . . exported SYSTEM.DEF$_CALLDEST 0 KB 0 rows
  . . exported SYSTEM.DEF$_DEFAULTDEST 0 KB 0 rows
  . . exported SYSTEM.DEF$_DESTINATION 0 KB 0 rows
  . . exported SYSTEM.DEF$_ERROR 0 KB 0 rows
  . . exported SYSTEM.DEF$_LOB 0 KB 0 rows
  . . exported SYSTEM.DEF$_ORIGIN 0 KB 0 rows
  . . exported SYSTEM.DEF$_PROPAGATOR 0 KB 0 rows
  ............
  . . exported WMSYS.WM$VERSIONED_TABLES_UNDO_CODE 0 KB 0 rows
  . . exported WMSYS.WM$VERSION_TABLE 0 KB 0 rows
  . . exported WMSYS.WM$VT_ERRORS_TABLE 0 KB 0 rows
  . . exported WMSYS.WM$WORKSPACE_SAVEPOINTS_TABLE 0 KB 0 rows
  Master table EYGLE.EXPFULL suclearcase/" target="_blank" >ccessfully loadedunloaded
  
  Dump file set for EYGLE.EXPFULL is
  optoracledpdatafull.dmp
  Job EYGLE.EXPFULL completed with 3 error(s) at 1957
  
  
  6.关于MT表的内容
  
  MT表中记录了导出过程的详细信息包括任务设置,启动停止时间等
  
  代码
  
  SQL select from expfull;
  
  PROCESS_ORDER DUPLICATE DUMP_FILEID DUMP_POSITION DUMP_LENGTH DUMP_ALLOCATION COMPLETED_ROWS ERROR_COUNT ELAPSED_TIME OBJECT_TYPE_PATH                                 OBJECT_PATH_SEQNO OBJECT_TYPE          IN_PROGRESS OBJECT_NAME                                   OBJECT_LONG_NAME                                 OBJECT_SCHEMA         ORIGINAL_OBJECT_SCHEMA     PARTITION_NAME         SUBPARTITION_NAME          FLAGS  PROPERTY COMPLETION_TIME OBJECT_TABLESPACE       SIZE_ESTIMATE OBJECT_ROW PROCESSING_STATE PROCESSING_STATUS BASE_PROCESS_ORDER BASE_OBJECT_TYPE        BASE_OBJECT_NAME        BASE_OBJECT_SCHEMA       ANCESTOR_PROCESS_ORDER DOMAIN_PROCESS_ORDER PARALLELIZATION UNLOAD_METHOD  GRANULES    SCN GRANTOR            XML_CLOB NAME              VALUE_T                                       VALUE_N IS_DEFAULT FILE_TYPE USER_DIRECTORY                                  USER_FILE_NAME                                  FILE_NAME                                    EXTEND_SIZE FILE_MAX_SIZE PROCESS_NAME          LAST_UPDATE WORK_ITEM           OBJECT_NUMBER COMPLETED_BYTES TOTAL_BYTES METADATA_IO  DATA_IO CUMULATIVE_TIME PACKET_NUMBER OLD_VALUE                                       SEED LAST_FILE USER_NAME           OPERATION           JOB_MODE            CONTROL_QUEUE         STATUS_QUEUE          REMOTE_LINK                                     VERSION DB_VERSION           TIMEZONE                             STATE                PHASE GUID
  ------------- ---------- ----------- ------------- ----------- --------------- -------------- ----------- ------------ -------------------------------------------------------------------------------- ----------------- ------------------------------ ----------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ---------- ---------- --------------- ------------------------------ ------------- ---------- ---------------- ----------------- ------------------ ------------------------------ ------------------------------ ------------------------------ ---------------------- -------------------- --------------- ------------- ---------- ---------- ------------------------------ -------- ------------------------------ -------------------------------------------------------------------------------- ---------- ---------- ---------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- -------------------------------------------------------------------------------- ----------- ------------- ------------------------------ ----------- ------------------------------ ------------- --------------- ----------- ----------- ---------- --------------- ------------- -------------------------------------------------------------------------------- ---------- ---------- ------------------------------ ------------------------------ ------------------------------ ------------------------------ ------------------------------ -------------------------------------------------------------------------------- ---------- ------------------------------ ---------------------------------------------------------------- ------------------------------ ---------- -----
        -1     0                                        3       Job EYGLE.EXPFULL stopped due to fatal error at 1947                                                                                                                                                                                              3                                                                                                                                                                2816008                     EXPFULL                                                                                                                                                                                                                                                                 43515904                           S5EYGLE                                               EYGLE             EXPORT             FULL              KUPC$C_1_20040426194515    KUPC$S_1_20040426194515                                                 1 10.1.0.2.0           +0800                              STOPPED                 1 D8F7E
        -3     0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                 1000                                                                                                                                                                                                         
       -71     0                                                                                                                       EXPFULL                                     EXPFULL                                     EYGLE                                                                -1                                          E                                                                                                      1       1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                         
        -7     0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0      0     0        0                                                                                                                                                                                                                                                              
       -73     0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  alter session set NLS_LANGUAGE='AMERICAN' NLS_TERRITORY='CHINA' NLS_CURRENCY='¥                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                  
       -59     13                                                                                                                                                                                                                                                                                                                                                                                                                                                                  LOG_FILE_DIRECTORY       DPDATA                                                0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
       -59     14                                                                                                                                                                                                                                                                                                                                                                                                                                                                  LOG_FILE_NAME         export.log                                              0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
       -59     3                                                                                                                                                                                                                                                                                                                                                                                                                                                                  CLIENT_COMMAND         eygle directory=dpdata dumpfile=full.dmp full=y job_name=expfull              0                                                                                                                                                                                                                                                                                                                                                                                                                                                                                       
       -21     1                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                          0 DPDATA                                      full.dmp                                     optoracledpdatafull.dmp                                0       0                                                 221184                                                                                                                                                                                                                                                                                       
       -59     6                 
  
   
  7.Oracle的内部操作
  
  那么Oracle是怎样实现的MT表控制呢
  
  通过跟踪Oracle的操作我们发现Oracle通过高级队列来控制任务进度
  
  AQ$_KUPC$DATAPUMP_QUETAB_S
  
  代码
  
  00000003925F1AA0  EYGLE  000000038BB65B78  4151446497  51j6z63vr42z1   INSERT INTO SYS.AQ$_KUPC$DATAPUMP_QUETAB_S (subscriber_
  00000003925F1AA0  EYGLE  000000038BCA33B0  2285637500  69bk4d643s3vw  SELECT TYPE_OID FROM ALL_TYPES WHERE OWNER = B2 AND TYPE_NA
  00000003925F1AA0  EYGLE  000000038FE415E0  2454589565  6hnwmcf94w43x  table_1_ff_144_0_0_0
  00000003925F1AA0  EYGLE  000000038FE415E0  2454589565  6hnwmcf94w43x  table_1_ff_144_0_0_0
  00000003925F1AA0  EYGLE  000000038C09DF60  1165636759  6bqx37x2rnd4r  SELECT NVL(VALUE,'8.0') FROM V$PARAMETER WHERE NAME = 'compa
  00000003925F1AA0  EYGLE  000000038C1C3710  3297653962  9u61k5r28wd6a  SELECT COUNT() FROM EYGLE.EXPFULL WHERE process_order =
  00000003925F1AA0  EYGLE  000000038BB84D80  1109544192  d021z3j124m80   SELECT subscriber_id, rule_name, trans_name, ruleset_name
  00000003925F1AA0  EYGLE  000000038B6A8980  1034967924  8c0syt8yv0qvn  BEGIN     SYS.DBMS_DATAPUMP.GET_STATUS(        
  00000003925F1AA0  EYGLE  000000038F2F40D0  1306945871  08vznc16ycuag  SELECT SYS_GUID() FROM SYS.DUAL
  00000003925F1AA0  EYGLE  000000038BCC2A90  788821427  5uaz4ncrh8xdm  SELECT inst_id FROM gv$datapump_job WHERE msg_ctrl_queue =
  00000003925F1AA0  EYGLE  000000038BC388D0  2794224121  3phhyw6m8sygt  SELECT msg_ctrl_queue, status_queue FROM gv$datapump_job WHE
  00000003925F1AA0  EYGLE  000000038C29BF80  1111260732  56gfuv913szjw  BEGIN    SYS.DBMS_OUTPUT.ENABLE(BUFSIZ);    SYS.DBMS_
  00000003925F1AA0  EYGLE  000000038C541058  2744549854  78wtzz6jtd0fy  SELECT j.owner_name, j.job_name, j.operation, j.master_id, j
  00000003925F1AA0  EYGLE  000000038F659CD0  2079757611  131b54pxzd59b  BEGIN   SYS.DBMS_DATAPUMP.START_JOB(          
  00000003925F1AA0  EYGLE  000000038F7D4870  3324291061  brq600g3299zp  SELECT INSTANCE_NUMBER FROM SYS.V$INSTANCE
  00000003925F1AA0  EYGLE  000000038CEBA128  1303949464  5ht35ht6vjc4s  SELECT guid,job_mode,start_time,degree,db_version,remote_lin
  00000003925F1AA0  EYGLE  000000038BD21B80  2943665586  a87w8z2rr9jdk  SELECT T.TYPECODE FROM TYPE$ T WHERE T.TOID = B1
  00000003925F1AA0  EYGLE  000000038DAC3EF8  3392326064  29m6xqv535kdh  SELECT job_id FROM v$datapump_session WHERE attach_id = 14
  00000003925F1AA0  EYGLE  000000038DAC3EF8  3392326064  29m6xqv535kdh  SELECT job_id FROM v$datapump_session WHERE attach_id = 14
  00000003925F1AA0  EYGLE  000000038DAC3EF8  3392326064  29m6xqv535kdh  SELECT job_id FROM v$datapump_session WHERE attach_id = 14
  00000003925F1AA0  EYGLE  000000038BCA2D50  4035761531  56ths37s8tpbv  SELECT U.NAME, O.NAME FROM SYS.OBJ$ O, SYS.COL$ C, SYS.COLTY
  00000003925F1AA0  EYGLE  000000038B5A7968  1550638733  4zr77djf6trnd  DECLARE JOBHNDL NUMBER;   BEGIN   JOBHNDL = SYS.DBMS_
  00000003925F1AA0  EYGLE  000000038C34F050  2103895117  64avhv1yqdt2d  SELECT COUNT() FROM gv$datapump_job WHERE job_id = 'D8F862A
  00000003925F1AA0  EYGLE  000000038BB746D0  4281790523  b0ymbzbzmdw1v   SELECT SYS.AQ$_KUPC$DATAPUMP_QUETAB_N.NEXTVAL FROM DUA
  00000003925F1AA0  EYGLE  000000038BB7AC40  2252012900  6zzcr8f33pzb4   SELECT count() FROM SYS.AQ$_KUPC$DATAPUMP_QUETAB_S WHE
  00000003925F1AA0  EYGLE  000000038BB77988  921503681  2y2m9bhvfu1y1   SELECT count() FROM SYS.AQ$_KUPC$DATAPUMP_QUETAB_S WHE
  00000003925F1AA0  EYGLE  000000038D1E2370  2760969371  fpuhdquk9234v  SELECT COUNT() FROM EYGLE.EXPFULL WHERE process_order =
  00000003925F1AA0  EYGLE  000000038D1E2370  2760969371  fpuhdquk9234v  SELECT COUNT() FROM EYGLE.EXPFULL WHERE process_order =
  00000003925F1AA0  EYGLE  000000038BCA3100  500501870  d8nfw3sfxa3bf  SELECT ATTRIBUTES FROM ALL_TYPES WHERE OWNER = B2 AND TYPE_
  00000003925F1AA0  EYGLE  000000038F2C61F8  2031030282  42x8y5jwhy40a  table_1_ff_14e_0_0_0
  00000003925F1AA0  EYGLE  000000038F2C61F8  2031030282  42x8y5jwhy40a  table_1_ff_14e_0_0_0
  .............
   
  Oracle在exp完成以后
  通过更新MT来修改相关对象的状态:
  
  代码
  
  00000003925F0738  EYGLE  000000038B6FC8B8  1742999483  2bbx141my83xv  SELECT DECODE(upper(read), 'TRUE', 1, 0),         
  00000003925F0738  EYGLE  000000038FE415E0  2454589565  6hnwmcf94w43x  table_1_ff_144_0_0_0
  00000003925F0738  EYGLE  000000038FE415E0  2454589565  6hnwmcf94w43x  table_1_ff_144_0_0_0
  00000003925F0738  EYGLE  000000038E78AB50  122952487  81xzsjh3p86t7  UPDATE EYGLE.EXPFULLSET state = 1 WHERE process_order =
  00000003925F0738  EYGLE  000000038DEDC800  2703499060  g6zt86qhk87tn  UPDATE EYGLE.EXPFULL SET state = 1, object_type_path =
  00000003925F0738  EYGLE  000000039038EDC8  1006510474  90aza7hxzw8ca  SELECT saddr FROM v$session WHERE sid = (SELECT sid FROM v$m
  00000003925F0738  EYGLE  000000038F1BCC08  3872533181  4pc17x3md4apx  UPDATE EYGLE.EXPFULL SET metadata_io = 1, data_io = 2,
  00000003925F0738  EYGLE  000000038C56A958  3435670659  gtp9j036chb43  SELECT NVL(MAX(last_update), 1) FROM EYGLE.EXPFULL WHER
  00000003925F0738  EYGLE  000000038B6FA330  2503628923  ckus1xyamnq3v  SELECT job_id FROM v$datapump_job WHERE owner_name = 'EYGLE'
  00000003925F0738  EYGLE  000000038B7A83A8  3381943402  96c7s4g4t8r3a  SELECT OBJECT_ID FROM ALL_OBJECTS WHERE OBJECT_NAME = 1 AND
  00000003925F0738  EYGLE  000000038DE67178  775186550  dcpu0jcr38u3q  UPDATE EYGLE.EXPFULL SET file_name = 1 WHERE rowid = 2
  
  ..............
  注意这部分内容:
  
  UPDATE EYGLE.EXPFULL SET metadata_io = 1, data_io = 2,
  UPDATE EYGLE.EXPFULLSET state = 1 WHERE process_order =
  .............
  然后Oracle会根据状态来清除这些已完成的操作
   
  代码
  
  00000003925F0738  EYGLE  000000038C6FB2E8  115850979  8ksf6a43fggr3  DELETE FROM EYGLE.EXPFULL mto WHERE (process_order 0)
  00000003925F0738  EYGLE  000000038D9C6328  2750398634  63yb59ujyzh5a  DELETE FROM EYGLE.EXPFULL WHERE process_order = 0 AND

原文转自:http://www.ltesting.net