我使用的Oracle的版本:10.2.01,DBMS_METADATA可以很方便地查询数据库对象的定义等相关信息。在使用DBMS_METADATA,遇到以下问题,总结如下。
1)
SQL> conn scott/scott
Connected.
SQL> select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') 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 7398
ORA-06512: at "SYS.DBMS_METADATA_INT", line 7447
ORA-06512: at "SYS.DBMS_METADATA_INT", line 9453
ORA-06512: at "SYS.DBMS_METADATA", line 1919
ORA-06512: at "SYS.DBMS_METADATA", line 2792
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1
解决:切换到sysdba下,exec dbms_metadata_util.load_stylesheets;
2)select dbms_metadata.get_ddl('TABLE','DEPT','SCOTT') from dual;该语句中函数的参数如果不大写,会报错:ERROR:
ORA-31600: invalid input value table for parameter OBJECT_TYPE in function
GET_DDL
ORA-06512: at "SYS.DBMS_METADATA", line 2681
ORA-06512: at "SYS.DBMS_METADATA", line 2732
ORA-06512: at "SYS.DBMS_METADATA", line 4333
ORA-06512: at line 1
解决:参数全部大写