Structured Storage
I have a very simple schema registered called "Books.xsd" with a targetNamespace. This generated the user_xml_table Books4576_TAB.
I've also created a table BOOKS with an XMLType column and can successfully insert an XML file with a schemaLocation with the targetNamespace and Books.xsd.
A select from the BOOKS table's XMLType column yields a CLOB of XML. However, a select of the Books4576_TAB table yields no rows. I don't think structured storage is being successfully applied on my insert and the default table is not being populated.
If I am using structured storage correctly, should the relational tables generated by the register schema command be populated when I perform an insert?
No, you have LOB based storage for the table you created....
You need to look at the DDL for the table generated using register Schema and then modify that DDL to create the relational table with the XMLType column. You need to understand that the storeVarrayAsTable directive only applies to the table generated by registerSchema, not to any XMLType tables or columns that are created after the XML Schema is registered.
Similar Messages
-
Query about XMLTYPE column structured storage in Oracle Xml db
Dear All,
DB Version: Oracle 11g (11.2.0.3.0)
I have an table having one column as XMLTYPE with Structured storage.
CREATE TABLE Orders
Order_id NUMBER NOT NULL,
Order_etc VARCHAR2(100),
Order_desc XMLType NOT NULL
XMLTYPE Order_desc STORE AS OBJECT RELATIONAL XMLSCHEMA "http://localhost/public/xsd/order_desc_xsd.xsd" ELEMENT "OrderState";
I have then registered the XSD with XML Db schema which is required for Structured storage.
Before this table creation I had created a table (db_objects) of XMLTYPE and was able to use the below query to check for what all objects the XMLTYPE table got broken into when I registered its XSD.
SELECT column_name,
data_type
FROM user_tab_cols
WHERE table_name = 'DB_OBJECTS';
And used below query to look for data stored in Object-Relational structure for my table (DB_OBJECTS) created with XMLTYPE definition.
SELECT EXTRACTVALUE(xseq.column_value, '/THISROW/OWNER') AS owner
, EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_NAME') AS object_name
, EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_TYPE') AS object_type
, EXTRACTVALUE(xseq.column_value, '/THISROW/OBJECT_ID') AS object_id
, EXTRACTVALUE(xseq.column_value, '/THISROW/CREATED') AS created
FROM db_objects do
, TABLE(XMLSEQUENCE(EXTRACT(VALUE(do), '/ROWSET/THISROW'))) xseq
WHERE ROWNUM <= 10;
Now could someone let me know, how to find how the column (Order_desc) of XMLTYPE was broken down into further objects just like I did for the Table with XMLTYPE (as shown above)?
Many Thanks.First given that you are on 11.2, ExtractValue is deprecated and the documentation lists three options to use instead. Here is one option (untested)
SELECT owner, object_name, object_type, object_id, created
FROM db_objects do,
XMLTable('/ROWSET/THISROW'
PASSING do.object_value
COLUMNS
-- Set data types accordingly
owner VARCHAR2(20) PATH 'owner',
object_name VARCHAR2(20) PATH 'object_name',
object_type VARCHAR2(20) PATH 'object_type',
object_id VARCHAR2(20) PATH 'object_id',
created VARCHAR2(20) PATH 'created');
Second, why does column order matter? You are storing in an object relational method. As long as the XML is valid per the schema, the Oracle will be able to store the data and later retrieve it as well. How that data is stored is mostly Oracle internals and should not be touched as it can be changed from version to version. You can use schema annotation to control how Oracle maps and stores the XML, but nothing in there specifies column order that I am aware of.
It seems additional details are missing as to what you need the information for so that would help others answer your question. -
Structured storage XMLType but disappointing performance
Hi,
This relates to Oracle 11g, but maybe the same question can be asked for 10g.
I'm having a lot of big XML files which are structured following this xsd:
<?xml version="1.0" encoding="ISO-8859-1"?>
<xs:schema
xmlns="http://localhost/public/xsd/simple.xsd"
targetNamespace="http://localhost/public/xsd/simple.xsd"
xmlns:xs="http://www.w3.org/2001/XMLSchema"
xmlns:xdb="http://xmlns.oracle.com/xdb"
elementFormDefault="qualified"
attributeFormDefault="unqualified"
xdb:storeVarrayAsTable="true">
<xs:element name="root" xdb:defaultTable="simple_or" xdb:maintainDOM="false">
<xs:complexType>
<xs:sequence>
<xs:element name="ea">
<xs:complexType>
<xs:sequence>
<xs:element name="eb" minOccurs="1" maxOccurs="unbounded">
<xs:complexType>
<xs:sequence>
<xs:element name="c1" type="xs:double" />
<xs:element name="c2" type="xs:double" />
<xs:element name="c3" type="xs:double" />
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:schema>I create a VARRAY (the order is important) based structured storage table using the following commands:
declare
l_bfile bfile;
res boolean;
begin
l_bfile := bfilename('EXDIR', 'simple.xsd');
dbms_lob.open(l_bfile);
dbms_xdb.deleteResource('/public/simple.xsd',4);
res := dbms_xdb.createResource('/public/simple.xsd',l_bfile);
end;
BEGIN
DBMS_XMLSchema.deleteSchema(
schemaurl=>'http://localhost/public/xsd/simple.xsd',
delete_option=>DBMS_XMLSchema.Delete_Cascade_Force);
END;
begin
dbms_xmlschema.registerSchema(schemaurl => 'http://localhost/public/xsd/simple.xsd',
schemadoc => xdbUriType('/public/simple.xsd').getXML(),
local => true,
gentypes => true,
genbean => false,
gentables => true,
force => false,
owner => user);
end;
CREATE TABLE simple_or_1 OF XMLType
XMLSCHEMA "http://localhost/public/xsd/simple.xsd"
ELEMENT "root"
VARRAY "XMLDATA"."ea"."eb"
STORE AS TABLE simple_nested1
((PRIMARY KEY (NESTED_TABLE_ID, SYS_NC_ARRAY_INDEX$)))
/And I load some XML files of the following form:
<?xml version="1.0" encoding="UTF-8"?>
<root xmlns="http://localhost/public/xsd/simple.xsd">
<ea>
<eb>
<c1>4.0</c1>
<c2>5.0</c2>
<c3>6.0</c3>
</eb>
<eb>
<c1>7.0</c1>
<c2>8.0</c2>
<c3>9.0</c3>
</eb>
<eb>
<c1>7.0</c1>
... etc ...
</ea>
</root>
Every document has about 50.000 <eb> elements and I loaded 6 sample documents.
A simple query like the following takes about 5 minutes:
SELECT XMLQuery('
declare default element namespace "http://localhost/public/xsd/simple.xsd"; (: :)
for $i in /root
return max($i/a/b/c2)
' PASSING OBJECT_VALUE RETURNING CONTENT)
FROM simple_or_1;The explain plan shows the following:
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 6 | 60 | 3 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 1901 | | |
|* 2 | TABLE ACCESS BY INDEX ROWID| SIMPLE_NESTED1 | 1969 | 3655K| 6 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | SYS_C009750 | 787 | | 2 (0)| 00:00:01 |
| 4 | SORT AGGREGATE | | 1 | | | |
| 5 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 6 | TABLE ACCESS FULL | SIMPLE_OR_1 | 6 | 60 | 3 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter(SYS_XMLCONV("SYS_ALIAS_2"."SYS_XDBPD$",0,32,'3952ABE048DCF8D6E040007F0101
7EA4',1,5561,1) IS NOT NULL)
3 - access("NESTED_TABLE_ID"=:B1)I'm not understanding the low performance of 5 minutes... is there anyone who can explain and help out?Note with DOM Fidelity disabled on all types the SYS_XMLCONV is replaced with the more efficeint SYS_XMLGEN. However this is still not as efficient as the XMLTable approach..
C:\Documents and Settings\Mark D Drake>sqlplus sys/oracle as sysdba
SQL*Plus: Release 11.1.0.6.0 - Production on Fri Sep 7 06:03:39 2007
Copyright (c) 1982, 2007, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Beta
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL> connect / as sysdba
Connected.
SQL> --
SQL> drop user Tijink cascade
2 /
drop user Tijink cascade
ERROR at line 1:
ORA-01918: user 'TIJINK' does not exist
SQL> grant connect, resource, alter session, create view to Tijink identified by Tijink
2 /
Grant succeeded.
SQL> conn Tijink/Tijink
Connected.
SQL> --
SQL> set long 10000000
SQL> set pages 5000
SQL> var schemaPath varchar2(256)
SQL> var schemaURL varchar2(256)
SQL> var xmlSchema clob;
SQL> --
SQL> begin
2 :schemaURL := 'http://localhost/public/xsd/simple.xsd';
3 :schemaPath := '/public/simple.xsd';
4 :xmlSchema :=
5 '<?xml version="1.0" encoding="ISO-8859-1"?>
6 <xs:schema
7 xmlns="http://localhost/public/xsd/simple.xsd"
8 targetNamespace="http://localhost/public/xsd/simple.xsd"
9 xmlns:xs="http://www.w3.org/2001/XMLSchema"
10 xmlns:xdb="http://xmlns.oracle.com/xdb"
11 elementFormDefault="qualified"
12 attributeFormDefault="unqualified"
13 xdb:storeVarrayAsTable="true">
14 <xs:element name="root" xdb:defaultTable="simple_or">
15 <xs:complexType xdb:maintainDOM="false">
16 <xs:sequence>
17 <xs:element name="ea">
18 <xs:complexType xdb:maintainDOM="false">
19 <xs:sequence>
20 <xs:element name="eb" minOccurs="1" maxOccurs="unbounded">
21 <xs:complexType xdb:maintainDOM="false">
22 <xs:sequence>
23 <xs:element name="c1" type="xs:double" />
24 <xs:element name="c2" type="xs:double" />
25 <xs:element name="c3" type="xs:double" />
26 </xs:sequence>
27 </xs:complexType>
28 </xs:element>
29 </xs:sequence>
30 </xs:complexType>
31 </xs:element>
32 </xs:sequence>
33 </xs:complexType>
34 </xs:element>
35 </xs:schema>';
36 end;
37 /
PL/SQL procedure successfully completed.
SQL> alter session set events='31098 trace name context forever'
2 /
Session altered.
SQL> DECLARE
2 BINARY_XML boolean:=FALSE;
3 BEGIN
4 IF (BINARY_XML)
5 THEN
6 dbms_xmlschema.registerSchema(SCHEMAURL => :schemaURL,
7 SCHEMADOC => :xmlschema,
8 LOCAL => TRUE,
9 GENTYPES => FALSE,
10 GENBEAN => FALSE,
11 GENTABLES => FALSE,
12 ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
13 FORCE => FALSE,
14 OPTIONS => DBMS_XMLSCHEMA.REGISTER_BINARYXML,
15 OWNER => USER);
16 ELSE
17 dbms_xmlschema.registerSchema(SCHEMAURL => :schemaURL,
18 SCHEMADOC => :xmlSchema,
19 LOCAL => TRUE,
20 GENTYPES => TRUE,
21 GENBEAN => FALSE,
22 GENTABLES => TRUE,
23 ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE,
24 FORCE => FALSE,
25 OWNER => USER);
26 END IF;
27 END;
28 /
PL/SQL procedure successfully completed.
SQL> --
SQL> set timing on
SQL> set long 1000000
SQL> set pages 50000
SQL> set lines 200
SQL> --
SQL> call dbms_stats.GATHER_SCHEMA_STATS('TIJINK')
2 /
Call completed.
Elapsed: 00:00:01.67
SQL> set autotrace on explain
SQL> --
SQL> SELECT XMLQuery
2 ('
3 declare default element namespace "http://localhost/public/xsd/simple.xsd"; (: :)
4 for $i in /root
5 return max($i/ea/eb/c2)
6 ' PASSING OBJECT_VALUE RETURNING CONTENT)
7 FROM "simple_or"
8 /
no rows selected
Elapsed: 00:00:00.28
Execution Plan
Plan hash value: 3716725992
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 10 | 2 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 23 | | |
|* 2 | TABLE ACCESS BY INDEX ROWID| SYS_NTobq/uFrTQGaOrq3BeDy9Eg== | 1 | 23 | 0 (0)| 00:00:01 |
|* 3 | INDEX RANGE SCAN | SYS_C009648 | 1 | | 0 (0)| 00:00:01 |
| 4 | SORT AGGREGATE | | 1 | | | |
| 5 | FAST DUAL | | 1 | | 2 (0)| 00:00:01 |
| 6 | TABLE ACCESS FULL | simple_or | 1 | 10 | 2 (0)| 00:00:01 |
Predicate Information (identified by operation id):
2 - filter(SYS_XMLGEN(TO_CHAR("SYS_ALIAS_1"."c2")) IS NOT NULL)
3 - access("NESTED_TABLE_ID"=:B1)
SQL> select max(c2)
2 from "simple_or",
3 xmltable
4 (
5 xmlnamespaces
6 (
7 default 'http://localhost/public/xsd/simple.xsd'
8 ),
9 '/root/ea/eb'
10 passing OBJECT_VALUE
11 columns
12 C2 PATH 'c2'
13 )
14 /
MAX(C2)
Elapsed: 00:00:00.15
Execution Plan
Plan hash value: 1041340395
| Id | Operation | Name | Rows | Bytes | Cost (%CPU)| Time |
| 0 | SELECT STATEMENT | | 1 | 33 | 0 (0)| 00:00:01 |
| 1 | SORT AGGREGATE | | 1 | 33 | | |
| 2 | NESTED LOOPS | | | | | |
| 3 | NESTED LOOPS | | 1 | 33 | 0 (0)| 00:00:01 |
| 4 | INDEX FULL SCAN | SYS_C009649 | 1 | 10 | 0 (0)| 00:00:01 |
|* 5 | INDEX RANGE SCAN | SYS_C009648 | 1 | | 0 (0)| 00:00:01 |
| 6 | TABLE ACCESS BY INDEX ROWID| SYS_NTobq/uFrTQGaOrq3BeDy9Eg== | 1 | 23 | 0 (0)| 00:00:01 |
Predicate Information (identified by operation id):
5 - access("NESTED_TABLE_ID"="simple_or"."SYS_NC0000700008$")
SQL> desc "simple_or"
Name Null? Type
TABLE of SYS.XMLTYPE(XMLSchema "http://localhost/public/xsd/simple.xsd" Element "root") STORAGE Object-relational TYPE "root648_T"
SQL> desc "root648_T"
Name Null? Type
ea ea649_T
SQL> desc "ea649_T"
Name Null? Type
eb eb651_COLL
SQL> desc "eb651_COLL"
"eb651_COLL" VARRAY(2147483647) OF eb650_T
Name Null? Type
c1 NUMBER
c2 NUMBER
c3 NUMBER
SQL> -
Importing native xml in to semi structured storage
hello,
how store the a bibliographic data in the native xml and import or export that data into to the semi structured storage. What are the ways we query the xml database.
Eagerly waiting for the reply
Cheers
Akhil
Thank you in advanceBased on a small extension demo-ed in : http://www.liberidu.com/blog/?p=1053 (demo script demo06.sql)
-- If you can select it you can insert it...
-- drop table OGH_xml_store purge;
create table OGH_xml_store of xmltype
xmltype store as binary xml
commit;
exec get_dir_list( 'G:\OGH\xmlstore' );
set time on timing on
insert into OGH_xml_store
select XMLTYPE(bfilename('OGH_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) AS "XML"
from dir_list dl
where dl.filename like '%.xml';
set time off timing off
commit;
select count(*) from OGH_xml_store;
prompt pause
pause
clear screen
-- If you can select it you can create resources and files
set time on timing on
commit;
exec get_dir_list( 'G:\OGH\xmlstore' );
select count(*) from dir_list where filename like '%.xml';
set serveroutput on size 10000
DECLARE
XMLdoc XMLType;
res BOOLEAN;
v_foldername varchar2(4000) := '/public/OGH/';
cursor c1
is
select dl.filename FNAME
, XMLTYPE(bfilename('OGH_USE_CASE',dl.filename),NLS_CHARSET_ID('AL32UTF8')) XMLCONTENT
from dir_list dl
where dl.filename like '%.xml'
and rownum <= 100;
BEGIN
-- Create XDB repository Folder
if (dbms_xdb.existsResource(v_foldername))
then
dbms_xdb.deleteResource(v_foldername,dbms_xdb.DELETE_RECURSIVE_FORCE);
end if;
res:=DBMS_XDB.createFolder(v_foldername);
-- Create XML files in the XDB Repository
for r1 in c1
loop
if (DBMS_XDB.CREATERESOURCE(v_foldername||r1.fname, r1.xmlcontent))
then
dbms_output.put_line(v_foldername||r1.fname);
null;
else
dbms_output.put_line('Loop Exception :'||sqlerrm);
end if;
end loop;
EXCEPTION WHEN OTHERS THEN
dbms_output.put_line('Others Exception: '||sqlerrm);
END;
set time off timing off
commit;
prompt pause
pause
clear screen
-- FTP and HTTP
clear screen
prompt
prompt *** FTP - Demo ***
prompt
prompt pause
pause
host ftp
-- open localhost 2100
-- user OGH OGH
-- cd public
-- cd OGH
-- ls
-- bye
clear screen
prompt
prompt *** Microsoft Internet Explorer - Demo ***
prompt
prompt pause
pause
host "C:\Program Files\Internet Explorer\IEXPLORE.EXE" http://OGH:OGH@localhost:8080/public/OGH/
prompt pause
pause
-- Accessing the XDB Repository content via Resource View
-- Selecting content from a resource via XBDUriType
clear screen
prompt set long 300
set long 300
prompt Relative Path - (path)
SELECT path(1) as filename
FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/OGH', 1) = 1
and rownum <= 10
prompt pause
pause
clear screen
prompt Absolute Path - (any_path)
select xdburitype(any_path).getClob() as xml
FROM RESOURCE_VIEW
WHERE under_path(RES, '/public/OGH', 1) = 1
and rownum <= 1;
prompt pause
pause -
Piecewise Insert into structured storage
I understand that XMLUPDATE can handle piecewise update, but what do I do for piecewise insert. I want to add a sub-tree (document fragment) conformant with the registered schema to the xml document, without re-writing the whole (possibly very, very large and growing) document, and retaining all the power and abstraction of structured storage.
It would be nice to get an XMLType via an XPath select, get the DOM object from the XMLTYpe, operate on the DOM, and see those changes reflected in the database. I can do all that, but the changes to the DOM seem to be in-memory only.
How do I add a sub-node to an existing structured document?
Thanks,
DavidHI,
Oracle version is 11.1.0.7.0.
Metalink found three bugs related to the error ORA-00600: Interner Fehlercode, Argumente: [qmxConvUnkType], [], [], [], [],
The bugs are:
BUG 8644684 ORA-600 [QMXCONVUNKTYPE] DURING INSERT INTO SCHEMA-BASED TABLE
BUG 8671408 INSERT OF XML DOC INTO AN XML SCHEMA STORED AS BINARY XML FAILS WITH ORA-30937
BUG 8683472 SCHEMA EXECUTABLE RETURNS INCORRECT ERRORS DURING VALIDATION AGAINST XML SCHEMA
Well, I have to look round in XML DB Forum yet. -
Storing data in structured storage
I see everywhere that storing data in stuctured storage way is the better thing to do if we want to make fast search.
But how can I do it.
I only see that the default storage is clob for xmltype and we also can say "stored as clob" but how do it for store it in structured storage.
Thank you.You need to register an XML Schema that defines your data. You then define the type of data your XML columns will contain using XMLSCHEMA and ELEMENT clauses..
See the XML DB demo for more info -
Any idea to make something similar as Ms Structured Storage in Labview?
I read about Ms COM based Structured storage. Are there any idea to make something similar in Labview, or call some external component to make that functions?
COM is from Component Object Model and the structured storage(SS) is based on it. Shortly SS is a file system within a file with two kind of objects: storage=>directory and stream=>file and COM defines how to treat that objects in a single file system. Some of the features are: simultaneous access to objects (or part of) from multiple applications, direct or transacted access and so on. In direct access the changes are made immediately, in transacted they are buffered and committed or reverted. There are some functions in OLE32.dll but the question is how to implement the full functionality of SS and call it from LV, may be in another dll...
-
Loading XML Document into Structured Storage
HI Everybody,
I am confronted with a BUG in Oracle which is being fixed but will last a long time. I have a relatively complex Schema with manifold includes, imports and inheritances which I can register successfully. The object-relational table is also generated. But loading the instance document with INSERT INTO... fails due to severe internal error. I have not yet tried SQL*Loader, however.
Please, does anyone know a safe alternative method to parse and load? Structured storage is mandatory because I need to retrieve individual elements and attributes. Instance documents are big, ca. 20 MB.
Thanks, regards
Miklos HERBOLYHI,
Oracle version is 11.1.0.7.0.
Metalink found three bugs related to the error ORA-00600: Interner Fehlercode, Argumente: [qmxConvUnkType], [], [], [], [],
The bugs are:
BUG 8644684 ORA-600 [QMXCONVUNKTYPE] DURING INSERT INTO SCHEMA-BASED TABLE
BUG 8671408 INSERT OF XML DOC INTO AN XML SCHEMA STORED AS BINARY XML FAILS WITH ORA-30937
BUG 8683472 SCHEMA EXECUTABLE RETURNS INCORRECT ERRORS DURING VALIDATION AGAINST XML SCHEMA
Well, I have to look round in XML DB Forum yet. -
hi,
what are the steps to follow to store or import/ export native xml data into semistructured storage in oracle 11g?????
how to test the performance of the semi structured data??????
Edited by: user11269819 on Jul 17, 2009 11:00 AMI'm not sure which method you are referring to as "semi-structure" (hybrid?) so I'll point you to this [Oracle 11g – XMLType Storage Options | http://www.liberidu.com/blog/?p=203] which is derived from [Oracle® XML DB Developer's Guide 11g Release 1|http://download.oracle.com/docs/cd/B28359_01/appdev.111/b28369/toc.htm]. You can also find more storage related information on Marco's blog under the [storage category | http://www.liberidu.com/blog/?cat=23]
-
Using other site structure storage instead on index.portal
Hi.
The question is quite simple. All data about WebLogic portal structure is stored in index.portal XML file. Are there any ways to move data storage from this XML to database, actually to force portal to retrive data about site structure and portlets on pages from database?
Thanks for all responces.Maksim Galushka wrote:
The question is quite simple. All data about WebLogic portal structure is stored in index.portal XML file. Are there any ways to move data storage from this XML to database, actually to force portal to retrive data about site structure and portlets on pages from database?Yes, use the Portal Administration Tool to create a streaming desktop from the
.portal file. A streaming desktop is stored in the database so that it can be
modified and changed at runtime.
Gerald -
Permission issues accross schemas to load XMLTYPE column - structured storage
Hi,
We have a table in BIUSER schema this table is object-realtionally stored with XMLs. When we are trying to load receords from ETLUSER schema we are getting the error as
Record 1: Rejected - Error on table "BIUSER"."PWAYWORKFILE_TABLE".
ORA-00604: error occurred at recursive SQL level 1
ORA-01031: insufficient privileges
Heres the oracle installation details
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - 64bit Production
PL/SQL Release 11.2.0.3.0 - Production
"CORE 11.2.0.3.0 Production"
All the records are moving to the bad file, whereas the same load happens normally in its own schema i.e. BIUSER
Suspecting this as permission issues we have already given the permission to the table sysnonym as given below in the registration script.
We googled and found few things about ACLs that we are not sure of , its that is the issue please let us know if this table can be created and loaded from different schema
Heres the table creation and registration script
set echo on
spool regschema.log
set define on
set timing on
set long 100000 pages 0 lines 256 trimspool on timing on
drop table PWAYWORKFILE_TABLE;
drop sequence PWAYWORKFILE_TABLE_SEQ;
begin
dbms_xmlschema.deleteschema('workfile.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('TotalLoss.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Salvage.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('rate.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('notes.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Image.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Event.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('estimate.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('CoTotals.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('corr.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Admin.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('Vins.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('commonType.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'commonType.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'commonType.xsd';
BEGIN
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Admin.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Admin.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'CoTotals.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'CoTotals.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Event.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Event.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Image.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Image.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Salvage.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Salvage.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'TotalLoss.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'TotalLoss.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'Vins.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'Vins.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
-- DOM Fidelity enabled due to presence of mixed text, substitution group heads, or repeating choice structures in complex type defintion :-
DBMS_XMLSCHEMA_ANNOTATE.enableMaintainDOM(V_XML_SCHEMA,'RefurbMgr',TRUE);
select /*+ NO_XML_QUERY_REWRITE */
XMLQuery(
'declare namespace xdb = "http://xmlns.oracle.com/xdb"; (:
copy $NEWSCH := $SCHEMA modify (
let $MODEL := $NEWSCH/xs:schema/xs:complexType[11]/xs:all
return (
replace value of node $MODEL/xs:element[2]/xs:complexType/@xdb:maintainDOM with "false",
replace value of node $MODEL/xs:element[3]/xs:complexType/@xdb:maintainDOM with "false",
replace value of node $MODEL/xs:element[4]/xs:complexType/@xdb:maintainDOM with "false"
return $NEWSCH'
passing V_XML_SCHEMA as "SCHEMA"
returning content
into V_XML_SCHEMA
from dual;
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'corr.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'corr.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'estimate.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'estimate.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'notes.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'notes.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'rate.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'rate.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'workfile.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'workfile.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
-- Out-of-Line mappings for 1000 Column optimization :-
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'AdminComp','ADMINCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'NotesComp','NOTESCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'SalvageComp','SALVGCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'CorrComp','CORRCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'ImageComp','IMAGECOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'EventInterfaceManagerComp','EVIFCMGRCOMP_XML');
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'WorkfileType', 'TotalLossComp','TOTALLOSSCOMP_XML');
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => TRUE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
-- Table creation for namespace "http://www.cccis.com/Pathways/Workfile"
set lines 80
CREATE TABLE "PWAYWORKFILE_TABLE"
SequenceID NUMBER,
DL_CLM_FOLDER_ID VARCHAR2(30),
CUST_CLM_REF_ID VARCHAR(25),
ems_file_nm varchar2(256),
EST_IND VARCHAR2(3),
rec_dt date default sysdate,
filesent_datetime date,
CLM_TYP_CD VARCHAR2(2 CHAR),
WORKFILE XMLTYPE
XMLTYPE COLUMN WORKFILE
STORE AS OBJECT RELATIONAL
XMLSCHEMA "workfile.xsd" ELEMENT "PwayWorkfile"
create sequence PWAYWORKFILE_TABLE_SEQ
start with 1
increment by 1
nomaxvalue
create trigger PWAYWORKFILE_TABLE_TRIGGER
before insert on PWAYWORKFILE_TABLE
for each row
begin
select PWAYWORKFILE_TABLE_SEQ.nextval into :new.SequenceID from dual;
end;
desc PWAYWORKFILE_TABLE
/* create synonym */
create or replace public synonym PWAYWORKFILE_TABLE for PWAYWORKFILE_TABLE;
grant select on PWAYWORKFILE_TABLE to BIUSER_RO;
grant select, insert, update,delete on PWAYWORKFILE_TABLE to biuser_full;
exit;
Regards,
ArghyadipHi MarcoGralike,
I have finally acquired a sample schema and xmls to reproduce the errors that i am getting even after acquiring XDBADMIN privilege and registering my schema as GLOBAL.
Here's the problem i am facing, whenever i intend to store the PublisherList (publisher.xsd) out of line while registration i am running into insufficient privilege issues even if i have the schema registered using (LOCAL => FALSE), whereas it runs smooth in BIUSER and if i dont set it out of line it works in ETLUSER as well.
Here are the 2 XSD files
books.xsd --- this is the root element
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
<xs:include schemaLocation="publisher.xsd"/>
<xs:element name="books" type="bookType"/>
<xs:complexType name="bookType" abstract="true">
<xs:sequence>
<xs:element name="author" type="xs:string" minOccurs="0"/>
<xs:element name="title" type="xs:string" minOccurs="0"/>
<xs:element name="genre" type="xs:string" minOccurs="0"/>
<xs:element ref="PublisherList" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
publisher.xsd -- this is a child elelment which in my actual scenario is so big that i must keep it out of line during registration
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" xmlns:xdb="http://xmlns.oracle.com/xdb" version="1.0" xdb:storeVarrayAsTable="true">
<xs:element name="PublisherList" type="PublisherListType"/>
<xs:complexType name="PublisherListType">
<xs:sequence>
<xs:element name="Name" type="xs:string" minOccurs="0"/>
<xs:element name="Office" type="xs:string" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
</xs:schema>
Here's the sample XML
<?xml version="1.0"?>
<books xmlns:xs="http://www.w3.org/2001/XMLSchema">
<author>Writer</author>
<title>The First Book</title>
<genre>Fiction</genre>
<PublisherList>
<Name>Penguin</Name>
<Office>London</Office>
</PublisherList>
</books>
Here's how i am registering the Schemas in BIUSER which has XDBADMIN privilege
DROP TABLE BOOKS_TABLE;
begin
dbms_xmlschema.deleteschema('books.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
begin
dbms_xmlschema.deleteschema('publisher.xsd',dbms_xmlschema.DELETE_CASCADE);
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'publisher.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'publisher.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => FALSE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
declare
V_XML_SCHEMA_NAME VARCHAR2(700) := 'books.xsd';
V_XML_SCHEMA XMLType := xmlType(BfileName('XSD_DIR',V_XML_SCHEMA_NAME),nls_charset_id('AL32UTF8'));
V_SCHEMA_LOCATION_HINT VARCHAR2(700) := 'books.xsd';
begin
DBMS_XMLSCHEMA_ANNOTATE.printWarnings(FALSE);
DBMS_XMLSCHEMA_ANNOTATE.disableDefaultTableCreation(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.SETTIMESTAMPWITHTIMEZONE(V_XML_SCHEMA);
DBMS_XMLSCHEMA_ANNOTATE.disableMaintainDom(V_XML_SCHEMA,FALSE);
DBMS_XMLSCHEMA_ANNOTATE.setOutOfLine(V_XML_SCHEMA,DBMS_XDB_CONSTANTS.XSD_COMPLEX_TYPE,'bookType', 'PublisherList','PUBLISHERLIST_XML');
DBMS_XMLSCHEMA.registerSchema(
SCHEMAURL => V_SCHEMA_LOCATION_HINT
,SCHEMADOC => V_XML_SCHEMA
,LOCAL => FALSE
,GENTYPES => TRUE
,GENTABLES => TRUE
,ENABLEHIERARCHY => DBMS_XMLSCHEMA.ENABLE_HIERARCHY_NONE
end;
CREATE TABLE BOOKS_TABLE
BOOKS XMLTYPE
XMLTYPE COLUMN BOOKS
STORE AS OBJECT RELATIONAL
XMLSCHEMA "books.xsd" ELEMENT "books"
DROP PUBLIC SYNONYM BOOKS_TABLE;
create or replace public synonym BOOKS_TABLE for BOOKS_TABLE;
grant select, insert, update,delete on BOOKS_TABLE to ETLUSER;
Heres the ctl file that i am using
Load_Books.ctl
OPTIONS (ERRORS=100000, SILENT=(HEADER,FEEDBACK),ROWS=500, BINDSIZE=3072000 , READSIZE=3072000)
load data
infile '/apps/dev/PWXML-10/ctl/load_xml.txt'
BADFILE '/apps/dev/PWXML-10/ctl/load_xml.txt.bad'
DISCARDFILE '/apps/dev/PWXML-10/ctl/load_xml.txt.dsc'
append
into table BOOKS_TABLE
filename filler char(120),
BOOKS lobfile(filename) terminated by eof)
'/apps/dev/PWXML-10/ctl/load_xml.txt' would contain the XML file path that i gave
Heres how i am loading the XML through sqlldr in ETLUSER
sqlldr etluser/etluserpassword@MYXMLDBNAME control=Load_Books.ctl log=Load_Books.ctl.log
Here's the error i am getting
Record 1: Rejected - Error on table "BIUSER"."BOOKS_TABLE".
ORA-00604: error occurred at recursive SQL level 1
ORA-01031: insufficient privileges
Hopefully i have given you all the set up required to pin point the evil error.
Please let me know if i have missed something. -
"no raws selected" message for structured storage to xml doc
hi every one , wish really u can help with this problem
Well
One stage of my project is to store an xml file into a table of XMLType column in structured way (using the schema)
So thats what I did:
1. I copied the schema file into this folder http://localhost:8080/public/
2. Then I register the schema
SQL> ALTER SESSION SET EVENTS='31098 trace name context forever';
Session altered.
1 begin
2 dbms_xmlschema.registeruri(
3 'http://localhost:8080/public/auction.xsd',
4 '/public/auction.xsd',
5 local=>true, gentypes=>true, genbean=>false, gentables=>false);
6* end;
SQL> r
1 begin
2 dbms_xmlschema.registeruri(
3 'http://localhost:8080/public/auction.xsd',
4 '/public/auction.xsd',
5 local=>true, gentypes=>true, genbean=>false, gentables=>false);
6* end;
PL/SQL procedure successfully completed.
3. after that I create the table as it mentioned below
SQL> create table struc_100kb( xmldoc sys.xmltype)
2 xmltype column xmldoc store as object relational
3 xmlschema "http://localhost:8080/public/auction.xsd"
4 element "site";
Table created.
SQL>SQL> describe struc_100kb
Name Null? Type
XMLDOC SYS.XMLTYPE(XMLSchema "http:
//localhost:8080/public/auct
ion.xsd" Element "site") STO
RAGE Object-relational TYPE
"site171_T"
4. then I used he sqlldr to load the xml document , and that what included in the control file
load data
infile *
replace
into table struc_100kb
fields terminated by ','
fname filler char(40),
xmldoc lobfile(fname) terminated by EOF
begindata
c:\amal\xmldoc\xmldoc_used\doc100kb.xml
C:\oracle\product\10.1.0\db_1\BIN>sqlldr scott/**** control=c:\amal\work.ctl
But after that when I run any query such as this
select e.xmldoc.extract( 'site/people/person[@id="person12"]/name/text()') from struc_100kb e
I got a message no rows selected
So whats my problem??I thought to show u part of the schema and xml files
auction.xsd
<?xml version="1.0" encoding="UTF-8"?>
<!-- edited with XML Spy v4.4 U (http://www.xmlspy.com) by Brian Murphy (wpi) -->
<!--W3C Schema generated by XML Spy v4.4 U (http://www.xmlspy.com)-->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="address">
<xs:complexType>
<xs:sequence>
<xs:element ref="street"/>
<xs:element ref="city"/>
<xs:element ref="country"/>
<xs:element ref="province" minOccurs="0"/>
<xs:element ref="zipcode"/>
</xs:sequence>
</xs:complexType>
</xs:element>
doc100kb.xml
<?xml version="1.0" standalone="yes" ?>
- <site>
- <regions>
- <africa>
- <item id="item0">
<location>United States</location>
<quantity>1</quantity>
<name>duteous nine eighteen</name>
<payment>Creditcard</payment>
- <description>
- <parlist>
- <listitem>
- <text>
page rous lady idle authority capt professes stabs monster petition heave humbly removes rescue runs shady peace most piteous worser oak assembly holes patience but malice whoreson mirrors master tenants smocks yielded
<keyword>officer embrace such fears distinction attires</keyword>
</text>
.............. -
Versioning xml and structure storage
Hi,
I have following sitiations:
a. I have registered XML schema
b. I have put XML resource (based on the schema) into repos and I get new instance of XMLType in generated table.
That is ok.
My question is:
If I put a new XML file as the same resource will I get a new instance of XMLType or
the previous XMLType will be updated automaticlly ?
I mean , Can I create many version of the same resource and keep only one instance of XMLType in the XML table ?
regards,
CezaryUnless you enable versioning each update of the resource will update the corresponding row in the default table.
-
Not able to properly Save OLE Storage to .docx format.
Hi,
We have legacy C++ code that would embed word .doc files using OLE and save them back to .doc disk based files whenever necessary.
This code does not now work with .docx(.xlsx to that matter).
I am aware that old .doc files are Structured Storage files whereas the latest .docx are zipped xml files.
I am attaching code that would create an OLE storage out of .docx file and save it back to .docx.
When opening the saved .docx file, an error message pops in WinWord indicating that the file is corrupted and that it can repair that file. It works after word repairs the file. But Excel cannot even repair such .xlsx files.
Further, the saved OLE storages are well displayed in our application(in place editing for embedded files).
Can any one suggest what needs to be done?
the following is a sample code.
void CreateStorage()
HRESULT hr = S_OK;
WCHAR filePath[] = L"E:\\Sample.docx";
OleInitialize(NULL);
DWORD renderopt = OLERENDER_FORMAT;
FORMATETC formatEtc;
formatEtc.cfFormat = CF_ENHMETAFILE;
formatEtc.dwAspect = DVASPECT_CONTENT;
formatEtc.lindex = -1;
formatEtc.ptd = NULL;
formatEtc.tymed = TYMED_ENHMF;
LPSTORAGE m_pSrcStorage = NULL; // Pointer to the source storage
IOleObject *pObj = NULL;
ILockBytes *pLockBytes = NULL;
CLSID clsID;
hr = StgCreateStorageEx(NULL, STGM_READWRITE | STGM_CREATE | STGM_SHARE_EXCLUSIVE,
STGFMT_DOCFILE, 0, NULL, NULL, IID_IStorage, (void **)&m_pSrcStorage);
hr = OleCreateFromFile(CLSID_NULL, filePath, IID_IOleObject, renderopt,
&formatEtc, 0, m_pSrcStorage, (void**)&pObj);
IPersistStorage* pPersist = NULL;
hr = pObj->QueryInterface(IID_IPersistStorage, (void**)&pPersist);
if (pPersist != 0)
// Sample code to test OleSave. hr fails due to Access Denied
hr = OleSave(pPersist, m_pSrcStorage, FALSE);
pPersist->Release();
// Debugging code to know the CLSID of the document
pObj->GetUserClassID(&clsID);
unsigned long mytempdata = clsID.Data1;
LPSTORAGE pOleStorage = NULL;
hr = pObj->QueryInterface(IID_IStorage, (void**)&pOleStorage);
if (pOleStorage != NULL)
pOleStorage->Release();
WCHAR newFilePath[] = L"E:\\TestMe.docx";
DWORD STORAGE_OPEN_MODE = STGM_READWRITE | STGM_CREATE | STGM_DIRECT | STGM_SHARE_EXCLUSIVE;
LPSTORAGE pNewStorage = NULL;
hr = ::StgCreateStorageEx(newFilePath, STORAGE_OPEN_MODE, STGFMT_DOCFILE,
0, NULL, NULL, IID_IStorage, (void **)&pNewStorage);
hr = m_pSrcStorage->CopyTo(0, NULL, NULL, pNewStorage);
hr = pNewStorage->Commit(STGC_DEFAULT);
if (pLockBytes != NULL)
pLockBytes->Release();
pNewStorage->Release();
m_pSrcStorage->Release();
pObj->Release();
OleUninitialize();Hi Phani,
As far as I know,only the Office 97-2003 binary file formats use the Windows Structured Storage APIs. Please refer to this KB article:
https://support.microsoft.com/kb/840817?wa=wsignin1.0
And the .docx file should be Office Open XML Formats which do not support Windows Structured Storage APIs.
If you want to manipulate .docx documents using Visual C++, please think about MS Office OLE Automation APIs.
http://www.codeproject.com/Articles/34998/MS-Office-OLE-Automation-Using-C
Also please check this : Sample code for creating a DOCX file. But these sample is written by C#.
http://blogs.msdn.com/b/brian_jones/archive/2006/06/29/651190.aspx
http://blogs.msdn.com/b/dmahugh/archive/2006/06/26/647859.aspx
Best regards,
Shu Hu
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Multiple XML schema in structured XMLType column possible?
I have registered several different xml schema in my 10g database. I have a table with an XMLType column. That column will always hold one XML document that conforms to one of the XML schema. Question: does that by definition mean I have to use "unstructured" storage, or there any way to use structured storage telling Oracle that the XMLType conforms to xsd1 OR xsd2 OR xsd3?
Thanks.In 10gR2 a column based on an XML Schema and using object-relation storage can be bound to one global element. The only way for a column to hold documents associated with more than one global element is if both elements are defined as members of the same substition group.
Maybe you are looking for
-
Smf / sometimes does not configure network interfaces in single-user mode?
From http://groups.yahoo.com/group/solarisx86/message/14785 When booting into single user mode, I often get a message on the console t_optmgmt: System error: Cannot assign requested addressand only the loopback interface is configured (lo0 inet, and
-
CALL FUNCTION STARTING NEW TASK Debug
Hi, How can you debug a function module which is called with an add on 'STARTING NEW TASK' ? Thank you.
-
Just installed Bridge CS5 and it is running very slow!
I am trying to open a folder (in ESSENTIALS / thumbnail view) with 60 jpg files. It is has been running about an hour and they are still not in preview mode. I've done this many times in Bridge CS2 and all the images would open within a few minutes.
-
My wife recently experienced some warning signs that don't look like an Apple warning. The screen went into a semi-sleep mode (dimmed dark) and the message told her to restart the computer by either holding down the restart button or by holding the p
-
I'm having trouble updating my software. I can't use my new iPhone 5 without updating my iTunes without updating my OS X 10.5.8. Please help