ablog

不器用で落着きのない技術者のメモ

Data Pump で import を停止して、後で再開する

インポートを開始する

$ nohup impdp system/manager directory=pump_dir exclude=grant dumpfile=scott.dmp remap_schema=scott:smith parallel=4 > scott.log 2>&1 &

インポートを停止する

  • ジョブ名を確認する。
$ sqlplus / as sysdba
SQL> set linesize 200
SQL> col owner_name for a10
SQL> col job_name for a20
SQL> col operation for a10
SQL> col job_mode for a10
SQL> col state for a12
SQL> col degree for 999
SQL> col attached_sessions for 999
SQL> col datapump_sessions for 999
SQL> select * from dba_datapump_jobs;
OWNER_NAME JOB_NAME             OPERATION  JOB_MODE   STATE      DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS
---------- -------------------- ---------- ---------- ---------- ------ ----------------- -----------------
SYSTEM     SYS_IMPORT_FULL_01   IMPORT     FULL       EXECUTING       4                 1                 6
SYSTEM     SYS_EXPORT_SCHEMA_01 EXPORT     SCHEMA     EXECUTING       1                 0                 2
SQL> exit
  • ジョブを停止する。
$ impdp system/manager attach=sys_import_full_01
Import: Release 10.2.0.4.0 - Production on Saturday, 08 May, 2010 19:15:54

Copyright (c) 2003, 2007, Oracle.  All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options

Job: SYS_IMPORT_FULL_01
  Owner: SYSTEM                         
  Operation: IMPORT                         
  Creator Privs: FALSE                          
  GUID: 86067FC88FD65D19E040A8C0078A2858
  Start Time: Saturday, 08 May, 2010 3:49:11
  Mode: FULL                           
  Instance: scott
  Max Parallelism: 4
  EXPORT Job Parameters:
     CLIENT_COMMAND        system/******** directory=dump_dir dumpfile=scott.dmp schemas=scott parallel=4 logfile=scott.log flashback_time="TO_TIMESTAMP(TO_CHAR(SYSDATE,'YYYY-MM-DD HH24:MI:SS'),'YYYY-MM-DD HH24:MI:SS')" 
     FLASHBACK_TIME        10-MAY-07 12:33:21 AM                   
  IMPORT Job Parameters:
  Parameter Name      Parameter Value:
     CLIENT_COMMAND        system/******** directory=pump_dir exclude=grant dumpfile=scott.dmp remap_schema=scott:smith parallel=4 
  State: EXECUTING                      
  Bytes Processed: 16,958,041,272
  Percent Done: 99
  Current Parallelism: 4
  Job Error Count: 0
  Dump File: /u01/app/oracle/admin/scott/dpdump/scott.dmp
  
Worker 1 Status:
  State: EXECUTING                      
  Object Schema: scott_KENSYOU
  Object Name: COLLECT_DL_LOG_UK
  Object Type: SCHEMA_EXPORT/TABLE/INDEX/INDEX
  Worker Parallelism: 4
  
Worker 2 Status:
  State: WORK WAITING                   
  
Worker 3 Status:
  State: WORK WAITING                   
  
Worker 4 Status:
  State: WORK WAITING                   
Import> stop_job
Are you sure you wish to stop this job ([yes]/no): yes
  • ジョブが停止していることを確認する。
$ sqlplus / as sysdba
SQL> set linesize 200
SQL> col owner_name for a10
SQL> col job_name for a20
SQL> col operation for a10
SQL> col job_mode for a10
SQL> col state for a12
SQL> col degree for 999
SQL> col attached_sessions for 999
SQL> col datapump_sessions for 999
SQL> select * from dba_datapump_jobs;
OWNER_NAME JOB_NAME             OPERATION  JOB_MODE   STATE        DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS
---------- -------------------- ---------- ---------- ------------ ------ ----------------- -----------------
SYSTEM     SYS_IMPORT_FULL_01   IMPORT     FULL       STOP PENDING      4                 1                 4
SYSTEM     SYS_EXPORT_SCHEMA_01 EXPORT     SCHEMA     EXECUTING         1                 0                 2

インポートを再開する

  • ジョブを再開する
$ impdp system/manager attach=sys_import_full_01
Import> start_job
Import> exit_client
  • ジョブが再開していることを確認する。
$ sqlplus / as sysdba
SQL> set linesize 200
SQL> col owner_name for a10
SQL> col job_name for a20
SQL> col operation for a10
SQL> col job_mode for a10
SQL> col state for a12
SQL> col degree for 999
SQL> col attached_sessions for 999
SQL> col datapump_sessions for 999
SQL> select * from dba_datapump_jobs;

参考


追記(2010/05/18):
ジョブを完全に停止する場合は、「kill_job」を使う。これで停止するとジョブを再開することはできない。

$ impdp system/manager attach=SYS_IMPORT_SCHEMA_01 
Import> kill_job
Are you sure you wish to stop this job ([yes]/no): yes