Oracle DataPump之二

tangyunoracle發表於2011-01-09

Oracle DataPump相對於傳統的exp/imp做了很多的改善。比如透過鏈路NETWORK_LINK 匯入方式,不需要匯出和傳送過程只需要一個IMPDP 命令就可以了。而且也增加了QUERY功能。

例子:

impdp system/password NETWORK_LINK=NEW_LINK DIRECTORY=DP_DIR logfile=jzdb_all_0106.log FULL=Y EXCLUDE=VIEW:"IN (select object_name from dba_objects where object_type='VIEW' and owner IN ('USER1','USER2','USER3'))" PARALLEL=2 JOB_NAME=TESTNOVIEWS;

這裡是透過NEW_LINK把除了USER1USER2USER3的檢視以為的物件及資料匯入到當前使用者下。

[@more@]

前幾天資料庫由於儲存非法關閉以後造成資料庫無法啟動,強制把資料庫開啟以後想透過資料泵備份出資料,但是執行資料泵匯出時沒有報任何的錯誤直接就斷了,跳到作業系統$符。沒有報任何的異常也沒有辦法,只好啟動原始的exp操作,但是exp同樣不行,好在exp丟擲了一些異常:

$ exp system/password GRANTS=N ROWS=Y INDEXES=N FILE=/oracle/idata/dbdata/all_0106.dmp log=/oracle/idata/dbdata/all_0106.log TRIGGERS=N CONSTRAINTS=N FULL=Y COMPRESS=N

Export: Release 10.2.0.4.0 - Production on Thu Jan 6 17:59:39 2011

Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

Export done in US7ASCII character set and AL16UTF16 NCHAR character set

server uses ZHS16GBK character set (possible charset conversion)

Note: grants on tables/views/sequences/roles will not be exported

Note: indexes on tables will not be exported

Note: constraints on tables will not be exported

About to export the entire database ...

. exporting tablespace definitions

. exporting profiles

. exporting user definitions

. exporting roles

. exporting resource costs

. exporting rollback segment definitions

. exporting database links

. exporting sequence numbers

. exporting directory aliases

. exporting context namespaces

. exporting foreign function library names

. exporting PUBLIC type synonyms

. exporting private type synonyms

. exporting object type definitions

. exporting system procedural objects and actions

EXP-00008: ORACLE error 25153 encountered

ORA-25153: Temporary Tablespace is Empty

ORA-06512: at "SYS.DBMS_LOB", line 443

ORA-06512: at "WMSYS.LT_EXPORT_PKG", line 722

ORA-06512: at line 1

EXP-00083: The previous problem occurred when calling WMSYS.LT_EXPORT_PKG.system_info_exp

EXP-00008: ORACLE error 25153 encountered

ORA-25153: Temporary Tablespace is Empty

ORA-06512: at "SYS.DBMS_LOB", line 443

ORA-06512: at "SYS.DBMS_SCHED_MAIN_EXPORT", line 580

ORA-06512: at "SYS.DBMS_SCHED_WINDOW_EXPORT", line 14

ORA-06512: at line 1

EXP-00085: The previous problem occurred when calling SYS.DBMS_SCHED_WINDOW_EXPORT.create

EXP-00008: ORACLE error 25153 encountered

ORA-25153: Temporary Tablespace is Empty

ORA-06512: at "SYS.DBMS_LOB", line 443

ORA-06512: at "SYS.DBMS_SCHED_MAIN_EXPORT", line 580

ORA-06512: at "SYS.DBMS_SCHED_WINDOW_EXPORT", line 14

ORA-06512: at line 1

EXP-00085: The previous problem occurred when calling SYS.DBMS_SCHED_WINDOW_EXPORT.create

EXP-00008: ORACLE error 25153 encountered

ORA-25153: Temporary Tablespace is Empty

ORA-06512: at "SYS.DBMS_LOB", line 443

ORA-06512: at "SYS.DBMS_SCHED_MAIN_EXPORT", line 928

ORA-06512: at "SYS.DBMS_SCHED_CLASS_EXPORT", line 14

ORA-06512: at line 1

EXP-00085: The previous problem occurred when calling SYS.DBMS_SCHED_CLASS_EXPORT.create_

EXP-00008: ORACLE error 25153 encountered

ORA-25153: Temporary Tablespace is Empty

ORA-06512: at "SYS.DBMS_LOB", line 443

ORA-06512: at "SYS.DBMS_SCHED_MAIN_EXPORT", line 928

ORA-06512: at "SYS.DBMS_SCHED_CLASS_EXPORT", line 14

ORA-06512: at line 1

EXP-00085: The previous problem occurred when calling SYS.DBMS_SCHED_CLASS_EXPORT.create_

EXP-00008: ORACLE error 25153 encountered

ORA-25153: Temporary Tablespace is Empty

ORA-06512: at "SYS.DBMS_LOB", line 443

ORA-06512: at "SYS.DBMS_SCHED_MAIN_EXPORT", line 868

ORA-06512: at "SYS.DBMS_SCHED_WINGRP_EXPORT", line 14

ORA-06512: at line 1

EXP-00085: The previous problem occurred when calling SYS.DBMS_SCHED_WINGRP_EXPORT.create

. exporting pre-schema procedural objects and actions

. exporting cluster definitions

EXP-00056: ORACLE error 25153 encountered

ORA-25153: Temporary Tablespace is Empty

EXP-00056: ORACLE error 25153 encountered

ORA-25153: Temporary Tablespace is Empty

EXP-00000: Export terminated unsuccessfully

有異常就好辦了,檢查一下異常,發現ORA-25153: Temporary Tablespace is Empty,到資料庫裡面一查,果然發現臨時表空間都是空的。給臨時表空間新增資料檔案,再次嘗試使用資料泵expdp果然可以了。還是傳統的exp能暴露異常。

之前資料庫匯出的時候老是丟擲以下異常:

$ expdp system/jzdb directory=DATA_PUMP_DIR dumpfile=gx_zsb1223%U.dp filesize=2g

Export: Release 10.2.0.4.0 - 64bit Production on Thursday, 23 December, 2010 23:

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

Starting "SYSTEM"."SYS_EXPORT_SCHEMA_08": system/******** directory=DATA_PUMP_Dsb,jzpt_gx_glff_zsb

Estimate in progress using BLOCKS method...

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

Total estimation using BLOCKS method: 2.526 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/DB_LINK

Processing object type SCHEMA_EXPORT/SEQUENCE/SEQUENCE

Processing object type SCHEMA_EXPORT/SEQUENCE/GRANT/OWNER_GRANT/OBJECT_GRANT

ORA-39014: One or more workers have prematurely exited.

ORA-39029: worker 1 with process name "DW01" prematurely terminated

ORA-31671: Worker process DW01 had an unhandled exception.

ORA-00600: internal error code, arguments: [qmtInit1], [], [], [], [], [], [], []

ORA-06512: at "SYS.KUPW$WORKER", line 1397

ORA-06512: at line 2

Job "SYSTEM"."SYS_EXPORT_SCHEMA_08" stopped due to fatal error at 23:20:46

ORA-39014: One or more workers have prematurely exited.

ORA-39029: worker 1 with process name "DW01" prematurely terminated

ORA-31671: Worker process DW01 had an unhandled exception.

ORA-00600: internal error code, arguments: [qmtInit1], [], [], [], [], [], [], []

ORA-06512: at "SYS.KUPW$WORKER", line 1397

ORA-06512: at line 2

Job "SYSTEM"."SYS_EXPORT_SCHEMA_05" stopped due to fatal error at 23:26:57

ORA-39014: One or more workers have prematurely exited.

老是會報ORA-00600內部錯誤,在網上查發現都是說由於環境變數設定錯誤引起的,64位的作業系統,卻使用$ORACLE_HOME/lib32在環境變數的前面。而且需要重啟資料庫,由於資料庫和小機都是由其他公司管理的,所以也不好辦,就一直沒管。

但是後來資料庫崩潰後重建,環境變數還是這樣設定,但是現在需要把之前備份出來的資料重新恢復回去。

$ impdp system/password DIRECTORY=DB_DP_DIR dumpfile=jcpt_dataonly_0106_%U.dp logfile=jcpt_dataonly_0107_imp.log JOB_NAME=impjcptdata

Import: Release 10.2.0.4.0 - 64bit Production on Friday, 07 January, 2011 18:44:03

Copyright (c) 2003, 2007, Oracle. All rights reserved.

Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production

With the Partitioning, Real Application Clusters, OLAP, Data Mining

and Real Application Testing options

Master table "SYSTEM"."IMPJCPTDATA" successfully loaded/unloaded

Starting "SYSTEM"."IMPJCPTDATA": system/******** DIRECTORY=DB_DP_DIR dumpfile=jcpt_dataonly_0106_%U.dp logfile=jcpt_dataonly_0107_imp.log JOB_NAME=impjcptdata

Processing object type SCHEMA_EXPORT/TABLE/TABLE_DATA

. . imported "JZPT_GX_JCPT_ZSB"."DICTIONARY" 29.32 MB 396082 rows

ORA-39014: One or more workers have prematurely exited.

ORA-39029: worker 1 with process name "DW01" prematurely terminated

ORA-31671: Worker process DW01 had an unhandled exception.

ORA-00600: internal error code, arguments: [unable to load XDB library], [], [], [], [], [], [], []

ORA-06512: at "SYS.KUPW$WORKER", line 1397

ORA-06512: at line 2

Job "SYSTEM"."IMPJCPTDATA" stopped due to fatal error at 18:44:38

$

沒有辦法,按照我們公司提供的安裝文件,重新設定環境變數:

NLS_LANG='AMERICAN_AMERICA.ZHS16GBK'
export NLS_LANG
LD_LIBRARY_PATH=$ORACLE_HOME/lib:$ORA_CRS_HOME/lib:$ORA_CRS_HOME/lib32
export LD_LIBRARY_PATH

重啟資料庫,重啟監聽,重新匯入,匯入成功。

這裡還要注意一下,從小機上把備份檔案拿下到windows機器上最好使用專門的ftp工具,如果直接使用的是dos直接ftp上去拿的話要注意使用二進位制傳輸,不然會報下面的錯誤:

C:>impdp system/gxjzywk dumpfile=glff_dataonly_0106_%U.dp logfile=glff_dataonly

_0106_in.log INCLUDE=TABLE:"= 'B_ZDRYGK_ZDRYXX_MID'" schemas=JZPT_GX_GLFF_ZSB

remap_schema=JZPT_GX_GLFF_ZSB:DZK_JK

Import: Release 10.2.0.4.0 - Production on 星期四, 06 1, 2011 21:50:27

Copyright (c) 2003, 2007, Oracle. All rights reserved.

連線到: Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production

With the Partitioning, OLAP, Data Mining and Real Application Testing options

ORA-39001: 引數值無效

ORA-39000: 轉儲檔案說明錯誤

ORA-31619: 轉儲檔案 "D:oracleproduct10.2.0adminjzywkdpdumpglff_dataonly_0

106_01.dp" 無效

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24930246/viewspace-1044344/,如需轉載,請註明出處,否則將追究法律責任。

相關文章