1. 程式人生 > >從oracle 11g匯出->12c 匯入 ,遇到ORA-39213: Metadata processing is not available

從oracle 11g匯出->12c 匯入 ,遇到ORA-39213: Metadata processing is not available

1.從低版本匯出,高版本匯入,需要增加version 

2.從高版本匯出,低版本匯入,可以向下相容。

下面我們來看看《1.從低版本匯出,高版本匯入》增加version 後,還是報錯?

--下面是11g,加了version='11.2.0.3.0'匯出

[[email protected] dumpfiles]$ expdp unic**/******** directory=orabackupdump dumpfile=expdp_0517_ml_1234.dmp logfile=expdp_0517_ml_1234.log tables=TU_PERMISSION,TU_REL_GROUP_RESOURCE,TU_REL_USER_GROUP,TU_GROUPBASEINFO,TU_USERBASEINFO version='11.2.0.3.0'

Export: Release 11.2.0.3.0 - Production on Tue May 17 15:10:26 2016

Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options
Starting "UNICOMIDMP"."SYS_EXPORT_TABLE_01":  unico**/******** directory=orabackupdump dumpfile=expdp_0517_ml_1234.dmp logfile=expdp_0517_ml_1234.log tables=TU_PERMISSION,TU_REL_GROUP_RESOURCE,TU_REL_USER_GROUP,TU_GROUPBASEINFO,TU_USERBASEINFO version=11.2.0.3.0 
Estimate in progress using BLOCKS method...
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
Total estimation using BLOCKS method: 20 MB
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/COMMENT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
. . exported "UNICOMIDMP"."TU_GROUPBASEINFO"             7.210 KB       9 rows
. . exported "UNICOMIDMP"."TU_PERMISSION"                23.53 KB     465 rows
. . exported "UNICOMIDMP"."TU_REL_GROUP_RESOURCE"        67.49 KB    1533 rows
. . exported "UNICOMIDMP"."TU_REL_USER_GROUP"            57.61 KB     686 rows
. . exported "UNICOMIDMP"."TU_USERBASEINFO"              107.9 KB     565 rows
Master table "UNICOMIDMP"."SYS_EXPORT_TABLE_01" successfully loaded/unloaded
******************************************************************************
Dump file set for UNICOMIDMP.SYS_EXPORT_TABLE_01 is:
  /ora/dumpfiles/expdp_0517_ml_1234.dmp
Job "UNICOMIDMP"."SYS_EXPORT_TABLE_01" successfully completed at 15:10:43


在12c匯入,加了version='11.2.0.3.0'        見下面

[[email protected] dpdump]$ ls -l
total 544
-rw-r----- 1 oracle oinstall    116 May 10 10:31 dp.log
-rw-r----- 1 oracle oinstall 552960 May 17 14:43 expdp_0517_ml_1234.dmp
[[email protected] dpdump]$ impdp un***/***** directory=DATA_PUMP_DIR dumpfile=expdp_0517_ml_1234.dmp TABLE_EXISTS_ACTION=replace version='11.2.0.3';

Import: Release 12.1.0.2.0 - Production on Tue May 17 14:49:22 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
ORA-39006: internal error
ORA-39213: Metadata processing is not available

--我們看看錯位描述

[[email protected] ~]$ oerr ora 39213
39213, 00000, "Metadata processing is not available"
// *Cause:  The Data Pump could not use the Metadata API.  Typically,
//          this is caused by the XSL stylesheets not being set up properly.
// *Action: Connect AS SYSDBA and execute dbms_metadata_util.load_stylesheets
//          to reload the stylesheets.
[
[email protected]
~]$

--那我們就按照這個方法處理,試試
SQL> execute sys.dbms_metadata_util.load_stylesheets;

PL/SQL procedure successfully completed.

--再,試試
[[email protected] dpdump]$ impdp uni/**** directory=DATA_PUMP_DIR dumpfile=expdp_0517_ml_1234.dmp TABLE_EXISTS_ACTION=replace version='11.2.0.3.0';

Import: Release 12.1.0.2.0 - Production on Tue May 17 15:21:01 2016

Copyright (c) 1982, 2014, Oracle and/or its affiliates.  All rights reserved.

Connected to: Oracle Database 12c Enterprise Edition Release 12.1.0.2.0 - 64bit Production
With the Partitioning, OLAP, Advanced Analytics and Real Application Testing options
Master table "UNICOMIDMP"."SYS_IMPORT_FULL_01" successfully loaded/unloaded
import done in ZHS16GBK character set and AL16UTF16 NCHAR character set
export done in ZHS16GBK character set and UTF8 NCHAR character set
WARNING: possible data loss in character set conversions
Starting "UNICOMIDMP"."SYS_IMPORT_FULL_01":  unicomidmp/******** directory=DATA_PUMP_DIR dumpfile=expdp_0517_ml_1234.dmp TABLE_EXISTS_ACTION=replace version=11.2.0.3.0 
Processing object type TABLE_EXPORT/TABLE/TABLE
Processing object type TABLE_EXPORT/TABLE/TABLE_DATA
. . imported "UNICOMIDMP"."TU_GROUPBASEINFO"             7.210 KB       9 rows
. . imported "UNICOMIDMP"."TU_PERMISSION"                23.53 KB     465 rows
. . imported "UNICOMIDMP"."TU_REL_GROUP_RESOURCE"        67.49 KB    1533 rows
. . imported "UNICOMIDMP"."TU_REL_USER_GROUP"            57.61 KB     686 rows
. . imported "UNICOMIDMP"."TU_USERBASEINFO"              107.9 KB     565 rows
Processing object type TABLE_EXPORT/TABLE/COMMENT
Processing object type TABLE_EXPORT/TABLE/INDEX/INDEX
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/INDEX/STATISTICS/INDEX_STATISTICS
Processing object type TABLE_EXPORT/TABLE/CONSTRAINT/REF_CONSTRAINT
Processing object type TABLE_EXPORT/TABLE/STATISTICS/TABLE_STATISTICS
Job "UNICOMIDMP"."SYS_IMPORT_FULL_01" successfully completed at Tue May 17 15:21:11 2016 elapsed 0 00:00:10

[[email protected] dpdump]$ 

--OK ,輕鬆搞定。

2016.5.17

---end  . mengl