博客
关于我
Oracle-expdp JOB 状态STOP PENDING如何改为EXECUTING
阅读量:443 次
发布时间:2019-03-06

本文共 9086 字,大约阅读时间需要 30 分钟。

一、问题,数据泵导入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 ExportLet's first create the following environment:connect / as sysdbacreate 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 partitionscreate 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 partitiondeclare  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/
directory=tmp dumpfile=parttab001_%u.dmp logfile=expdp_parttab001.log tables=test_usr.parttab001 job_name=test_usr parallel=2This shows the output:Export: Release 11.2.0.2.0 - Production on Wed Feb 8 10:56:17 2012Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsStarting "SYSTEM"."TEST_USR": system/******** directory=tmp dumpfile=parttab001_%u.dmp logfile=expdp_parttab001.log tables=test_usr.parttab001 job_name=test_usr parallel=2Estimate in progress using BLOCKS method...Processing object type TABLE_EXPORT/TABLE/TABLE_DATATotal estimation using BLOCKS method: 5.625 GBProcessing object type TABLE_EXPORT/TABLE/TABLE. . exported "TEST_USR"."PARTTAB001":"P001" 965.1 MB 1000000 rowsThe job in the database shows:connect / as sysdbaselect * from dba_datapump_jobs where job_name = 'TEST_USR'OWNER_NAME JOB_NAME------------------------------ ------------------------------OPERATION JOB_MODE------------------------------ ------------------------------STATE DEGREE ATTACHED_SESSIONS DATAPUMP_SESSIONS------------------------------ ---------- ----------------- -----------------SYSTEM TEST_USREXPORT TABLEEXECUTING 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_jobAre you sure you wish to stop this job ([yes]/no): yThe job status in the database changes to:connect / as sysdbaselect * from dba_datapump_jobs where job_name = 'TEST_USR'OWNER_NAME                     JOB_NAME------------------------------ ------------------------------OPERATION                      JOB_MODE------------------------------ ------------------------------STATE                          DEGREE     ATTACHED_SESSIONS DATAPUMP_SESSIONS------------------------------ ---------- ----------------- -----------------SYSTEM                         TEST_USREXPORT                         TABLESTOP PENDING                            2                 0                 3At 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.DMP09.02.2012 11:40 4.096         PARTTAB001_02.DMP...09.02.2012 11:40 1.968.029.696 PARTTAB001_01.DMP09.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/
attach=test_usrThis will show the status of the job:Export: Release 11.2.0.2.0 - Production on Thu Feb 9 11:54:47 2012Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.2.0 - ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsJob: TEST_USROwner: SYSTEMOperation: EXPORTCreator Privs: TRUEGUID: F7D03BB08134444FA041C5B4F085BFFFStart Time: Thursday, 09 February, 2012 11:54:56Mode: TABLEInstance: o112Max Parallelism: 2EXPORT 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=2State: IDLINGBytes Processed: 4,050,974,832Percent Done: 77Current Parallelism: 2Job Error Count: 0Dump File: /tmp/parttab001_%u.dmpDump File: /tmp/parttab001_01.dmpbytes written: 2,024,988,672Dump File: /tmp/parttab001_02.dmpbytes written: 2,026,000,384Worker 1 Status:Process Name: DW00State: UNDEFINEDWorker 2 Status:Process Name: DW01State: UNDEFINEDWorker 3 Status:Process Name: DW02State: UNDEFINEDThen restart the job with:Export> continue_clientand 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状态!

 

转载地址:http://dolyz.baihongyu.com/

你可能感兴趣的文章
mysql - 视图
查看>>
MySQL - 解读MySQL事务与锁机制
查看>>
MTTR、MTBF、MTTF的大白话理解
查看>>
mt_rand
查看>>
mysql -存储过程
查看>>
mysql /*! 50100 ... */ 条件编译
查看>>
mudbox卸载/完美解决安装失败/如何彻底卸载清除干净mudbox各种残留注册表和文件的方法...
查看>>
mysql 1264_关于mysql 出现 1264 Out of range value for column 错误的解决办法
查看>>
mysql 1593_Linux高可用(HA)之MySQL主从复制中出现1593错误码的低级错误
查看>>
mysql 5.6 修改端口_mysql5.6.24怎么修改端口号
查看>>
MySQL 8.0 恢复孤立文件每表ibd文件
查看>>
MySQL 8.0开始Group by不再排序
查看>>
mysql ansi nulls_SET ANSI_NULLS ON SET QUOTED_IDENTIFIER ON 什么意思
查看>>
multi swiper bug solution
查看>>
MySQL Binlog 日志监听与 Spring 集成实战
查看>>
MySQL binlog三种模式
查看>>
multi-angle cosine and sines
查看>>
Mysql Can't connect to MySQL server
查看>>
mysql case when 乱码_Mysql CASE WHEN 用法
查看>>
Multicast1
查看>>