Tuesday, September 30, 2014

ORA-39006: internal error; ORA-39213: Metadata processing is not available;

Scenerio

Oracle 11.2.0.3 - 64 bit on Windows

When using IMPDP you get the error :

ORA-39006: internal error
ORA-39213: Metadata processing is not available

Workaround

sqlplus / as sysdba
SQL> execute sys.dbms_metadata_util.load_stylesheets;

Source : Oracle metalink : DOC ID 801337.1
---------------------------------------------------------------------------------------------------------------

Datapump Import Fails With ORA-39006 ORA-39213 Metadata processing is not available (Doc ID 801337.1)

Applies to :

Oracle Database - Enterprise Edition - Version 10.2.0.3 and later
Information in this document applies to any platform.
***Checked for relevance on 17-Aug-2014***


Symptoms :

DataPump import (impdp) reports the errors:


Connected to: Oracle Database 10g Enterprise Edition Release 10.2.0.3.0 - 64bit
Production
With the Partitioning, OLAP and Data Mining options
ORA-39006: internal error
ORA-39213: Metadata processing is not available


Attempting to correct the error ORA-39213 via dbms_metadata_util.load_stylesheets also
reports errors similar to:


SQL> exec dbms_metadata_util.load_stylesheets;

BEGIN dbms_metadata_util.load_stylesheets; END;
*
ERROR at line 1:
ORA-22288: file or LOB operation FILEEXISTs failed
Permission denied
ORA-06512: at "SYS.DBMS_METADATA_UTIL", line 1807
ORA-06512: at line 1


Cause : 

The above errors are almost certainly indicative of permissions issues.

Solution :

During dbms_metadata_util.load_stylesheets we read the directory $ORACLE_HOME/rdbms/xml/xsl and load the XSL files using DBMS_LOB package.

If the files cannot be read (most of cases by missing rwx privileges for oracle user), then we raise the errors above.

Re-load the stylesheets using the dbms_metadata_util.load_stylesheets procedure after the permission issue is solved and then retry DataPump import (impdp).