一、问题,数据泵导入Undo空间不足报错,扩容后数据泵JOB并未恢复执行,JOB状态STOP PENDING如何改变
疑问1.数据泵执行导出或者导入过程中,JOB任务处于各种状态;
EXECUTING、STOP PENDING、NOT RUNNING、IDLING状态,代表什么!
疑问2,JOB任务状态如何改变?
参考
Customer RecommendedHow To Break And Restart A DataPump Export Or Import Job (Doc ID 1400974.1)
二、MOS文档内容
2.1 测试数据创建
1. DataPump Export Let's first create the following environment: connect / as sysdba create or replace directory tmp as '/tmp'; create tablespace test_tbs datafile '/tmp/test_tbs_01.dbf' size 100m autoextend on; create user test_usr identified by test_usr default tablespace test_tbs temporary tablespace temp; grant connect, resource to test_usr; connect test_usr/test_usr -- create one partitioned table with 5 partitions create table parttab001 ( col001 number, col002 varchar2(1000) ) partition by range (col001) ( partition p001 values less than (1000001), partition p002 values less than (2000001), partition p003 values less than (3000001), partition p004 values less than (4000001), partition p005 values less than (5000001) ); -- populate table, 1000000 rows per partition declare stmt varchar2(2000); begin for j in 1..5000000 loop stmt := 'insert into parttab001 values ('||to_char (j)||', lpad (to_char ('||to_char (j)||'), 1000, '||'''0'''||'))'; execute immediate stmt; -- commit after every 100000 rows if mod (j, 100000) = 0 then commit; end if; end loop; commit; end; / Then start DataPump export with: #> expdp system/<password> directory=tmp dumpfile=parttab001_%u.dmp logfile=expdp_parttab001.log
tables=test_usr.parttab001 job_name=test_usr parallel=2 This shows the output: Export: Release 11.2.0.2.0 - Production on Wed Feb 8 10:56:17 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Starting "SYSTEM"."TEST_USR": system/******** directory=tmp dumpfile=parttab001_%u.dmp logfile=expdp_parttab001.log
tables=test_usr.parttab001 job_name=test_usr parallel=2 Estimate in progress using BLOCKS method... Processing object type TABLE_EXPORT/TABLE/TABLE_DATA Total estimation using BLOCKS method: 5.625 GB Processing object type TABLE_EXPORT/TABLE/TABLE . . exported "TEST_USR"."PARTTAB001":"P001" 965.1 MB 1000000 rows The job in the database shows: connect / as sysdba select * from dba_datapump_jobs where job_name = 'TEST_USR' OWNER_NAME JOB_NAME ------------------------------ ------------------------------ OPERATION JOB_MODE ------------------------------ ------------------------------ STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS ------------------------------ ---------- ----------------- ----------------- SYSTEM TEST_USR EXPORT TABLE EXECUTING 2 1 4
也就是说,最开始执行数据泵导出时,JOB 状态为EXECUTING
2.2 STOP_JOB
Oracle 数据泵可以执行stop_job进行暂停!
To perform an orderly shutdown, use STOP_JOB (without any associated value). A warning requiring confirmation
will be issued. An orderly shutdown stops the job after worker processes have finished their current tasks. At this point break the expdp process with CTRL-C and then: Export> stop_job Are you sure you wish to stop this job ([yes]/no): y The job status in the database changes to: connect / as sysdba select * from dba_datapump_jobs where job_name = 'TEST_USR' OWNER_NAME JOB_NAME ------------------------------ ------------------------------ OPERATION JOB_MODE ------------------------------ ------------------------------ STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS ------------------------------ ---------- ----------------- ----------------- SYSTEM TEST_USR EXPORT TABLE STOP PENDING 2 0 3 At this moment, the job is still working, DataPump didn't complete the tasks. If you take a look at written dump files,
then you will see, the size still increases: 09.02.2012 11:40 1.673.117.696 PARTTAB001_01.DMP 09.02.2012 11:40 4.096 PARTTAB001_02.DMP ... 09.02.2012 11:40 1.968.029.696 PARTTAB001_01.DMP 09.02.2012 11:40 4.096 PARTTAB001_02.DMP ...
To perform an immediate shutdown, specify STOP_JOB=IMMEDIATE. A warning requiring confirmation will be issued. All attached clients,
including the one issuing the STOP_JOB command, receive a warning that the job is being stopped by the current
user and they will be detached. After all clients are detached, the process structure of the job is immediately run down. That is,
the master process will not wait for the worker processes to finish their current tasks.
There is no risk of corruption or data loss when you specify STOP_JOB=IMMEDIATE. However,
some tasks that were incomplete at the time of shutdown may have to be redone at restart time.
After the job was shutdown, the job status changes to:
connect / as sysdba
select * from dba_datapump_jobs where job_name = 'TEST_USR'
OWNER_NAME JOB_NAME
------------------------------ ------------------------------
OPERATION JOB_MODE
------------------------------ ------------------------------
STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS
------------------------------ ---------- ----------------- -----------------
SYSTEM TEST_USR
EXPORT TABLE
NOT RUNNING 0 0 0
Oracle EXPDP执行 STOP_JOB之后,JOB的状态从
EXECUTING ->STOP PENDING(停止的过程中,导出的数据还在导出)->NOT RUNNING ->最后转换为IDLING
2.3 恢复执行
The DataPump export job is now stopped. To restart the job TEST_USR, first perform: #> expdp system/<password> attach=test_usr This will show the status of the job: Export: Release 11.2.0.2.0 - Production on Thu Feb 9 11:54:47 2012 Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved. Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - Production With the Partitioning, OLAP, Data Mining and Real Application Testing options Job: TEST_USR Owner: SYSTEM Operation: EXPORT Creator Privs: TRUE GUID: F7D03BB08134444FA041C5B4F085BFFF Start Time: Thursday, 09 February, 2012 11:54:56 Mode: TABLE Instance: o112 Max Parallelism: 2 EXPORT Job Parameters: Parameter Name Parameter Value: CLIENT_COMMAND system/******** job_name=test_usr directory=tmp dumpfile=parttab001_%u.dmp
logfile=expdp_parttab001.log tables=test_usr.parttab001 parallel=2 State: IDLING Bytes Processed: 4,050,974,832 Percent Done: 77 Current Parallelism: 2 Job Error Count: 0 Dump File: /tmp/parttab001_%u.dmp Dump File: /tmp/parttab001_01.dmp bytes written: 2,024,988,672 Dump File: /tmp/parttab001_02.dmp bytes written: 2,026,000,384 Worker 1 Status: Process Name: DW00 State: UNDEFINED Worker 2 Status: Process Name: DW01 State: UNDEFINED Worker 3 Status: Process Name: DW02 State: UNDEFINED Then restart the job with: Export> continue_client and the job will continue the interrupted work.
MOS剩下的内容,只是换成IMPDP,流程一样没什么区别
2.4.其它信息
Datapump Hangs With Status DEFINING (Doc ID 1448360.1) When a job abnormally terminates or when an instance running the job is shut down,
the job is placed in the 'Not Running' state if it was previously executing or idling. It can then be restarted by the user. The master control process is active in the 'Defining', 'Idling', 'Executing', 'Stopping', 'Stop Pending', and 'Completing states'.
It is also active briefly in the 'Stopped' and 'Completed' states.
The master table for the job exists in all states except the 'Undefined state'.
Worker processes are only active in the 'Executing' and 'Stop Pending' states. Detaching while a job is in the 'Executing' state will not halt the job. You can be explicitly or implicitly detached from a job.
An explicit detachment occurs when you execute the DBMS_DATAPUMP.DETACH procedure.
An implicit detachment occurs when a session is run down, an instance is started, or the STOP_JOB procedure is called. The 'Not Running' state indicates that a master table exists outside the context of an executing job.
This will occur if a master table has been explicitly retained upon job completion,
if a job has been stopped (probably to be restarted later), or if a job has abnormally terminated.
This state can also be seen momentarily during job state transitions at the beginning of a job,
and at the end of a job before the master table is dropped.
Note that the Not Running state is shown only in the DBA_DATAPUMP_JOBS view and the USER_DATAPUMP_JOBS view.
It is never shown in the master table or returned by the GET_STATUS procedure. It is important to note that a job can also get stuck in 'DEFINING' if it can not
lock the file on a NFS mount or write to an OCFS or ACFS mount. What can be done: Performing DBMS_DATAPUMP.START_JOB on a job in an 'Idling' state will return it to an 'Executing' state. If all users execute DBMS_DATAPUMP.DETACH to detach from a job in the Defining state,
the job will be totally removed from the databa
!如果处于非Iding状态,可以执行stop_job y->置为Iding
!如果处于Iding状态,可以执行start_job or Export> continue_client 置为Start状态!