当前位置:  开发笔记 > 数据库 > 正文

在Oracle PL/SQL中针对模式验证XML文件

如何解决《在OraclePL/SQL中针对模式验证XML文件》经验,为你挑选了1个好方法。



1> user272735..:

更新

XML Schema注册需要以下权限:

grant alter session to ;
grant create type to ; /* required when gentypes => true */
grant create table to ; /* required when gentables => true */

由于某些原因,如果通过角色间接授予这些权限是不够的,但需要直接向模式/用户授予权限.

原始答案

我也注意到参数的默认值gentablesgentypes引发insufficient privileges异常.可能我只是缺乏使用这些功能的一些特权,但目前我还没有很好地理解他们做了什么.我很高兴禁用它们,验证似乎工作正常.

我正在使用Oracle Database 11g第11.2.0.1.0版

gentypes => true,gentables => true

dbms_xmlschema.registerschema(schemaurl => name,
                              schemadoc => xmltype(schema),
                              local => true
                              --gentypes => false,
                              --gentables => false
                              );

ORA-01031: insufficient privileges
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 55
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 159
ORA-06512: at "JANI.XML_VALIDATOR", line 38
ORA-06512: at line 7

gentypes => false,gentables => true

dbms_xmlschema.registerschema(schemaurl => name,
                              schemadoc => xmltype(schema),
                              local => true,
                              gentypes => false
                              --gentables => false
                              );

ORA-31084: error while creating table "JANI"."example873_TAB" for element "example"
ORA-01031: insufficient privileges
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 55
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 159
ORA-06512: at "JANI.XML_VALIDATOR", line 38
ORA-06512: at line 7

gentypes => true,gentables => false

dbms_xmlschema.registerschema(schemaurl => name,
                              schemadoc => xmltype(schema),
                              local => true,
                              --gentypes => false
                              gentables => false
                              );

ORA-01031: insufficient privileges
ORA-06512: at "XDB.DBMS_XMLSCHEMA_INT", line 55
ORA-06512: at "XDB.DBMS_XMLSCHEMA", line 159
ORA-06512: at "JANI.XML_VALIDATOR", line 38
ORA-06512: at line 7

gentypes => false,gentables => false

dbms_xmlschema.registerschema(schemaurl => name,
                              schemadoc => xmltype(schema),
                              local => true,
                              gentypes => false,
                              gentables => false
                              );

PL/SQL procedure successfully completed.

推荐阅读
个性2402852463
这个屌丝很懒,什么也没留下!
DevBox开发工具箱 | 专业的在线开发工具网站    京公网安备 11010802040832号  |  京ICP备19059560号-6
Copyright © 1998 - 2020 DevBox.CN. All Rights Reserved devBox.cn 开发工具箱 版权所有