SlideShare a Scribd company logo
1 of 83
OGh Ace Case
     Oracle XML Database – Part 1




Marco Gralike – AMIS




                                    
                                    
                                            1
A shortlist…

 Started as DBA with Oracle 7 on Windows NT 3.1
  (1994)
 Experienced with Oracle 6 / 7.x / 8.x / 9.x / 10.x and
  11.1
 Started with Oracle XMLDB in 2003 (Oracle 10.1.3)
 Oracle 11g Beta tester for Oracle XMLDB
 Dedicated XMLDB Blog (blog.gralike.com)
 Active Oracle OTN XMLDB Forum Member
 Oracle ACE Award for XMLDB Community
  Contributions




                                                           
                                                           
                                                                   2
Overview

 What is Oracle XML Database
 The Protocol Server
   Configuration and Basic Concepts
 HTTP API’s
   PL/SQL Gateways, ORADB, NDWS
 URITypes in the Database
   DBUri-, HTTPUri- and XDBUriTypes
 Combining Worlds
   Selecting and Saving of Files Outside the Database
 Repository Events




                                                         
                                                         
                                                                 3
Storing XML in Oracle XML Database
 File Storage
 XML Database      Oracle XML DB
   Native           A World within a World
   XML Enabled
                     Complies to Standards
                     License Free
                     Core part of (OXJR)DBMS

                     The (relational) foundation
                      is there and can be used for
                      solving XML “imperfections”




                                                     
                                                     
                                                             4
Oracle XML Milestones / Importance
   11gR1
            XDB

  10gR2


  10gR1


9.2.0.3.0
            XDK


       9i



    8iR1


                  XMLType   Performance   XQuery     Binary XML
                  SQL/XML   Robustness             XMLIndex, NDWS




                                                                    
                                                                    
                                                                            5
XMLType
 XML data exchange
   SQL, C, C++, Java, PL/SQL, .Net, etc
   Via Protocol Listener supported methods
   Via Oracle Advanced Queuing methods (Oracle 11gR1)
 XML data storage
   CLOB, Object Relational, Binary XML (11gR1)
 XML data validation
   XMLSchema, Programmatically, via Storage definitions
 XML data creation
   XML Operators, Packages




                                                           
                                                           
                                                                   6
The Protocol Server




                      
                      
                              7
XMLType storage and more

                           Out-of-the-Box
                            Interfacing



   Logical
 Design Level
                              Security,
                            Management,
                             Versioning


   Physical
 Design Level




                                            
                                            
                                                    8
Protocol Server - Detail




 * Listener
                        listener.ora or database parameters
 * Shared Server
 * Protocol “Adapter”   xdbconfig.xml         xdb.xdb$config




                                                              
                                                              
                                                                      9
Configuration of XDBCONFIG.xml file
 PL/SQL Control
   DBMS_XDB.GetHttpPort(), DBMS_XDB.GetFTPPort()
   DBMS_XDB.SetHttpPort(), DBMS_XDB.SetFTPPort()


 WebDAV
   XMLSpy
   JDeveloper


 Drag & Drop
   Notepad
   MS Word




                                                    
                                                    
                                                            10
Protocol Server Access




 WebDAV        FTP




              HTTP(s)




                         
                         
                                 11
Enable Protocol Server Functionality




                     demo01.sql




                                       
                                       
                                               12
HTTP API‟s




             
             
                     13
Protocol Server HTTP API‟s
 Your Own…
   Java Servlets, PL/SQL Gateway


 PL/SQL Gateways
   APEX (/apex/*)                        PL/SQL


 “Servlets”
     Native Database WebService (/orawsv/*)     C
     ReportFmwkServlet (/orarep/*)              C
     TestServlet (/Test)                   Java
     DBURI (/oradb/*)                      C




                                                     
                                                     
                                                             14
Native Database Web Services (NDWS)




  WSDL Structure




   Architecture




                                      
                                      
                                              15
Native Database WebService (NDWS)
1. Enable the Protocol Server for HTTP access
2. Enable the orawsv entry point in xdbconfig.xml
3. Create a user and grant access
     DBMS_NETWORK_ACL_ADMIN
     XDB_WEBSERVICES
     XDB_WEBSERVICES_OVER_HTTP
     XDB_WEBSERVICES_WITH_PUBLIC
4. Create your procedure
     For instance a procedure called OBJECTTYPES
5. Test (demo02.sql)
     http://localhost:8080/orawsv/SCOTT/OBJECTTYPES?wsdl




                                                            
                                                            
                                                                    16
DBURI Servlet
 Access Any Table or View From a Browser
 DBUriType
 Security is handled via DB roles
 Transformation via XSL
 Query options via XPath Expressions




http://localhost:8080/public/demo03/




                                            
                                            
                                                    17
URIType„s in the Database




                            
                            
                                    18
URITypes
 DBUriType
   Represents an URI that targets database data


 HTTPUriType
   Represents an URL that starts with http://
   Uses UTL_HTTP


 XDBUriType
   Represents an URI that targets a resource in the Repository




                                                                  
                                                                  
                                                                          19
HTTPUriType - Google API
SQL>   SELECT extractvalue(value(t),'/Hostip/gml:name'
  2                            , 'xmlns:gml=quot;http://www.opengis.net/gmlquot;
  3                               xmlns=quot;http://www.hostip.info/apiquot;')   AS quot;Namequot;
  4    ,      extractvalue(value(t),'/Hostip/countryName'
  5                            , 'xmlns:gml=quot;http://www.opengis.net/gmlquot;
  6                               xmlns=quot;http://www.hostip.info/apiquot;')   AS quot;CNamequot;
  7    ,      extractvalue(value(t),'/Hostip/countryAbbrev'
  8                            , 'xmlns:gml=quot;http://www.opengis.net/gmlquot;
  9                               xmlns=quot;http://www.hostip.info/apiquot;')   AS quot;CAbbrevquot;
 10    ,      extractvalue(value(t)
                       ,'/Hostip/ipLocation/gml:PointProperty/gml:Point/gml:coordinates'
11                             , 'xmlns:gml=quot;http://www.opengis.net/gmlquot;
12                                xmlns=quot;http://www.hostip.info/apiquot;')   AS quot;Coord.quot;
13     FROM TABLE (XMLSEQUENCE (EXTRACT
                  (HTTPURITYPE ('http://api.hostip.info/?ip=141.146.8.66').getxml ()
14                              , '/HostipLookupResultSet/gml:featureMember/Hostip'
15                              , 'xmlns:gml=quot;http://www.opengis.net/gmlquot;
16                                 xmlns=quot;http://www.hostip.info/apiquot;' ))) t;

Name                 CName                CAbbrev              Coordinates
-------------------- -------------------- -------------------- --------------------
Redwood City, CA     UNITED STATES        US                   -122.206,37.5164




                                                                                           
                                                                                           
                                                                                                   20
HTTPUriType – Accessing RSS Feeds
SQL> SELECT *
  2 FROM XMLTABLE
     (XMLNAMESPACES('http://purl.org/dc/elements/1.1/' AS quot;MGRquot;)
  3                 ,'//item'
  4           passing
       HTTPURITYPE('http://my.blog.com/blog/?feed=rss2').getXML()
  5           columns
                title varchar2(50)
                      path '/item/title/text()',
  6             link varchar2(50)
                      path '/item/link/text()',
  7             publication_date varchar2(50)
                      path '/item/pubDate/text()',
  8             creator varchar2(50)
                      path '/item/MGR:creator/text()',
  9             description      varchar2(250)
                      path '/item/description/text()',
 10             category XMLTYPE
                      path '/item/category/text()');




                                                                    
                                                                    
                                                                            21
XML/SQL Output


TITLE     LINK     PUBLICATION_DATE      CREATOR
-----------------------------------------------------------------
DESCRIPTION     CATEGORY
-----------------------------------------------------------------

Quering RSS Feeds The XMLDB Way
http://feeds.feedburner.com/~r/Bloggralikecom/~3/3
Wed, 25 Jun 2008 16:47:19 +0000
Marco Gralike
Actually this IS old stuff (2006), but it got lost IN a…
< ![CDATA[11g]]>< ![CDATA[Howto]]>




                                                demo04.sql




                                                                    
                                                                    
                                                                            22
XDBUriType
 Useful for accessing resources in the XML DB
  Repository
   Resources = files and folders
 Helpful during XML Schema and XML Document
  registration
 Helpful while insert XML document content from the
  XML DB Repository into XMLType Tables, Columns or
  Views




                                                       
                                                       
                                                               23
Combining Worlds




                   
                   
                           24
Combining BFileName with XML
 The bfilename function returns a BFILE locator for a
  physical LOB binary file
 Syntax: bfilename( 'directory', 'filename' )
 Often used for inserting huge XML documents into the
  database




 But you can do more…




                                                         
                                                         
                                                                 25
Selecting XML Data outside the Database
SQL> SELECT
   extract((XMLTYPE(bfilename('XMLSTORE','data.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*')
               AS quot;XDATAquot;
  2 FROM dual;

XDATA
-------------------------------------------------------
<root>
  <id>0</id><info><info_id>0</info_id>
  <info_content>Text</info_content></info>
</root>


                                                             demo06.sql
SQL> SELECT xdata
  2 FROM (XMLTABLE('*'
  3                   PASSING
    (XMLTYPE(bfilename('XMLSTORE','data.xml'),NLS_CHARSET_ID('AL32UTF8')))
  4                   COLUMNS xdata xmltype PATH '/*'
  5                 )
  6        );

XDATA
-------------------------------------------------------------------------------------
<root>
  <id>0</id><info><info_id>0</info_id><info_content>Text</info_content></info></root>




                                                                                        
                                                                                        
                                                                                                26
Using dbms_xmldom or dbms_xslprocessor
 Ways to write to disk
   dbms_xslprocessor.clob2file
   dbms_xmldom.writetofile
 Syntax: bfilename( 'directory', 'filename' )
 Often used for inserting huge XML documents into the
  database




 But you can do more…




                                                         
                                                         
                                                                 27
Saving XML Data outside the Database
SQL>   declare
2      rc sys_refcursor;
3      BEGIN
4        open rc FOR
           SELECT * FROM
           ( SELECT rownum FROM dual connect BY level < 100 );
5      dbms_xslprocessor.clob2file( xmltype( rc ).getclobval( ) , ‘STORE’,'anton.xml’);
6      END;
7/



SQL>   declare
2      rc sys_refcursor;
3      doc DBMS_XMLDOM.DOMDocument;
4      begin
5         open rc for
             select * from
               ( select rownum from dual connect by level < 100 );
6            doc := DBMS_XMLDOM.NewDOMDocument(xmltype( rc ));
7            DBMS_XMLDOM.WRITETOFILE(doc, ‘STORE/marco.xml’);
8   end;
9   /
                                                                demo07.sql




                                                                                      
                                                                                      
                                                                                              28
Repository Events




                    
                    
                            29
Repository Events
 Repository Events are events which get triggered via
  defined methods on the Repository
   For Example:
   creating, deleting, locking, unlocking, placing under version
    control, checking in, checking out, unchecking out, opening,
    and/or updating


 Repository Events <> Database Triggers
 Are specially designed to act on Repository actions
 Repository operation can be associated with one or
  more repository events




                                                                    
                                                                    
                                                                            30
Repository Events
 Event Listener
   Java class or a PL/SQL package or an object type
   A repository event listener can be configured for a particular
    resource or for the entire repository
   It comprises a set of PL/SQL procedures or Java methods,
    each of which is called an event handler
 Event Handler
   Each event handler processes a single event
 Resource Configuration File
   Associates a repository event listener with a resource by
    mapping a resource configuration file to the resource (=
    folder or file)




                                                                     
                                                                     
                                                                             31
Repository Events




                    demo08.sql




                                 
                                 
                                         32
End Part 1




        marco.gralike@amis.nl
        http://www.amis.nl




                                
                                
                                        33
OGh Ace Case
     Oracle XML Database – Part 2




Marco Gralike – AMIS




                                    
                                    
                                            34
Disclaimer

                       The following are “Rules of
                         Numb”

                       Every environment has its own
                          unique
                       criteria and needs…

Pay attention
  to:                            “Maintainability”
                “Testing”
  “Choice”                       “Extendibility”
                “Performance”
  “Design”




                                                       
                                                       
                                                               35
Overview

 Storage of XML data in the Oracle database
 Physical and Logical Design
 The General “Issues” with XML
 Performance !
 An Customer Use Case




                                               
                                               
                                                       36
Storage of XML data in the
        Database




                             
                             
                                     37
Storage, Logical & Physical Design ?




                                       
                                       
                                               38
The “XML Relational” Mindset




            CREATE TABLE MYTABLE

                    xmltype);
            (data


                           Here is your
                            Design !




                                          
                                          
                                                  39
“Hidden” Oracle Design Features
CREATE TABLE “AMISquot;.“OBJECTquot; OF quot;SYSquot;.quot;XMLTYPEquot;
  XMLSCHEMA quot;http://www.myserver.com/myapp/1.0/xsd/object.xsdquot;
ELEMENT “ROOTquot; ID 4733
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536Schema: your container for
                 XML NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
   2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 Design
                    Logical and Physical BUFFER_POOL DEFAULT)
  TABLESPACE quot;USERS“
VARRAY quot;XMLEXTRAquot;.quot;NAMESPACESquot; STORE AS BASICFILE LOB
   quot;NAMESPACES660_Lquot;
  (ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 CACHE
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
   2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))
VARRAY quot;XMLEXTRAquot;.quot;EXTRADATAquot; STORE AS BASICFILE LOB
   quot;EXTRADATA659_Lquot;
  (ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 CACHE
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS
                                           Physical Design
   2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))




                                                                      
                                                                      
                                                                              40
Designing Your Building Blocks
 Logical Design
   XML Instance / Document
   XML Schema (XDB Annotations)
   XML Evolution, Validation
 Physical Design
   Oracle Database / Storage Design based on XML Logical
    Design
   Binary Storage (Encrypted, Compressed, Validation,
    Evolution?)
   XML Schema (XDB Annotations)
   Indexes (BTree, IOT, XMLIndex, Function Based, Text)

 Is your XML data CONTENT or DOCUMENT driven ?
  Think: Access Paths, The Optimizer, Performance




                                                            
                                                            
                                                                    41
Control your design: XML Schemata
 Logical, Physical Data Design
 Maintained via the Repository
   Storage, Evolution, Security
 Storage can be a Black Box
  (without schemata)
   CLOB
   Binary XML (ALLOW NONSCHEMA)
 Namespaces (Recursiveness ?!)
 Overhead due to Parsing
 XDB Annotations can define:
   Storage, Control, Name




                                    
                                    
                                            42
When to use what kind of Storage



 Document centric XML  CLOB                     XML Document


   No shredding, document “keeps intact”
 Content centric XML        Object Relational
   Shredding, rebuilding document info            XML Document
                                                      part




                                                                 
                                                                 
                                                                         43
Oracle XML DB Data Storage




                             
                             
                                     44
Choices…
 XMLType CLOB
   Document Driven
   Only in 11gR1 and upwards  XMLIndex
 XMLType OR
     10gRx  Index Organized Tables
     11gR1 and upwards  BTree indexes
      XML Schema “overhead”, Data is “shredded”
  
     Query Re-write
 XMLType Binary XML
   XMLType OR features kind off behavior PLUS
   Post Parse Presentation




                                                  
                                                  
                                                          45
Physical & Logical Design




                            
                            
                                    46
XDB Annotations




                  Hybrid: CLOB within OR
                  (Binary XML incompatible)




                                              
                                              
                                                      47
Mixing Logical and Physical Design




                                     
                                     
                                             48
xdb:annotations – XML Schema Declaration
 xdb:storeVarrayAsTable (“false” < 11g >= “true”)
   If true, the varray is stored as a table (OCT)
   If false, the varray is stored in a LOB
 xdb:mapUnboundedStringToLob (default=“false”)
   If true, then unbounded strings are mapped to CLOB
    instances by default. Similarly, unbounded binary data gets
    mapped to a BLOB value, by default.
   If false, then unbounded strings are mapped to
    VARCHAR2(4000) values, and unbounded binary
    components are mapped to RAW(2000) values.


Don’t forget: xmlns:xdb=quot;http://xmlns.oracle.com/xdbquot;




                                                                  
                                                                  
                                                                          49
xdb:annotations – Global ComplexTypes
 xdb:maintainDOM (default=“true”)
   If false, then the output is not guaranteed to have the same
    DOM action as the input.
 xdb:SQLSchema
   Name of the database user who
    owns the type specified by SQLType
 xdb:SQLType
   Name of the SQL type that corresponds
    to this XML element declaration
   Any SQL data type except NCHAR, NVARCHAR, and NCLOB




                                                                   
                                                                   
                                                                           50
Some xdb:annotations – Elements
(SimpleTypes)
 xdb:defaultTable
 xdb:defaultTableSchema
 xdb:maintainDOM
 xdb:maintainOrder

 xdb:SQLInline

 xdb:columnProps
 xdb:tableProps




                                  
                                  
                                          51
Generate or Manual Creation
 Manual Creation
   DBMS_METADATA.GET_DDL
   EVENT setting
     •   [alter session set events='31098 trace name context forever'; ]
   Use Oracle 11g generation to apply in 10gR2 (IOT <> BTREE)


 Generate via DBMS_XMLSCHEMA
   XML Schema Based
   XDB Annotations
   JDeveloper or XMLSpy




                                                                           
                                                                           
                                                                                   52
Creating Storage Structures (OR)
SQL> BEGIN
     DBMS_XMLSCHEMA.registerSchema
      (SCHEMAURL => 'http://www.myserver.com/root.xsd',
       SCHEMADOC => xdbURIType('/public/root.xsd').getClob(),
       LOCAL     => TRUE, -- local
       GENTYPES => TRUE, -- generate object types
       GENBEAN   => FALSE, -- no java beans
       GENTABLES => TRUE, -- generate object tables
       OWNER     => USER);
     END;
   /




                                                           
                                                           
                                                                   53
Result Object Relational Storage
SQL> select * from tab;

TNAME                            TABTYPE
------------------------------   -------
INFO_TABLE                       TABLE
ROOT_TABLE                       TABLE

SQL> select dbms_metadata.get_ddl('TABLE','ROOT_TABLE') from dual;

DBMS_METADATA.GET_DDL('TABLE','ROOT_TABLE')
------------------------------------------------------
CREATE TABLE “AMISquot;.quot;ROOT_TABLEquot; OF quot;SYSquot;.quot;XMLTYPEquot;
XMLSCHEMA quot;http://www.myserver.com/root.xsdquot; ELEMENT quot;ROOTquot;
PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING
  STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645
  PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)
  TABLESPACE quot;USERSquot;
VARRAY quot;XMLEXTRAquot;.quot;NAMESPACESquot; STORE AS BASICFILE LOB quot;NAMESPACES780_Lquot;
 ...
VARRAY quot;XMLDATAquot;.quot;INFOquot;.quot;SYS_XDBPD$quot; STORE AS BASICFILE LOB quot;SYS_XDBP...quot;
DISALLOW NONSCHEMA
...




                                                                            
                                                                            
                                                                                    54
XMLType CLOB Storage (simplistic)



    SQL> create table XMLCLOB of XMLType
         XMLTYPE store as CLOB;

    Table created.




                                           
                                           
                                                   55
XMLType Object Relational Storage (simplistic)



    SQL> create table XMLOR of XMLType
          XMLTYPE store as OBJECT RELATIONAL
          XMLSCHEMA
      quot;http://www.amis.nl/xsd/root.xsdquot;
             ELEMENT quot;RootElementquot;;

    Table created.




                                                 
                                                 
                                                         56
XMLType Binary XML Storage (simplistic)

    SQL> create table XMLBIN of XMLType
         XMLTYPE store as BINARY XML;

    Table created.

    SQL> create table XMLBIN_XSD of XMLType
          XMLTYPE store as BINARY XML
          XMLSCHEMA
      quot;http://www.amis.nl/xsd/root.xsdquot;
             ELEMENT quot;RootElementquot;;

    Table created.




                                              
                                              
                                                      57
The general “issues” with
          XML




                            
                            
                                    58
Lets presume it is Relational




                                
                                
                                        59
Structured Relational Data




                             
                             
                                     60
Relational Fundamentals
 What goes IN, must come OUT (IN=OUT)
   Regarding Data Integrity, Meaning and Context

 Why do we DESIGN in the First Place?
     ACID: Atomicity, Consistency, Isolation, Durability
      Edgar F Codd’s 12 Rules defining a “Relational Database”
  
     Database Normalization (eg. 3NF)
     Nullology
     Imperfections of the (Procedural / Query) Language

 Maintainability, Performance, Usability
 Decades of Innovation, Methods and Standards




                                                                 
                                                                 
                                                                         61
Query Optimizer – Optimal Access Paths




                                         
                                         
                                                 62
Structured Data   Unstructured (XML) Data




                                            
                                            
                                                    63
Optimal Access Paths for a Tree ?

Keep it intact?
To much empty
space!
Access
Optimization?

Should we shred
it?
Rebuilding and
shredding the tree
structure…?

There is no
solution for




                                    
                                    
                                            64
Relational contra XML Data




 ONE…yes ONE
 XML document
 can contain a
 whole database,
 schema of objects
 !




                             
                             
                                     65
Impedance Mismatch
 Different data models.
     E.g. XPath, XQuery models an XML document as a tree,
      while most general purpose programming languages have no
      native data types for a tree.


 Different programming paradigms.
     XSLT is a functional language, while Java is object-
      oriented, and Perl is a procedural one.




Source: Wikipedia SXML




                                                                 
                                                                 
                                                                         66
So in General
 NO PROBLEM
   Data Shipping / Transport XML via XML
   UI’s that “Understand”, are based on XML


 PROBLEM
   Accessing Data in XML structures
     •   CPU Intensive
     •   Memory Intensive
          PGA, XML Fragments, Document Object Model
   Transformation:
     •   XML  Relational (Risk: Data / Information Loss)
     •   Document Object Model




                                                             
                                                             
                                                                     67
Issues you will encounter with XML
 The nature of XML:
    It is (most of the time) not Structured
    It can not be stored in a Universal XML “Container”
    It can not be accessed via a standard Access Path Method
     that “understands” the free format XML structure all the time…


 It is all about free format
    OK and Not OK
    Standards: W3C, Oasis, etc


 Performance problem induced by its Nature…
    Nature is not structured…(as is Human Nature)




                                                                  
                                                                  
                                                                          68
Nope…!
 XML can handle (package) structured and semi-
  structured data and sometimes even unstructured
  data.
 The open standard for data exchange
 If it is XML, use XML !
 Oracle XML Database = Continues Innovation




“There is essentially no computer in the world, desktop,
  handheld, or backroom, that doesn't process XML
  sometimes...”




                                                           
                                                           
                                                                   69
Performance !




                
                
                        70
Performance
 Do it faster
    for example  via indexes
 Do it smarter
    for example  less data  partitioning




                                              
                                              
                                                      71
XMLType Storage (Object Relational)




                    Edith.sql




                                      
                                      
                                              72
Recap…
                                              XMLDB    Relational
                  XMLDB Data Storage
                                                        World
                                               World


                       XMLType                         XMLType


       v?
                                                        Views
                       (Tables)


               Structured   Binary XML   Hybrid
Unstructured
                                                        (Object)
Document       Content      Mixed?       Content
                                                       Relational
na             complex[n]   complex[y]   complex[n]
                                                         Objects
CLOB           OR           BINARY       OR/CLOB
XSD [y]        XSD [y]      XSD [y/n]    XSD [y]
                                                       Relational
XMLIndex       BTree, IOT   XMLIndex     BTree, IOT
                                                        Tables




                                                                    
                                                                    
                                                                            73
Some XML Storage Issues

                     O.R.   CLOB       Binary XML
  Schema Based        +       -             +
   XSD Flexibility    -     (in xml)      ++
        DML          ++         -          +
 XPath Performance   ++         -          +
     Throughput       -         +         ++
Memory Management    ++         -          +
     XMLIndex         -         +          +
   Function / Text   +          +          +
    BTree (/ IOT)    +          -          -




                                                    
                                                    
                                                            74
Indexation of Data
 BTree Indexes                  (11g Schema
                                 based)
 Cluster Indexes
 Bitmap Indexes
                                
 Index Organized Table
                                 (10g Schema
  Indexes
                                  based)
 Function Based Indexes
                                
 Partition Indexes
                                 >= V 11.1.0.7.0
 Domain Indexes
   Oracle Text Context Index
                                
   Unstructured XMLIndex
                                




                                                    
                                                    
                                                            75
XML Objects (XOBs)  DOM
                                       String
                                       Char


                      bookstore
                                                             Varchar
                                                             String
                                                              2(20)

         book                       whitepaper

 title   author author chapter    title author   id    paragraph

                                        Number
                                         Float
                      content                          content

                                                      CLOB




                                                                       
                                                                       
                                                                               76
Query Re-Write
                                          BTre
                                          BTre
                                           BTre
                                          ee
                                           e
                                         Index
                                          Index
                                           Index
                        bookstore
                                                             Function
                                                            based Index
                                                              (XPath)
         book                         whitepaper

 title   author author chapter      title author      id   paragraph
             XMLIndex

                        content                            content
                                           Oracle
                                         Text Index




                                                                          
                                                                          
                                                                                  77
A Customer Use Case




                      
                      
                              78
ETL in Memory Processing

                                                                Memor
                                                                   y
                                                                / DOM



          Oracle
                                     BLOB                CLOB                    XMLType
      Advanced Queue




                        Validation
 Process                                    Shred Elements               Store in          Oracle
                       XML Schema
 Checks                                      Via XMLDOM                 ETL Tables         Workflow
                         (JAVA)




                                                                                                      
                                                                                                      
                                                                                                              79
ETL - XMLType Table (OR) Processing



      Oracle
                               BLOB                   CLOB
  Advanced Queue




                            Validation
           XMLType Table                  Store in                    Oracle
                             Against                         Checks
              (O.R)                      ETL Tables                   Workflow
                           XML Schema




                                  Rewrite on Disk
                                      / XOB
                                   (Relational)




                                                                                 
                                                                                 
                                                                                         80
Results XML Relational Approach
 100.000 “zaken” shredded, validated in 5 minutes
  (instead of 1000 “zaken” in 3 minutes)
 Avoiding
   ORA-31186: Document contains too many nodes
 Scalable
   Efficient with Memory and CPU
 Checked on 9.2.0.5 database version




                                                     
                                                     
                                                             81
References
 Oracle 11g XMLDB Developers Guide
 The XMLDB Forum
   http://forums.oracle.com/forums/forum.jspa?forumID=34
 OTN XML DB FAQ Thread
   http://forums.oracle.com/forums/thread.jspa?threadID=410714
 Technology Blogs
   http://blog.gralike.com
   http://technology.amis.nl/blog
 Thanks to:
   Mark Drake, Tom Kyte
   Keith Matthew, Anton Scheffer, Laurent Schneider




                                                              
                                                              
                                                                      82
marco.gralike@amis.nl
http://www.amis.nl




                        
                        
                                83

More Related Content

What's hot

XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...Marco Gralike
 
Expertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesExpertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesMarco Gralike
 
An introduction into Oracle VM V3.x
An introduction into Oracle VM V3.xAn introduction into Oracle VM V3.x
An introduction into Oracle VM V3.xMarco Gralike
 
Oracle 12.2 sharded database management
Oracle 12.2 sharded database managementOracle 12.2 sharded database management
Oracle 12.2 sharded database managementLeyi (Kamus) Zhang
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSpeedment, Inc.
 
High Performance Plsql
High Performance PlsqlHigh Performance Plsql
High Performance PlsqlGuy Harrison
 
Advance java session 5
Advance java session 5Advance java session 5
Advance java session 5Smita B Kumar
 
SQLcl the next generation of SQLPlus?
SQLcl the next generation of SQLPlus?SQLcl the next generation of SQLPlus?
SQLcl the next generation of SQLPlus?Zohar Elkayam
 
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Dave Stokes
 
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they doDave Stokes
 
HPCC Systems JDBC Driver
HPCC Systems JDBC DriverHPCC Systems JDBC Driver
HPCC Systems JDBC DriverHPCC Systems
 
Exploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12cExploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12cZohar Elkayam
 
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles DaroldPGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles DaroldEqunix Business Solutions
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with javaVinay Gopinath
 

What's hot (20)

XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
XMLDB Building Blocks And Best Practices - Oracle Open World 2008 - Marco Gra...
 
Expertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use CasesExpertezed 2012 Webcast - XML DB Use Cases
Expertezed 2012 Webcast - XML DB Use Cases
 
An introduction into Oracle VM V3.x
An introduction into Oracle VM V3.xAn introduction into Oracle VM V3.x
An introduction into Oracle VM V3.x
 
Oracle 12.2 sharded database management
Oracle 12.2 sharded database managementOracle 12.2 sharded database management
Oracle 12.2 sharded database management
 
Silicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your databaseSilicon Valley JUG - How to generate customized java 8 code from your database
Silicon Valley JUG - How to generate customized java 8 code from your database
 
XML parsing using jaxb
XML parsing using jaxbXML parsing using jaxb
XML parsing using jaxb
 
Postgresql
PostgresqlPostgresql
Postgresql
 
PHP Oracle
PHP OraclePHP Oracle
PHP Oracle
 
Wizard of ORDS
Wizard of ORDSWizard of ORDS
Wizard of ORDS
 
Hibernate performance tuning
Hibernate performance tuningHibernate performance tuning
Hibernate performance tuning
 
High Performance Plsql
High Performance PlsqlHigh Performance Plsql
High Performance Plsql
 
Advance java session 5
Advance java session 5Advance java session 5
Advance java session 5
 
SQLcl the next generation of SQLPlus?
SQLcl the next generation of SQLPlus?SQLcl the next generation of SQLPlus?
SQLcl the next generation of SQLPlus?
 
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
Open Source 1010 and Quest InSync presentations March 30th, 2021 on MySQL Ind...
 
Sql plsql online training
Sql plsql online trainingSql plsql online training
Sql plsql online training
 
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql  - how do pdo, mysq-li, and x devapi do what they doPhp &amp; my sql  - how do pdo, mysq-li, and x devapi do what they do
Php &amp; my sql - how do pdo, mysq-li, and x devapi do what they do
 
HPCC Systems JDBC Driver
HPCC Systems JDBC DriverHPCC Systems JDBC Driver
HPCC Systems JDBC Driver
 
Exploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12cExploring Oracle Multitenant in Oracle Database 12c
Exploring Oracle Multitenant in Oracle Database 12c
 
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles DaroldPGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
PGConf.ASIA 2019 Bali - A step towards SQL/MED - DATALINK - Gilles Darold
 
Restful web services with java
Restful web services with javaRestful web services with java
Restful web services with java
 

Similar to Ogh Ace Case, Part 1 and 2, Oracle Xml Database, Marco Gralike

X Aware Ajax World V1
X Aware Ajax World V1X Aware Ajax World V1
X Aware Ajax World V1rajivmordani
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration BackendArun Gupta
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012Arun Gupta
 
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...
PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...Dave Stokes
 
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019Dave Stokes
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...Olivier DASINI
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Marco Gralike
 
Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Dave Stokes
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Arun Gupta
 
OOW09 EBS Tech Essentials
OOW09 EBS Tech EssentialsOOW09 EBS Tech Essentials
OOW09 EBS Tech Essentialsjucaab
 
JSON in der Oracle Datenbank
JSON in der Oracle DatenbankJSON in der Oracle Datenbank
JSON in der Oracle DatenbankUlrike Schwinn
 
Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014Arun Gupta
 
Weblogic Server
Weblogic ServerWeblogic Server
Weblogic Serveracsvianabr
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6glassfish
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMark Swarbrick
 
What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6WSO2
 
Experiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the DatabaseExperiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the DatabaseMarcelo Ochoa
 
Playing in the Same Sandbox: MySQL and Oracle
Playing in the Same Sandbox:  MySQL and OraclePlaying in the Same Sandbox:  MySQL and Oracle
Playing in the Same Sandbox: MySQL and Oraclelynnferrante
 

Similar to Ogh Ace Case, Part 1 and 2, Oracle Xml Database, Marco Gralike (20)

X Aware Ajax World V1
X Aware Ajax World V1X Aware Ajax World V1
X Aware Ajax World V1
 
GlassFish REST Administration Backend
GlassFish REST Administration BackendGlassFish REST Administration Backend
GlassFish REST Administration Backend
 
GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012GlassFish REST Administration Backend at JavaOne India 2012
GlassFish REST Administration Backend at JavaOne India 2012
 
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...
PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...PHP,  The X DevAPI,  and the  MySQL Document Store Presented January 23rd, 20...
PHP, The X DevAPI, and the MySQL Document Store Presented January 23rd, 20...
 
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
PHP, The X DevAPI, and the MySQL Document Store -- Benelux PHP Confernece 2019
 
MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...MySQL Document Store - A Document Store with all the benefts of a Transactona...
MySQL Document Store - A Document Store with all the benefts of a Transactona...
 
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
Real World Experience With Oracle Xml Database 11g An Oracle Ace’s Perspectiv...
 
Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019Python And The MySQL X DevAPI - PyCaribbean 2019
Python And The MySQL X DevAPI - PyCaribbean 2019
 
Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011Java EE 6 workshop at Dallas Tech Fest 2011
Java EE 6 workshop at Dallas Tech Fest 2011
 
OOW09 EBS Tech Essentials
OOW09 EBS Tech EssentialsOOW09 EBS Tech Essentials
OOW09 EBS Tech Essentials
 
In-memory Databases
In-memory DatabasesIn-memory Databases
In-memory Databases
 
JSON in der Oracle Datenbank
JSON in der Oracle DatenbankJSON in der Oracle Datenbank
JSON in der Oracle Datenbank
 
Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014Java EE 7 Soup to Nuts at JavaOne 2014
Java EE 7 Soup to Nuts at JavaOne 2014
 
Weblogic Server
Weblogic ServerWeblogic Server
Weblogic Server
 
OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6OTN Developer Days - Java EE 6
OTN Developer Days - Java EE 6
 
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisationMySQL Webinar 2/4 Performance tuning, hardware, optimisation
MySQL Webinar 2/4 Performance tuning, hardware, optimisation
 
What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6What’s new in WSO2 Enterprise Integrator 6.6
What’s new in WSO2 Enterprise Integrator 6.6
 
Experiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the DatabaseExperiences with Evangelizing Java Within the Database
Experiences with Evangelizing Java Within the Database
 
Playing in the Same Sandbox: MySQL and Oracle
Playing in the Same Sandbox:  MySQL and OraclePlaying in the Same Sandbox:  MySQL and Oracle
Playing in the Same Sandbox: MySQL and Oracle
 
Hacking oracle using metasploit
Hacking oracle using metasploitHacking oracle using metasploit
Hacking oracle using metasploit
 

More from Marco Gralike

UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptxUKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptxMarco Gralike
 
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management CloudeProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management CloudMarco Gralike
 
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseeProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseMarco Gralike
 
Oracle Database - JSON and the In-Memory Database
Oracle Database - JSON and the In-Memory DatabaseOracle Database - JSON and the In-Memory Database
Oracle Database - JSON and the In-Memory DatabaseMarco Gralike
 
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database APIUKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database APIMarco Gralike
 
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...Marco Gralike
 
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseUKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseMarco Gralike
 
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesUKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesMarco Gralike
 
Ordina Oracle Open World
Ordina Oracle Open WorldOrdina Oracle Open World
Ordina Oracle Open WorldMarco Gralike
 
Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Marco Gralike
 
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3Marco Gralike
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)Marco Gralike
 
Flexibiliteit & Snel Schakelen
Flexibiliteit & Snel SchakelenFlexibiliteit & Snel Schakelen
Flexibiliteit & Snel SchakelenMarco Gralike
 
Hotsos 2013 - Creating Structure in Unstructured Data
Hotsos 2013 - Creating Structure in Unstructured DataHotsos 2013 - Creating Structure in Unstructured Data
Hotsos 2013 - Creating Structure in Unstructured DataMarco Gralike
 
BGOUG 2012 - XML Index Strategies
BGOUG 2012 - XML Index StrategiesBGOUG 2012 - XML Index Strategies
BGOUG 2012 - XML Index StrategiesMarco Gralike
 
ODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XMLODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XMLMarco Gralike
 
Miracle Open World 2011 - XML Index Strategies
Miracle Open World 2011  -  XML Index StrategiesMiracle Open World 2011  -  XML Index Strategies
Miracle Open World 2011 - XML Index StrategiesMarco Gralike
 
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...Marco Gralike
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1Marco Gralike
 

More from Marco Gralike (20)

UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptxUKOUG2018 - I Know what you did Last Summer [in my Database].pptx
UKOUG2018 - I Know what you did Last Summer [in my Database].pptx
 
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management CloudeProseed Oracle Open World 2016 debrief - Oracle Management Cloud
eProseed Oracle Open World 2016 debrief - Oracle Management Cloud
 
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 DatabaseeProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
eProseed Oracle Open World 2016 debrief - Oracle 12.2.0.1 Database
 
Oracle Database - JSON and the In-Memory Database
Oracle Database - JSON and the In-Memory DatabaseOracle Database - JSON and the In-Memory Database
Oracle Database - JSON and the In-Memory Database
 
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database APIUKOUG Tech15 - Going Full Circle - Building a native JSON Database API
UKOUG Tech15 - Going Full Circle - Building a native JSON Database API
 
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...OakTable World 2015  - Using XMLType content with the Oracle In-Memory Column...
OakTable World 2015 - Using XMLType content with the Oracle In-Memory Column...
 
UKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the DatabaseUKOUG Tech14 - Getting Started With JSON in the Database
UKOUG Tech14 - Getting Started With JSON in the Database
 
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex DatatypesUKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
UKOUG Tech14 - Using Database In-Memory Column Store with Complex Datatypes
 
Ordina Oracle Open World
Ordina Oracle Open WorldOrdina Oracle Open World
Ordina Oracle Open World
 
Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2Starting with JSON Path Expressions in Oracle 12.1.0.2
Starting with JSON Path Expressions in Oracle 12.1.0.2
 
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
An introduction into Oracle Enterprise Manager Cloud Control 12c Release 3
 
An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)An AMIS Overview of Oracle database 12c (12.1)
An AMIS Overview of Oracle database 12c (12.1)
 
Flexibiliteit & Snel Schakelen
Flexibiliteit & Snel SchakelenFlexibiliteit & Snel Schakelen
Flexibiliteit & Snel Schakelen
 
Hotsos 2013 - Creating Structure in Unstructured Data
Hotsos 2013 - Creating Structure in Unstructured DataHotsos 2013 - Creating Structure in Unstructured Data
Hotsos 2013 - Creating Structure in Unstructured Data
 
BGOUG 2012 - XML Index Strategies
BGOUG 2012 - XML Index StrategiesBGOUG 2012 - XML Index Strategies
BGOUG 2012 - XML Index Strategies
 
ODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XMLODTUG Webcast - Thinking Clearly about XML
ODTUG Webcast - Thinking Clearly about XML
 
Miracle Open World 2011 - XML Index Strategies
Miracle Open World 2011  -  XML Index StrategiesMiracle Open World 2011  -  XML Index Strategies
Miracle Open World 2011 - XML Index Strategies
 
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
UKOUG 2010 (Birmingham) - XML Indexing strategies - Choosing the Right Index ...
 
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
OPP2010 (Brussels) - Programming with XML in PL/SQL - Part 1
 
Amis ACE
Amis ACEAmis ACE
Amis ACE
 

Recently uploaded

ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDELiveplex
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsSeth Reyes
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IES VE
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXTarek Kalaji
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Websitedgelyza
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfinfogdgmi
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...Aggregage
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsSafe Software
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdfPedro Manuel
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemAsko Soukka
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxGDSC PJATK
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaborationbruanjhuli
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfAijun Zhang
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPathCommunity
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024SkyPlanner
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostMatt Ray
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1DianaGray10
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfDaniel Santiago Silva Capera
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Brian Pichman
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationIES VE
 

Recently uploaded (20)

ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDEADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
ADOPTING WEB 3 FOR YOUR BUSINESS: A STEP-BY-STEP GUIDE
 
Computer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and HazardsComputer 10: Lesson 10 - Online Crimes and Hazards
Computer 10: Lesson 10 - Online Crimes and Hazards
 
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
IESVE Software for Florida Code Compliance Using ASHRAE 90.1-2019
 
VoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBXVoIP Service and Marketing using Odoo and Asterisk PBX
VoIP Service and Marketing using Odoo and Asterisk PBX
 
COMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a WebsiteCOMPUTER 10 Lesson 8 - Building a Website
COMPUTER 10 Lesson 8 - Building a Website
 
Videogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdfVideogame localization & technology_ how to enhance the power of translation.pdf
Videogame localization & technology_ how to enhance the power of translation.pdf
 
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
The Data Metaverse: Unpacking the Roles, Use Cases, and Tech Trends in Data a...
 
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration WorkflowsIgniting Next Level Productivity with AI-Infused Data Integration Workflows
Igniting Next Level Productivity with AI-Infused Data Integration Workflows
 
Nanopower In Semiconductor Industry.pdf
Nanopower  In Semiconductor Industry.pdfNanopower  In Semiconductor Industry.pdf
Nanopower In Semiconductor Industry.pdf
 
Bird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystemBird eye's view on Camunda open source ecosystem
Bird eye's view on Camunda open source ecosystem
 
Cybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptxCybersecurity Workshop #1.pptx
Cybersecurity Workshop #1.pptx
 
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online CollaborationCOMPUTER 10: Lesson 7 - File Storage and Online Collaboration
COMPUTER 10: Lesson 7 - File Storage and Online Collaboration
 
Machine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdfMachine Learning Model Validation (Aijun Zhang 2024).pdf
Machine Learning Model Validation (Aijun Zhang 2024).pdf
 
UiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation DevelopersUiPath Community: AI for UiPath Automation Developers
UiPath Community: AI for UiPath Automation Developers
 
Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024Salesforce Miami User Group Event - 1st Quarter 2024
Salesforce Miami User Group Event - 1st Quarter 2024
 
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCostKubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
KubeConEU24-Monitoring Kubernetes and Cloud Spend with OpenCost
 
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1UiPath Platform: The Backend Engine Powering Your Automation - Session 1
UiPath Platform: The Backend Engine Powering Your Automation - Session 1
 
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdfIaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
IaC & GitOps in a Nutshell - a FridayInANuthshell Episode.pdf
 
Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )Building Your Own AI Instance (TBLC AI )
Building Your Own AI Instance (TBLC AI )
 
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve DecarbonizationUsing IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
Using IESVE for Loads, Sizing and Heat Pump Modeling to Achieve Decarbonization
 

Ogh Ace Case, Part 1 and 2, Oracle Xml Database, Marco Gralike

  • 1. OGh Ace Case Oracle XML Database – Part 1 Marco Gralike – AMIS   1
  • 2. A shortlist…  Started as DBA with Oracle 7 on Windows NT 3.1 (1994)  Experienced with Oracle 6 / 7.x / 8.x / 9.x / 10.x and 11.1  Started with Oracle XMLDB in 2003 (Oracle 10.1.3)  Oracle 11g Beta tester for Oracle XMLDB  Dedicated XMLDB Blog (blog.gralike.com)  Active Oracle OTN XMLDB Forum Member  Oracle ACE Award for XMLDB Community Contributions   2
  • 3. Overview  What is Oracle XML Database  The Protocol Server  Configuration and Basic Concepts  HTTP API’s  PL/SQL Gateways, ORADB, NDWS  URITypes in the Database  DBUri-, HTTPUri- and XDBUriTypes  Combining Worlds  Selecting and Saving of Files Outside the Database  Repository Events   3
  • 4. Storing XML in Oracle XML Database  File Storage  XML Database Oracle XML DB  Native  A World within a World  XML Enabled  Complies to Standards  License Free  Core part of (OXJR)DBMS  The (relational) foundation is there and can be used for solving XML “imperfections”   4
  • 5. Oracle XML Milestones / Importance 11gR1 XDB 10gR2 10gR1 9.2.0.3.0 XDK 9i 8iR1 XMLType Performance XQuery Binary XML SQL/XML Robustness XMLIndex, NDWS   5
  • 6. XMLType  XML data exchange  SQL, C, C++, Java, PL/SQL, .Net, etc  Via Protocol Listener supported methods  Via Oracle Advanced Queuing methods (Oracle 11gR1)  XML data storage  CLOB, Object Relational, Binary XML (11gR1)  XML data validation  XMLSchema, Programmatically, via Storage definitions  XML data creation  XML Operators, Packages   6
  • 7. The Protocol Server   7
  • 8. XMLType storage and more Out-of-the-Box Interfacing Logical Design Level Security, Management, Versioning Physical Design Level   8
  • 9. Protocol Server - Detail * Listener listener.ora or database parameters * Shared Server * Protocol “Adapter” xdbconfig.xml xdb.xdb$config   9
  • 10. Configuration of XDBCONFIG.xml file  PL/SQL Control  DBMS_XDB.GetHttpPort(), DBMS_XDB.GetFTPPort()  DBMS_XDB.SetHttpPort(), DBMS_XDB.SetFTPPort()  WebDAV  XMLSpy  JDeveloper  Drag & Drop  Notepad  MS Word   10
  • 11. Protocol Server Access WebDAV FTP HTTP(s)   11
  • 12. Enable Protocol Server Functionality demo01.sql   12
  • 13. HTTP API‟s   13
  • 14. Protocol Server HTTP API‟s  Your Own…  Java Servlets, PL/SQL Gateway  PL/SQL Gateways  APEX (/apex/*) PL/SQL  “Servlets”  Native Database WebService (/orawsv/*) C  ReportFmwkServlet (/orarep/*) C  TestServlet (/Test) Java  DBURI (/oradb/*) C   14
  • 15. Native Database Web Services (NDWS) WSDL Structure Architecture   15
  • 16. Native Database WebService (NDWS) 1. Enable the Protocol Server for HTTP access 2. Enable the orawsv entry point in xdbconfig.xml 3. Create a user and grant access  DBMS_NETWORK_ACL_ADMIN  XDB_WEBSERVICES  XDB_WEBSERVICES_OVER_HTTP  XDB_WEBSERVICES_WITH_PUBLIC 4. Create your procedure  For instance a procedure called OBJECTTYPES 5. Test (demo02.sql)  http://localhost:8080/orawsv/SCOTT/OBJECTTYPES?wsdl   16
  • 17. DBURI Servlet  Access Any Table or View From a Browser  DBUriType  Security is handled via DB roles  Transformation via XSL  Query options via XPath Expressions http://localhost:8080/public/demo03/   17
  • 18. URIType„s in the Database   18
  • 19. URITypes  DBUriType  Represents an URI that targets database data  HTTPUriType  Represents an URL that starts with http://  Uses UTL_HTTP  XDBUriType  Represents an URI that targets a resource in the Repository   19
  • 20. HTTPUriType - Google API SQL> SELECT extractvalue(value(t),'/Hostip/gml:name' 2 , 'xmlns:gml=quot;http://www.opengis.net/gmlquot; 3 xmlns=quot;http://www.hostip.info/apiquot;') AS quot;Namequot; 4 , extractvalue(value(t),'/Hostip/countryName' 5 , 'xmlns:gml=quot;http://www.opengis.net/gmlquot; 6 xmlns=quot;http://www.hostip.info/apiquot;') AS quot;CNamequot; 7 , extractvalue(value(t),'/Hostip/countryAbbrev' 8 , 'xmlns:gml=quot;http://www.opengis.net/gmlquot; 9 xmlns=quot;http://www.hostip.info/apiquot;') AS quot;CAbbrevquot; 10 , extractvalue(value(t) ,'/Hostip/ipLocation/gml:PointProperty/gml:Point/gml:coordinates' 11 , 'xmlns:gml=quot;http://www.opengis.net/gmlquot; 12 xmlns=quot;http://www.hostip.info/apiquot;') AS quot;Coord.quot; 13 FROM TABLE (XMLSEQUENCE (EXTRACT (HTTPURITYPE ('http://api.hostip.info/?ip=141.146.8.66').getxml () 14 , '/HostipLookupResultSet/gml:featureMember/Hostip' 15 , 'xmlns:gml=quot;http://www.opengis.net/gmlquot; 16 xmlns=quot;http://www.hostip.info/apiquot;' ))) t; Name CName CAbbrev Coordinates -------------------- -------------------- -------------------- -------------------- Redwood City, CA UNITED STATES US -122.206,37.5164   20
  • 21. HTTPUriType – Accessing RSS Feeds SQL> SELECT * 2 FROM XMLTABLE (XMLNAMESPACES('http://purl.org/dc/elements/1.1/' AS quot;MGRquot;) 3 ,'//item' 4 passing HTTPURITYPE('http://my.blog.com/blog/?feed=rss2').getXML() 5 columns title varchar2(50) path '/item/title/text()', 6 link varchar2(50) path '/item/link/text()', 7 publication_date varchar2(50) path '/item/pubDate/text()', 8 creator varchar2(50) path '/item/MGR:creator/text()', 9 description varchar2(250) path '/item/description/text()', 10 category XMLTYPE path '/item/category/text()');   21
  • 22. XML/SQL Output TITLE LINK PUBLICATION_DATE CREATOR ----------------------------------------------------------------- DESCRIPTION CATEGORY ----------------------------------------------------------------- Quering RSS Feeds The XMLDB Way http://feeds.feedburner.com/~r/Bloggralikecom/~3/3 Wed, 25 Jun 2008 16:47:19 +0000 Marco Gralike Actually this IS old stuff (2006), but it got lost IN a… < ![CDATA[11g]]>< ![CDATA[Howto]]> demo04.sql   22
  • 23. XDBUriType  Useful for accessing resources in the XML DB Repository  Resources = files and folders  Helpful during XML Schema and XML Document registration  Helpful while insert XML document content from the XML DB Repository into XMLType Tables, Columns or Views   23
  • 24. Combining Worlds   24
  • 25. Combining BFileName with XML  The bfilename function returns a BFILE locator for a physical LOB binary file  Syntax: bfilename( 'directory', 'filename' )  Often used for inserting huge XML documents into the database  But you can do more…   25
  • 26. Selecting XML Data outside the Database SQL> SELECT extract((XMLTYPE(bfilename('XMLSTORE','data.xml'),NLS_CHARSET_ID('AL32UTF8'))),'*') AS quot;XDATAquot; 2 FROM dual; XDATA ------------------------------------------------------- <root> <id>0</id><info><info_id>0</info_id> <info_content>Text</info_content></info> </root> demo06.sql SQL> SELECT xdata 2 FROM (XMLTABLE('*' 3 PASSING (XMLTYPE(bfilename('XMLSTORE','data.xml'),NLS_CHARSET_ID('AL32UTF8'))) 4 COLUMNS xdata xmltype PATH '/*' 5 ) 6 ); XDATA ------------------------------------------------------------------------------------- <root> <id>0</id><info><info_id>0</info_id><info_content>Text</info_content></info></root>   26
  • 27. Using dbms_xmldom or dbms_xslprocessor  Ways to write to disk  dbms_xslprocessor.clob2file  dbms_xmldom.writetofile  Syntax: bfilename( 'directory', 'filename' )  Often used for inserting huge XML documents into the database  But you can do more…   27
  • 28. Saving XML Data outside the Database SQL> declare 2 rc sys_refcursor; 3 BEGIN 4 open rc FOR SELECT * FROM ( SELECT rownum FROM dual connect BY level < 100 ); 5 dbms_xslprocessor.clob2file( xmltype( rc ).getclobval( ) , ‘STORE’,'anton.xml’); 6 END; 7/ SQL> declare 2 rc sys_refcursor; 3 doc DBMS_XMLDOM.DOMDocument; 4 begin 5 open rc for select * from ( select rownum from dual connect by level < 100 ); 6 doc := DBMS_XMLDOM.NewDOMDocument(xmltype( rc )); 7 DBMS_XMLDOM.WRITETOFILE(doc, ‘STORE/marco.xml’); 8 end; 9 / demo07.sql   28
  • 29. Repository Events   29
  • 30. Repository Events  Repository Events are events which get triggered via defined methods on the Repository For Example:  creating, deleting, locking, unlocking, placing under version control, checking in, checking out, unchecking out, opening, and/or updating  Repository Events <> Database Triggers  Are specially designed to act on Repository actions  Repository operation can be associated with one or more repository events   30
  • 31. Repository Events  Event Listener  Java class or a PL/SQL package or an object type  A repository event listener can be configured for a particular resource or for the entire repository  It comprises a set of PL/SQL procedures or Java methods, each of which is called an event handler  Event Handler  Each event handler processes a single event  Resource Configuration File  Associates a repository event listener with a resource by mapping a resource configuration file to the resource (= folder or file)   31
  • 32. Repository Events demo08.sql   32
  • 33. End Part 1 marco.gralike@amis.nl http://www.amis.nl   33
  • 34. OGh Ace Case Oracle XML Database – Part 2 Marco Gralike – AMIS   34
  • 35. Disclaimer The following are “Rules of Numb” Every environment has its own unique criteria and needs… Pay attention to: “Maintainability” “Testing” “Choice” “Extendibility” “Performance” “Design”   35
  • 36. Overview  Storage of XML data in the Oracle database  Physical and Logical Design  The General “Issues” with XML  Performance !  An Customer Use Case   36
  • 37. Storage of XML data in the Database   37
  • 38. Storage, Logical & Physical Design ?   38
  • 39. The “XML Relational” Mindset CREATE TABLE MYTABLE xmltype); (data Here is your Design !   39
  • 40. “Hidden” Oracle Design Features CREATE TABLE “AMISquot;.“OBJECTquot; OF quot;SYSquot;.quot;XMLTYPEquot; XMLSCHEMA quot;http://www.myserver.com/myapp/1.0/xsd/object.xsdquot; ELEMENT “ROOTquot; ID 4733 PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536Schema: your container for XML NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 Design Logical and Physical BUFFER_POOL DEFAULT) TABLESPACE quot;USERS“ VARRAY quot;XMLEXTRAquot;.quot;NAMESPACESquot; STORE AS BASICFILE LOB quot;NAMESPACES660_Lquot; (ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 CACHE STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT)) VARRAY quot;XMLEXTRAquot;.quot;EXTRADATAquot; STORE AS BASICFILE LOB quot;EXTRADATA659_Lquot; (ENABLE STORAGE IN ROW CHUNK 8192 PCTVERSION 10 CACHE STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS Physical Design 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT))   40
  • 41. Designing Your Building Blocks  Logical Design  XML Instance / Document  XML Schema (XDB Annotations)  XML Evolution, Validation  Physical Design  Oracle Database / Storage Design based on XML Logical Design  Binary Storage (Encrypted, Compressed, Validation, Evolution?)  XML Schema (XDB Annotations)  Indexes (BTree, IOT, XMLIndex, Function Based, Text) Is your XML data CONTENT or DOCUMENT driven ? Think: Access Paths, The Optimizer, Performance   41
  • 42. Control your design: XML Schemata  Logical, Physical Data Design  Maintained via the Repository  Storage, Evolution, Security  Storage can be a Black Box (without schemata)  CLOB  Binary XML (ALLOW NONSCHEMA)  Namespaces (Recursiveness ?!)  Overhead due to Parsing  XDB Annotations can define:  Storage, Control, Name   42
  • 43. When to use what kind of Storage Document centric XML  CLOB XML Document No shredding, document “keeps intact” Content centric XML  Object Relational Shredding, rebuilding document info XML Document part   43
  • 44. Oracle XML DB Data Storage   44
  • 45. Choices…  XMLType CLOB  Document Driven  Only in 11gR1 and upwards  XMLIndex  XMLType OR  10gRx  Index Organized Tables  11gR1 and upwards  BTree indexes XML Schema “overhead”, Data is “shredded”   Query Re-write  XMLType Binary XML  XMLType OR features kind off behavior PLUS  Post Parse Presentation   45
  • 46. Physical & Logical Design   46
  • 47. XDB Annotations Hybrid: CLOB within OR (Binary XML incompatible)   47
  • 48. Mixing Logical and Physical Design   48
  • 49. xdb:annotations – XML Schema Declaration  xdb:storeVarrayAsTable (“false” < 11g >= “true”)  If true, the varray is stored as a table (OCT)  If false, the varray is stored in a LOB  xdb:mapUnboundedStringToLob (default=“false”)  If true, then unbounded strings are mapped to CLOB instances by default. Similarly, unbounded binary data gets mapped to a BLOB value, by default.  If false, then unbounded strings are mapped to VARCHAR2(4000) values, and unbounded binary components are mapped to RAW(2000) values. Don’t forget: xmlns:xdb=quot;http://xmlns.oracle.com/xdbquot;   49
  • 50. xdb:annotations – Global ComplexTypes  xdb:maintainDOM (default=“true”)  If false, then the output is not guaranteed to have the same DOM action as the input.  xdb:SQLSchema  Name of the database user who owns the type specified by SQLType  xdb:SQLType  Name of the SQL type that corresponds to this XML element declaration  Any SQL data type except NCHAR, NVARCHAR, and NCLOB   50
  • 51. Some xdb:annotations – Elements (SimpleTypes)  xdb:defaultTable  xdb:defaultTableSchema  xdb:maintainDOM  xdb:maintainOrder  xdb:SQLInline  xdb:columnProps  xdb:tableProps   51
  • 52. Generate or Manual Creation  Manual Creation  DBMS_METADATA.GET_DDL  EVENT setting • [alter session set events='31098 trace name context forever'; ]  Use Oracle 11g generation to apply in 10gR2 (IOT <> BTREE)  Generate via DBMS_XMLSCHEMA  XML Schema Based  XDB Annotations  JDeveloper or XMLSpy   52
  • 53. Creating Storage Structures (OR) SQL> BEGIN DBMS_XMLSCHEMA.registerSchema (SCHEMAURL => 'http://www.myserver.com/root.xsd', SCHEMADOC => xdbURIType('/public/root.xsd').getClob(), LOCAL => TRUE, -- local GENTYPES => TRUE, -- generate object types GENBEAN => FALSE, -- no java beans GENTABLES => TRUE, -- generate object tables OWNER => USER); END; /   53
  • 54. Result Object Relational Storage SQL> select * from tab; TNAME TABTYPE ------------------------------ ------- INFO_TABLE TABLE ROOT_TABLE TABLE SQL> select dbms_metadata.get_ddl('TABLE','ROOT_TABLE') from dual; DBMS_METADATA.GET_DDL('TABLE','ROOT_TABLE') ------------------------------------------------------ CREATE TABLE “AMISquot;.quot;ROOT_TABLEquot; OF quot;SYSquot;.quot;XMLTYPEquot; XMLSCHEMA quot;http://www.myserver.com/root.xsdquot; ELEMENT quot;ROOTquot; PCTFREE 10 PCTUSED 40 INITRANS 1 MAXTRANS 255 NOCOMPRESS LOGGING STORAGE(INITIAL 65536 NEXT 1048576 MINEXTENTS 1 MAXEXTENTS 2147483645 PCTINCREASE 0 FREELISTS 1 FREELIST GROUPS 1 BUFFER_POOL DEFAULT) TABLESPACE quot;USERSquot; VARRAY quot;XMLEXTRAquot;.quot;NAMESPACESquot; STORE AS BASICFILE LOB quot;NAMESPACES780_Lquot; ... VARRAY quot;XMLDATAquot;.quot;INFOquot;.quot;SYS_XDBPD$quot; STORE AS BASICFILE LOB quot;SYS_XDBP...quot; DISALLOW NONSCHEMA ...   54
  • 55. XMLType CLOB Storage (simplistic) SQL> create table XMLCLOB of XMLType XMLTYPE store as CLOB; Table created.   55
  • 56. XMLType Object Relational Storage (simplistic) SQL> create table XMLOR of XMLType XMLTYPE store as OBJECT RELATIONAL XMLSCHEMA quot;http://www.amis.nl/xsd/root.xsdquot; ELEMENT quot;RootElementquot;; Table created.   56
  • 57. XMLType Binary XML Storage (simplistic) SQL> create table XMLBIN of XMLType XMLTYPE store as BINARY XML; Table created. SQL> create table XMLBIN_XSD of XMLType XMLTYPE store as BINARY XML XMLSCHEMA quot;http://www.amis.nl/xsd/root.xsdquot; ELEMENT quot;RootElementquot;; Table created.   57
  • 58. The general “issues” with XML   58
  • 59. Lets presume it is Relational   59
  • 60. Structured Relational Data   60
  • 61. Relational Fundamentals  What goes IN, must come OUT (IN=OUT)  Regarding Data Integrity, Meaning and Context  Why do we DESIGN in the First Place?  ACID: Atomicity, Consistency, Isolation, Durability Edgar F Codd’s 12 Rules defining a “Relational Database”   Database Normalization (eg. 3NF)  Nullology  Imperfections of the (Procedural / Query) Language  Maintainability, Performance, Usability  Decades of Innovation, Methods and Standards   61
  • 62. Query Optimizer – Optimal Access Paths   62
  • 63. Structured Data Unstructured (XML) Data   63
  • 64. Optimal Access Paths for a Tree ? Keep it intact? To much empty space! Access Optimization? Should we shred it? Rebuilding and shredding the tree structure…? There is no solution for   64
  • 65. Relational contra XML Data ONE…yes ONE XML document can contain a whole database, schema of objects !   65
  • 66. Impedance Mismatch  Different data models.  E.g. XPath, XQuery models an XML document as a tree, while most general purpose programming languages have no native data types for a tree.  Different programming paradigms.  XSLT is a functional language, while Java is object- oriented, and Perl is a procedural one. Source: Wikipedia SXML   66
  • 67. So in General  NO PROBLEM  Data Shipping / Transport XML via XML  UI’s that “Understand”, are based on XML  PROBLEM  Accessing Data in XML structures • CPU Intensive • Memory Intensive  PGA, XML Fragments, Document Object Model  Transformation: • XML  Relational (Risk: Data / Information Loss) • Document Object Model   67
  • 68. Issues you will encounter with XML  The nature of XML:  It is (most of the time) not Structured  It can not be stored in a Universal XML “Container”  It can not be accessed via a standard Access Path Method that “understands” the free format XML structure all the time…  It is all about free format  OK and Not OK  Standards: W3C, Oasis, etc  Performance problem induced by its Nature…  Nature is not structured…(as is Human Nature)   68
  • 69. Nope…!  XML can handle (package) structured and semi- structured data and sometimes even unstructured data.  The open standard for data exchange  If it is XML, use XML !  Oracle XML Database = Continues Innovation “There is essentially no computer in the world, desktop, handheld, or backroom, that doesn't process XML sometimes...”   69
  • 70. Performance !   70
  • 71. Performance  Do it faster  for example  via indexes  Do it smarter  for example  less data  partitioning   71
  • 72. XMLType Storage (Object Relational) Edith.sql   72
  • 73. Recap… XMLDB Relational XMLDB Data Storage World World XMLType XMLType v? Views (Tables) Structured Binary XML Hybrid Unstructured (Object) Document Content Mixed? Content Relational na complex[n] complex[y] complex[n] Objects CLOB OR BINARY OR/CLOB XSD [y] XSD [y] XSD [y/n] XSD [y] Relational XMLIndex BTree, IOT XMLIndex BTree, IOT Tables   73
  • 74. Some XML Storage Issues O.R. CLOB Binary XML Schema Based + - + XSD Flexibility - (in xml) ++ DML ++ - + XPath Performance ++ - + Throughput - + ++ Memory Management ++ - + XMLIndex - + + Function / Text + + + BTree (/ IOT) + - -   74
  • 75. Indexation of Data  BTree Indexes  (11g Schema based)  Cluster Indexes  Bitmap Indexes   Index Organized Table  (10g Schema Indexes based)  Function Based Indexes   Partition Indexes  >= V 11.1.0.7.0  Domain Indexes  Oracle Text Context Index   Unstructured XMLIndex    75
  • 76. XML Objects (XOBs)  DOM String Char bookstore Varchar String 2(20) book whitepaper title author author chapter title author id paragraph Number Float content content CLOB   76
  • 77. Query Re-Write BTre BTre BTre ee e Index Index Index bookstore Function based Index (XPath) book whitepaper title author author chapter title author id paragraph XMLIndex content content Oracle Text Index   77
  • 78. A Customer Use Case   78
  • 79. ETL in Memory Processing Memor y / DOM Oracle BLOB CLOB XMLType Advanced Queue Validation Process Shred Elements Store in Oracle XML Schema Checks Via XMLDOM ETL Tables Workflow (JAVA)   79
  • 80. ETL - XMLType Table (OR) Processing Oracle BLOB CLOB Advanced Queue Validation XMLType Table Store in Oracle Against Checks (O.R) ETL Tables Workflow XML Schema Rewrite on Disk / XOB (Relational)   80
  • 81. Results XML Relational Approach  100.000 “zaken” shredded, validated in 5 minutes (instead of 1000 “zaken” in 3 minutes)  Avoiding  ORA-31186: Document contains too many nodes  Scalable  Efficient with Memory and CPU  Checked on 9.2.0.5 database version   81
  • 82. References  Oracle 11g XMLDB Developers Guide  The XMLDB Forum  http://forums.oracle.com/forums/forum.jspa?forumID=34  OTN XML DB FAQ Thread  http://forums.oracle.com/forums/thread.jspa?threadID=410714  Technology Blogs  http://blog.gralike.com  http://technology.amis.nl/blog  Thanks to:  Mark Drake, Tom Kyte  Keith Matthew, Anton Scheffer, Laurent Schneider   82
  • 83. marco.gralike@amis.nl http://www.amis.nl   83