正确停止expdp导出任务

时间:2022-07-12 14:48:46

   今天在执行导出时磁盘剩余量不够了,想提前终止expd导出任务,于是就按ctr  + c 中进入export交互界面,然后exit退出然后查看操作系统进程发现没有expdp进程了以为就是停掉了,但发现导出的dmp文件还在一直增加,其实任务并没有停止。

   如下验证结果:

1.expdp执行导出操作,然后按ctr  + c  + exit 退出

[Oracle@database ~]$expdp \"sys/oracle as sysdba\" schemas='(prod,tts_fnd,tts_cms,tts_hr,tts_ecm,tts_coa,tts_exm,tts_htm)' dumpfile=tt.dmp logfile=tt.log directory=test
Export: Release 11.2.0.4.0 - Production on Mon Jan 26 10:27:01 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Starting "SYS"."SYS_EXPORT_SCHEMA_02":  "sys/******** AS SYSDBA" schemas=(prod,tts_fnd,tts_cms,tts_hr,tts_ecm,tts_coa,tts_exm,tts_htm) dumpfile=tt.dmp logfile=tt.log directory=test 
Estimate in progress using BLOCKS method...
Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 23.98 GB
Processing object type SCHEMA_EXPORT/USER
Processing object type SCHEMA_EXPORT/SYSTEM_GRANT
Processing object type SCHEMA_EXPORT/ROLE_GRANT
Processing object type SCHEMA_EXPORT/DEFAULT_ROLE
Processing object type SCHEMA_EXPORT/TABLESPACE_QUOTA
Processing object type SCHEMA_EXPORT/PRE_SCHEMA/PROCACT_SCHEMA
Processing object type SCHEMA_EXPORT/SYNONYM/SYNONYM
Processing object type SCHEMA_EXPORT/TYPE/TYPE_SPEC
Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE
Processing object type SCHEMA_EXPORT/TABLE/TABLE
Processing object type SCHEMA_EXPORT/TABLE/GRANT/OWNER_GRANT/OBJECT_GRANT
Processing object type SCHEMA_EXPORT/TABLE/COMMENT
Processing object type SCHEMA_EXPORT/PACKAGE/PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/PROCEDURE
Processing object type SCHEMA_EXPORT/PACKAGE/COMPILE_PACKAGE/PACKAGE_SPEC/ALTER_PACKAGE_SPEC
Processing object type SCHEMA_EXPORT/FUNCTION/ALTER_FUNCTION
Processing object type SCHEMA_EXPORT/PROCEDURE/ALTER_PROCEDURE
Processing object type SCHEMA_EXPORT/TABLE/INDEX/INDEX
^C
Export> exit     ----退出

[root@database backup]# ps -ef |grep expdp     ----查看进程已经不存在了
root     17581 17434  0 10:28 pts/1    00:00:00 grep expdp

2. 发现磁盘空间一直在使用,看出导出文件dmp 一直还在增加,如下

[root@database backup]# du -sm tt.dmp 
1       tt.dmp
[root@database backup]# du -sm tt.dmp 
3       tt.dmp
[root@database backup]# ps -ef |grep expdp
root     17581 17434  0 10:28 pts/1    00:00:00 grep expdp
[root@database backup]# du -sm tt.dmp 
13      tt.dmp
[root@database backup]# 
[root@database backup]# du -sm tt.dmp 
14      tt.dmp
[root@database backup]# du -sm tt.dmp 
1767    tt.dmp
[root@database backup]# du -sm tt.dmp 
12207   tt.dmp

----导出任务其实是没有停掉

3.查看视图dba_datapump_jobs

 select job_name,state from dba_datapump_jobs;

正确停止expdp导出任务

发现任务确认还在执行

4.正确停止expdp导出任务使用stop_job

[oracle@database ~]$ expdp \"sys/oracle as sysdba\" attach=SYS_EXPORT_SCHEMA_02
Export: Release 11.2.0.4.0 - Production on Mon Jan 26 10:31:42 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
Job: SYS_EXPORT_SCHEMA_02
  Owner: SYS                            
  Operation: EXPORT                         
  Creator Privs: TRUE                           
  GUID: 0D85DF9D2F014494E053A80013AC483D
  Start Time: Monday, 26 January, 2015 10:27:03
  Mode: SCHEMA                         
  Instance: orcl
  Max Parallelism: 1
  EXPORT Job Parameters:
  Parameter Name      Parameter Value:
     CLIENT_COMMAND        "sys/******** AS SYSDBA" schemas=(prod,tts_fnd,tts_cms,tts_hr,tts_ecm,tts_coa,tts_exm,tts_htm) dumpfile=tt.dmp logfile=tt.log directory=test 
  State: EXECUTING                      
  Bytes Processed: 17,595,108,512
  Percent Done: 81
  Current Parallelism: 1
  Job Error Count: 0
  Dump File: /oracle/backup/tt.dmp
    bytes written: 17,610,469,376  
Worker 1 Status:
  Process Name: DW00
  State: EXECUTING                      
  Object Schema: TTS_EXM
  Object Name: EXM_PERSON_ITEMS
  Object Type: SCHEMA_EXPORT/TABLE/TABLE_DATA
  Completed Objects: 80
  Total Objects: 1,400
  Worker Parallelism: 1
Export> stop_job=immediate 
Are you sure you wish to stop this job ([yes]/no): yes   
[oracle@database ~]$ 

在此查看视图dba_datapump_jobs

正确停止expdp导出任务

发现SYS_EXPORT_SCHEMA_02已经是not runing状态了


转载:http://blog.csdn.net/weiwangsisoftstone/article/details/43149759