程序師世界是廣大編程愛好者互助、分享、學習的平台,程序師世界有你更精彩!
首頁
編程語言
C語言|JAVA編程
Python編程
網頁編程
ASP編程|PHP編程
JSP編程
數據庫知識
MYSQL數據庫|SqlServer數據庫
Oracle數據庫|DB2數據庫
 程式師世界 >> 編程語言 >> JAVA編程 >> JAVA綜合教程 >> Tips:datapump異常中斷後的處理

Tips:datapump異常中斷後的處理

編輯:JAVA綜合教程

Tips:datapump異常中斷後的處理


博客文章除注明轉載外,均為原創。轉載請注明出處。
本文鏈接地址:http://blog.chinaunix.net/uid-31396856-id-5756767.html

oracle數據庫在10g的時候推出datapump,expdp/impdp現已成為dba導數的常用工具了。上次客戶聯系說,在終止expdp進程後,系統空間還是在增長,可用空間越來越小。問了下客戶是怎麼關閉expdp的,說是一次ctrc+C,一次kill expdp進程....
expdp/impdp的啟動,是以job的形式在數據庫後台運行。如果只是關閉進程,或者異常退出,是無法停止expdp/impdp,因為job還是在數據庫裡運行。這個時候處理方式是關閉數據庫中expdp/impdp的job。

先登錄數據庫,確認expdp對應的job名稱

SQL> select job_name,state from dba_datapump_jobs;
JOB_NAME STATE
------------------------------ ------------------------------
SYS_EXPORT_TABLE_01 EXECUTING
SYS_EXPORT_TABLE_02 EXECUTING

果然數據庫有兩個expdp進程跑著呢...


正確的處理方式:

SQL> select job_name,state from dba_datapump_jobs;


JOB_NAME STATE
------------------------------ ------------------------------
SYS_EXPORT_FULL_01 EXECUTING


[oracle@ora11g dp_dir]$
[oracle@ora11g dp_dir]$ expdp \'/ as sysdba\' attach=SYS_EXPORT_FULL_01


Export: Release 11.2.0.4.0 - Production on Thu Dec 15 11:26:31 2016


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_FULL_01
Owner: SYS
Operation: EXPORT
Creator Privs: TRUE
GUID: 43AB008C575C06AAE053E638A8C0C450
Start Time: Thursday, 15 December, 2016 11:25:24
Mode: FULL
Instance: ora11g
Max Parallelism: 1
EXPORT Job Parameters:
Parameter Name Parameter Value:
CLIENT_COMMAND "/******** AS SYSDBA" DIRECTORY=dp_dir DUMPFILE=db.dump full=y
State: EXECUTING
Bytes Processed: 0
Current Parallelism: 1
Job Error Count: 0
Dump File: /home/oracle/dp_dir/db.dump
bytes written: 4,096

Worker 1 Status:
Process Name: DW00
State: EXECUTING
Object Schema: SYSMAN
Object Name: AQ$_MGMT_LOADER_QTABLE_G
Object Type: DATABASE_EXPORT/SCHEMA/TABLE/TABLE
Completed Objects: 1
Worker Parallelism: 1


Export> stop_job /stop_job=immediate
Are you sure you wish to stop this job ([yes]/no): yes


[oracle@ora11g dp_dir]$ expdp \'/ as sysdba\' attach=SYS_EXPORT_FULL_01


Export: Release 11.2.0.4.0 - Production on Thu Dec 15 11:27:27 2016


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_FULL_01
Owner: SYS
Operation: EXPORT
Creator Privs: TRUE
GUID: 43AB008C575C06AAE053E638A8C0C450
Start Time: Thursday, 15 December, 2016 11:27:30
Mode: FULL
Instance: ora11g
Max Parallelism: 1
EXPORT Job Parameters:
Parameter Name Parameter Value:
CLIENT_COMMAND "/******** AS SYSDBA" DIRECTORY=dp_dir DUMPFILE=db.dump full=y
State: IDLING
Bytes Processed: 0
Current Parallelism: 1
Job Error Count: 0
Dump File: /home/oracle/dp_dir/db.dump
bytes written: 4,096

Worker 1 Status:
Process Name: DW00
State: UNDEFINED


Export> kill_job
Are you sure you wish to stop this job ([yes]/no): yes

於是乎處理完畢。因此在expdp/impdp的時候不要隨意的kill或者終止進程。
---The end


  1. 上一頁:
  2. 下一頁:
Copyright © 程式師世界 All Rights Reserved