首页 > 代码库 > 执行DBMS_METADATA.get_ddl报ORA-39212的解决方法

执行DBMS_METADATA.get_ddl报ORA-39212的解决方法

环境:
    数据库:oracle 10.2.0.4 --64位
    操作系统:红旗dc 5.0  --64位

以sys登陆,执行DBMS_METADATA.get_ddl得到某个表空间的元数据报错
select DBMS_METADATA.get_ddl(‘TABLESPACE‘,‘PDA‘) from dual;
ERROR:
ORA-39212: installation error: XSL stylesheets not loaded correctly
ORA-06512: at "SYS.DBMS_SYS_ERROR", line 79
ORA-06512: at "SYS.DBMS_METADATA_INT", line 7428
ORA-06512: at "SYS.DBMS_METADATA_INT", line 7477
ORA-06512: at "SYS.DBMS_METADATA_INT", line 9495
ORA-06512: at "SYS.DBMS_METADATA", line 1920
ORA-06512: at "SYS.DBMS_METADATA", line 2793
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1

马上查看10g的在线文件:
ORA-39212: installation error: XSL stylesheets not loaded correctly

Cause: The XSL stylesheets used by the Data Pump Metadata API were not loaded correctly into the Oracle dictionary table "sys.metastylesheet." Either the stylesheets were not loaded at all, or they were not converted to the database character set.
Action: Connect AS SYSDBA and execute dbms_metadata_util.load_stylesheets to reload the stylesheets.


解决方法:
以sysdba权限的用户登陆执行以下语句:

SQL> exec dbms_metadata_util.load_stylesheets;

PL/SQL procedure successfully completed.


再次执行成功:

SQL> select DBMS_METADATA.get_ddl(‘TABLESPACE‘,‘PDA‘) from dual;

DBMS_METADATA.GET_DDL(‘TABLESPACE‘,‘PDA‘)
--------------------------------------------------------------------------------

CREATE TABLESPACE "PDA" DATAFILE 
  ‘/db_data/app/oracle/oradata/pda/PDA_01.dbf‘ SIZE 2147483648
  LOGGING ONLINE PERMANENT BLOCKSIZE 8192
  EXTENT MANAGEMENT LOCAL AUTOALLOCATE SEGMENT SPACE MANAGEMENT AUTO

执行DBMS_METADATA.get_ddl报ORA-39212的解决方法