Download
slide1 n.
Skip this Video
Loading SlideShow in 5 Seconds..
Marc Meewis Technology Sales Consultant (marcewis@oracle) Oracle Belgium PowerPoint Presentation
Download Presentation
Marc Meewis Technology Sales Consultant (marcewis@oracle) Oracle Belgium

Marc Meewis Technology Sales Consultant (marcewis@oracle) Oracle Belgium

157 Vues Download Presentation
Télécharger la présentation

Marc Meewis Technology Sales Consultant (marcewis@oracle) Oracle Belgium

- - - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - - -
Presentation Transcript

  1. Oracle XML DB Technical Overview Marc Meewis Technology Sales Consultant(marc.meewis@oracle.com) Oracle Belgium

  2. Evolution of Oracle XML Support 8i 9i R1 9i R2 Basic XML Generation and Processing (mid-tier based) Developer Kits DB-integrated XML Storage And Retrieval Native XML DB

  3. What is Oracle XML DB? • High Performance storage and retrieval technologie part of Oracle 9i R2 and + • W3C XML data model in Oracle Server • Standard access methods for querying and navigating XML

  4. Why XML in the Database • Enforce and leverage the XML data model • Loosely coupled, flexible applications • XML Schema, DOM • Enable richer semantics and better management for content-oriented applications • Store as XML vs. Files or LOBs • Queryability, Integrity, etc. • Process XML close to data for high scalability and performance • Generation, Transformation • Superior memory management for large XML

  5. Why XML in the Database (Contd.) • Reduce maintenance costs of extra moving parts • Eliminate separate ‘XML-processing’ layers • Keep applications standards-based • W3C, IETF, ANSI/ISO, J2EE • Eliminate proprietary file formats, message formats, delimited columns

  6. Get better performance & scalability Enforce XML Schema Manage Content & Data Uniformly Eliminate extra moving parts Make DB applications Standards-based Common XML Architectures

  7. Protocol Handlers B-Tree Bitmap Index Text Index XML DB Architecture Content-oriented Access HTTP Client FTP Client WebDAV Client HTTP WebDAV FTP XMLType Views/Tables Repository XML DB Text Index Path Index

  8. JAVA Client OCI Client XML/DOM Parser XQuery XML Schema Cache SQL XMLType Views/Tables Repository 9i XML DB B-TreeBitmap Index Text Index Path Index Text Index XML DB Architecture Data-oriented Access Application Clients JDBC/OCI Oracle Net

  9. JAVA Client OCI Client XML/DOM Parser XQuery XML Schema Cache SQL XMLType Views/Tables Repository 9i XML DB B-TreeBitmap Index Text Index Path Index Text Index XML DB Architecture Data-oriented Access Access Format Application Clients XML Operators XML Views XPath Relational JDBC/OCI XML to Relational Document Oracle Net XPath

  10. JAVA Client OCI Client XML/DOM Parser XQuery XML Schema Cache SQL XMLType Views/Tables Repository 9i XML DB B-TreeBitmap Index Text Index Path Index Text Index XML DB Architecture Data-oriented Access select extractValue(value(x),'/Movie/@Title') ,extractValue(value(x),'/Movie/@RunningTime') from xml_movies x where existsNode(value(x),'/Movie[@Rating="R" and @RunningTime>100]') > 0 / Application Clients JDBC/OCI Oracle Net

  11. JAVA Client OCI Client XML/DOM Parser XQuery XML Schema Cache SQL XMLType Views/Tables Repository 9i XML DB B-TreeBitmap Index Text Index Path Index Text Index XML DB Architecture Data-oriented Access Application Clients select path(1) from resource_view where under_path(res, '/demo/movie', 1) = 1 / JDBC/OCI Oracle Net

  12. XML DB : Storage XMLType CLOB Object Relational Storage Implementation

  13. XML DB : Storage Xpath : / XMLType • Return contents from clob • Reassemble XML combining data structure and schema cache (tags are not stored in ds) + for full retrieval of XML document CLOB Object Relational Storage Implementation

  14. XML DB : Storage Xpath : /a/b[c=“2”]/d XMLType • Read XML document from clob • Parse Document (create DOM) • Resolve xPath • Return result • Rewrite xPath to SQL • Return Result + very fast for all partial manipulation, no DOM involved - resource consuming CLOB Native (=OR) Storage Implementation

  15. XML DB Native XML Storage Object Relational Technology Introduction

  16. Object - relational • Order (1) / Orderlines (M) : 2 relational tables • Order(id, cust_id, po_no) • Orderlines (id, order_id, prod_id, qty) select o.cust_id, l.prod_id, l.qty, l.price from orders o, orderlines l where l.order_id = o.id and l.qty > 20

  17. Object - relational • OR: • OrderlineType (UDT) • Prod_id integer • Qty float • Price float • Order (Object relational table) • Id number • Cust_id number • Po_no number • Lines nested table of OrderlineType

  18. Object - relational Record in Orders table : ID CUST_ID PO_NO LINES ID CUST_ID PO_NO LINES

  19. ID CUST_ID PO_NO LINES Object - relational Collection Record in Orders table : ID CUST_ID PO_NO PROD_ID QTY PRICE PROD_ID QTY PRICE PROD_ID QTY PRICE PROD_ID QTY PRICE

  20. ID CUST_ID PO_NO LINES Object - relational Collection Record in Orders table : ID CUST_ID PO_NO PROD_ID QTY PRICE PROD_ID QTY PRICE PROD_ID QTY PRICE PROD_ID QTY PRICE Implicit Join select o.cust_id, l.prod_id, l.qty, l.price from orders o, table(o.lines) l where l.qty > 20

  21. Complex Type Oracle Object Type Attr Attribute SimpleType Attribute ComplexType ObjectType ComplexType ComplexType ComplexType ComplexType ComplexType CollectionType XML Schema Compilation • Can Be Done Automatically, or Fully/Partially Assisted Via Schema Annotation • When Schema is Used, Tables of Types are Created

  22. Oracle and XML : More info? • OTN: • XML Technology centerhttp://otn.oracle.com/tech/xml/index.html • XML DBhttp://otn.oracle.com/tech/xml/xmldb/index.html

  23. Oracle XML DB DEMO For a complete overview of the features

  24. Oracle XML DB Data Content XML Type XML Repository Summary Oracle & XML Overview

  25. Oracle XML DB Data XML Type XML Repository Summary Oracle & XML Overview

  26. Oracle XML DB • XML Type (data management) • XML Repository (content management)

  27. XML DB XML Type

  28. XML Type • XML Type • Native datatype • methods • XML Type as column • XML Type table

  29. XML Type • XML Type • Native datatype • methods • XML Type as column • XML Type table

  30. createXML • extract • existsNode • isFragment • getClobVal • getStringVal • getNumberVal • transform • toObject • isSchemabased • getSchemaURL • getRootElement • getNameSpace • schemaValidate • isSchemaValidated XML Type • XML Type • Native datatype • methods • XML Type as column • XML Type table (XML table)

  31. XML Type • XML Type • Native datatype • methods • XML Type as column • XML Type table

  32. XML Type • XML Type • Native datatype • methods • XML Type as column • XML Type table create table purchaseorder ( id integer ,data xmltype ) insert into purchaseorder values ( 1 ,xmltype.createXML(‘<>… </>’) )

  33. XML Type • XML Type • Native datatype • methods • XML Type as column • XML Type table (XML table)

  34. XML Type create table purchaseorder of xmltype insert into purchaseorder values ( xmltype.createxml(‘<>…</>’) ) • XML Type • Native datatype • methods • XML Type as column • XML Type table (XML table)

  35. XML Type • XML Type • Native datatype • methods • XML Type as column • XML Type table (XML table) Creating XMLType Instances • Literal Docs or Fragments from String or CLOB • xmltype('<foo bar="3"/>') • From a File • xmltype(getDocument('AmericanBeauty.xml')) • From a URL or Stream • Using HTTPUriType and Methods on It • From Scratch Using DOM API • Via dbms_xmldom Package or Java API

  36. XML Type • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views

  37. XML Type • Full xPath support • SQL select count(*) from purchaseorder x where existsNode( value(x),'/PurchaseOrder[User="SMITH"]‘ ) = 1; Select extractValue( value(x),'/PurchaseOrder/Reference‘ ) from purchaseorder x where existsNode( value(x), '/PurchaseOrder/LineItems/ LineItem/Part[@Id="037429139523"]‘ ) = 1; • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views

  38. XML Type • Full xPath support • DB URI http://…/oradb/schema/table/row/xpath http://…/oradb/scott/emp/row[ename=“KING”] http://…/oradb/scott/emp/row[ename=“KING”]?transform <?xml version="1.0"?> <ROW> <EMPNO>7839</EMPNO> <ENAME>KING</ENAME> <JOB>PRESIDENT</JOB> <HIREDATE>17-NOV-81</HIREDATE> <SAL>5000</SAL> <DEPTNO>10</DEPTNO> </ROW> • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views

  39. XML Type • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views • Register XML schema dbms_xmlschema.registeruri( 'http://www.oracle.com/xdb/orderSchema.xsd’,'/home/SCOTT/xsd/puchaseOrder.xsd' ); • Constrain XMLType to schema CREATE TABLE xmlorder ( info XMLTYPE )XMLSCHEMA 'http://www.oracle.com/xdb/orderSchema.xsd‘ELEMENT 'PurchaseOrder‘ /

  40. XML Type • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views • Storage • CLOB (White Space fidelity) • Object Relational (DOM fidelity) (annotations) • XMLType : abstracts storage details

  41. XML Type • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views • Use triggers for full or partial checks • create or replace trigger PURCHASEORDERVALIDATIONbefore insert on PURCHASEORDER • If (:new.PODOCUMENT.existsnode('//LineItem') > 0) THEN raise MISSING_PARTNUMBER; • end if; • ...

  42. XML Type • Use FK for referential integrity • alter table xdb_departments • add constraint IS_VALID_LOCATION • foreign key (xmldata."Location" ) references locations • / • <Department id="93" name="Labtest3"> • <Location>Diegem</Location> • <Employees> • <Employee empno="310" name="Peter"> • <Job>MANAGER</Job> • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views

  43. XML Type • Functional indexes • xPath indexes • create unique index iPurchaseOrderReference on PurchaseOrder x ( • extractValue( • value(x) • ,'/PurchaseOrder/Reference‘ • ) • ) • / • Full text Search (Oracle Text) • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views

  44. XML Type • Partial update of XML data update purchaseorder p set value(p) = updateXml( value(p) ,'/PurchaseOrder/User/text()‘ ,'DRAKE‘ )where existsNode( value(p), '/PurchaseOrder/Actions/Action[position()=1 and User="VISHU"]‘ ) = 1; • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views

  45. xml_movies = xmltype table : schema related = object relational storage create or replace view movie_info as select extractValue(value(x),'/Movie/@Title') as TITLE ,extractValue(value(x),'/Movie/@imdbCode') as IMDBCODE ,extractValue(value(x),'/Movie/@rating') as RATING ,extractValue(value(x),'/Movie/Review/@quotation') AS QUOTATION from xml_movies x / SQL> desc movie_info Name Null? Type ----------------------------------------- -------- ---------------------------- TITLE VARCHAR2(100) IMDBCODE NUMBER(38) RATING VARCHAR2(1) QUOTATION FLOAT(126) XML Type • xPath • XML Schema • XML consistency • XML integrity • XML indexing • XML Updating • Relational Views

  46. XML DB – XMLType • XSL-T • XML Views (relational to XMLType) • Memory Management (lazy loaded virtual DOM) • Schema cache • Programming model • Client side JDBC/OCI, Javabeans • Server side Java, PL/SQL