博客
关于我
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中json_extract的使用方法
查看>>
mysql中json_extract的使用方法
查看>>
mysql中kill掉所有锁表的进程
查看>>
mysql中like % %模糊查询
查看>>
MySql中mvcc学习记录
查看>>
mysql中null和空字符串的区别与问题!
查看>>
MySQL中ON DUPLICATE KEY UPDATE的介绍与使用、批量更新、存在即更新不存在则插入
查看>>
MYSQL中TINYINT的取值范围
查看>>
MySQL中UPDATE语句的神奇技巧,让你操作数据库如虎添翼!
查看>>
Mysql中varchar类型数字排序不对踩坑记录
查看>>
MySQL中一条SQL语句到底是如何执行的呢?
查看>>
MySQL中你必须知道的10件事,1.5万字!
查看>>
MySQL中使用IN()查询到底走不走索引?
查看>>
Mysql中使用存储过程插入decimal和时间数据递增的模拟数据
查看>>
MySql中关于geometry类型的数据_空的时候如何插入处理_需用null_空字符串插入会报错_Cannot get geometry object from dat---MySql工作笔记003
查看>>
mysql中出现Incorrect DECIMAL value: '0' for column '' at row -1错误解决方案
查看>>
mysql中出现Unit mysql.service could not be found 的解决方法
查看>>
mysql中出现update-alternatives: 错误: 候选项路径 /etc/mysql/mysql.cnf 不存在 dpkg: 处理软件包 mysql-server-8.0的解决方法(全)
查看>>
Mysql中各类锁的机制图文详细解析(全)
查看>>
MySQL中地理位置数据扩展geometry的使用心得
查看>>