Load XML file into oracle database

Hi
i have a xml file and the XSD(Schema definition file for XML). i need to load the xml file into the database.
Can you please tell me the best approach for this ?

There are plenty of examples of this on the XML DB Forum.
Here is a link to the FAQ for that forum...
XML DB FAQ

Similar Messages

  • Performance problems loading an XML file into oracle database

    Hello ODI Guru's,
    I am trying to load and XML file into the database after doing simple business validations. But the interface takes hours to complete.
    1. The XML files are large in size >200 Mb. We have an XSD file for the schema definition instead of a DTD.
    2. We used the external database feature for loading these files in database.
    The following configuration was used in the XML Data Server:
    jdbc:snps:xml?f=D:\CustomerMasterData1\CustomerMasterInitialLoad1.xml&d=D:\CustomerMasterData1\CustomerMasterInitialLoad1.xsd&re=initialLoad&s=CM&db_props=oracle&ro=true
    3. Now we reverse engineer the XML files and created models using ODI Designer
    4. Similar thing was done for the target i.e. an Oracle database table as well.
    5. Next we created a simple interface with one-to-one mapping from the XSD schema to the Oracle database table and executed the interface. This execution takes more than one hour to complete.
    6. We are running ODI client on Windows XP Professional SP2.
    7. The Oracle database server(Oracle 10g 10.2.0.3) for the target schema as well as the ODI master and work repositories are on the same machine.
    8. I tried changing the following properties but it is not making much visible difference:
    use_prepared_statements=Y
    use_batch_update=Y
    batch_update_size=510
    commit_periodically=Y
    num_inserts_before_commit=30000
    I have another problem that when I set batch_update_size to value greater that 510 I get the following error:
    java.sql.SQLException: class org.xml.sax.SAXException
    class java.lang.ArrayIndexOutOfBoundsException said -32413
    at com.sunopsis.jdbc.driver.xml.v.a(v.java)
    The main concern is why should the interface taking so long to execute.
    Please send suggestions to resolve the problem.
    Thanks in advance,
    Best Regards,
    Nikunj

    Approximately how many rows are you trying to insert?
    One of the techniques which I found improved performance for this scenario was to extract from the xml to a flat file, then to use SQL*LOADER or external tables to load the data into Oracle.

  • Load XML file into oracle xml buffer

    Hi guys,
    I'm a starter in Oracle XML Development, I wander how I can load a xml file into oracle xml buffer(xmlctx* document) through programming with c++ in visual studio.
    When I use orastream structure, it compiled failed.
    Thank you very much!
    Edited by: pomelo on 2010-11-15 下午5:39

    try this
    LOAD DATA
    INFILE '/home/oraread/'
    INTO TABLE xmlloadtable
    (id,
    file_name          filler,
    data_xml          lobfile(file_name) terminated by eof
    )you can add the file_name field as a column to your table between the id and xml column and remove the filler word in the .ldr file if you need to keep the name of the file

  • Error While Loading XMl Doc into Oracle Database 10g

    Hi all,
    I have a task that , I have to make a utillity by which we can load XML Doc into a Table. While searching on Internet i found following Procedure on ASK Tom
    CREATE OR REPLACE
    procedure insert_xml_emps(
    p_directory in varchar2, p_filename in varchar2, vtableName in varchar2 )
    as
    v_filelocator bfile;
    v_cloblocator clob;
    l_ctx dbms_xmlsave.ctxType;
    l_rows number;
    begin
    dbms_lob.createtemporary(v_cloblocator,true);
    v_filelocator := bfilename(p_directory, p_filename);
    dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
    DBMS_LOB.LOADFROMFILE(v_cloblocator, v_filelocator,
    dbms_lob.getlength(v_filelocator));
    l_ctx := dbms_xmlsave.newContext(vTableName);
    l_rows := dbms_xmlsave.insertxml(l_ctx,v_cloblocator);
    dbms_xmlsave.closeContext(l_ctx);
    dbms_output.put_line(l_rows || ' rows inserted...');
    dbms_lob.close(v_filelocator);
    DBMS_LOB.FREETEMPORARY(v_cloblocator);
    end ;
    when i try to run this procedure
    BEGIN
    insert_xml_emps('XML_LOAD','load.xml','IBSCOLYTD');
    END;
    it gaves me following Error
    ORA-29532: java call terminated by uncaught java exception : Oracle.xml.sql.OracleXMLSQLException:No
    rows to modify-- the row enclosing tag missing. Specify the correct row enclosing tag.
    ORA-06512: at "SYS.DBMS_XMLSAVE", line 115
    ORA-06512: at "EXT_TEST.INSERT_XML_EMPS", line 18
    ORA-06512: at line 2
    Can anyone describe me this error
    Thanks.
    Best Regards.

    SQL> /* Creating Your table */
    SQL> CREATE TABLE IBSCOLYTD
      2  (
      3  ACTNOI VARCHAR2 (8),
      4  MEMONOI NUMBER (7,0),
      5  MEMODTEI DATE,
      6  AMOUNTI NUMBER (8,0),
      7  BRCDSI NUMBER (4,0),
      8  TYPEI NUMBER (4,0),
      9  TRANSMONI NUMBER (6,0)
    10  );
    Table created.
    SQL> CREATE OR REPLACE PROCEDURE insert_xml_emps(p_directory in varchar2,
      2                                              p_filename  in varchar2,
      3                                              vtableName  in varchar2) as
      4    v_filelocator    BFILE;
      5    v_cloblocator    CLOB;
      6    l_ctx            DBMS_XMLSTORE.CTXTYPE;
      7    l_rows           NUMBER;
      8    v_amount_to_load NUMBER;
      9    dest_offset      NUMBER := 1;
    10    src_offset       NUMBER := 1;
    11    lang_context     NUMBER := DBMS_LOB.DEFAULT_LANG_CTX;
    12    warning          NUMBER;
    13  BEGIN
    14    dbms_lob.createtemporary(v_cloblocator, true);
    15    v_filelocator := bfilename(p_directory, p_filename);
    16    dbms_lob.open(v_filelocator, dbms_lob.file_readonly);
    17    v_amount_to_load := DBMS_LOB.getlength(v_filelocator);
    18    ---  ***This line is changed*** ---
    19    DBMS_LOB.LOADCLOBFROMFILE(v_cloblocator,
    20                              v_filelocator,
    21                              v_amount_to_load,
    22                              dest_offset,
    23                              src_offset,
    24                              0,
    25                              lang_context,
    26                              warning);
    27 
    28    l_ctx := DBMS_XMLSTORE.newContext(vTableName);
    29    DBMS_XMLSTORE.setRowTag(l_ctx, 'ROWSET');
    30    DBMS_XMLSTORE.setRowTag(l_ctx, 'IBSCOLYTD');
    31    -- clear the update settings
    32    DBMS_XMLStore.clearUpdateColumnList(l_ctx);
    33    -- set the columns to be updated as a list of values
    34    DBMS_XMLStore.setUpdateColumn(l_ctx, 'ACTNOI');
    35    DBMS_XMLStore.setUpdateColumn(l_ctx, 'MEMONOI');
    36    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'MEMODTEI');
    37    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'AMOUNTI');
    38    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'BRCDSI');
    39    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TYPEI');
    40    DBMS_XMLStore.setUpdatecolumn(l_ctx, 'TRANSMONI');
    41    -- Now insert the doc.
    42    l_rows := DBMS_XMLSTORE.insertxml(l_ctx, v_cloblocator);
    43    DBMS_XMLSTORE.closeContext(l_ctx);
    44    dbms_output.put_line(l_rows || ' rows inserted...');
    45    dbms_lob.close(v_filelocator);
    46    DBMS_LOB.FREETEMPORARY(v_cloblocator);
    47  END;
    48  /
    Procedure created.
    SQL> BEGIN
      2  insert_xml_emps('TEST_DIR','load.xml','IBSCOLYTD');
      3  END;
      4  /
    PL/SQL procedure successfully completed.
    SQL> SELECT * FROM ibscolytd;
    ACTNOI      MEMONOI MEMODTEI     AMOUNTI     BRCDSI      TYPEI  TRANSMONI
    28004125     251942 05-SEP-92        400        513          1          0
    28004125     251943 04-OCT-92        400        513          1          0
    SQL>

  • Loading XML File into Oracle 10G XE

    I am trying to load an XML file into 10G XE from the Utilities interface, I have created a Table to load into but when I try to load I get the following cryptic error "XML Load Error". There is no other information, can someone give me some insight where to start to resolve this problem?

    The error messages when importing fails provided by APEX 2.1 are not very useful as they do not provide any clue...
    If possible, you can try to load XML file with SQL*Loader - probably you will get then more useful error messages.

  • Issue with Date Conversion when loading XML File into Oracle 10g Database

    Hello all,
    I have the interface shown in the screenshot below. In it, amongst other actions, I'm mapping an XML file element representing a date to an Oracle table column defined as DATE. The source and target columns are highlighted in the screenshot.
    !http://img223.imageshack.us/img223/1565/odiscr275.jpg!
    When I execute the interface, I get the following error message:
    java.lang.IllegalArgumentException at java.sql.Date.valueOf(Date.java:103)
    I'm assuming this refers to the date conversion!
    I've already tried replacing SRC_TRADES.DEAL_DATE with TO_DATE( SRC_TRADES.DEAL_DATE, 'DD/MM/YYYY' ) in the Implementation tab. This function was not recognised when I executed the interface, so it didn't work! The date value in the XML file is in DD/MM/YYYY format.
    I'm guessing that Oracle SQL Date functions don't work in the Implementation tab. Please could somebody let me know:
    1. Which Date Conversion function I could use instead?
    2. Where I can find a reference for the methods/functions I can use in the Implementation tab (if such a reference exists)?
    Cheers.
    James

    Hi.
    Try to change the execution area to staging area. After You change it, write in the mapping box just SRC_TRADERS.DEAL_DATE. When You use TO_DATE, the source field typu should be varchar2, not date (as it is in your source datastore)

  • How to load XML files into oracle

    I am new to XML.I have a few XML files.I want to load them into oracle.I have oracle client on my win2000 machine version 8.1.6.3.
    I cannot find Loadjava.jar file in ORACLE_HOME\bin directory.
    Where is the XSU-dsl and the XDK utility?Do i need to down load it?

    This forum is dedicated to the XML Features of 9iR2, and to a lesser extent 9i. Questions related to XML and earlier versions of the database should be posted in Technologies -> General -> XML...
    I will move this thread to the appropriate forum if required.

  • How to load XML files into ORACLE8i database?

    SAP data is being extracted into XML format (via IDOC) files which are being transferred to an ORACLE8i box. There will be a large amount of data transferred on a daily basis which will include updates and inserts. From all the information that I have read on this subject there are 2 options available :
    1. XML-SQL Utility - which converts XML into INSERT, UPDATE or DELETE SQL. There does not appear to be that much functionality available by this method for decodes, transformations on the input data.
    2. SQL*Loader - There was a statement in 1 piece of documentation stating that SQL*Loader could be used for loading XML format data files. I cannot however find any further information on how this is achieved or how it works.
    If anyone has any experience in loading XML format data files using either of the above methods (preferably SQL*Loader as it has more functionality) then could you please provide me with examples or guidance on this matter? Any help would be greatly appreciated as I am not familiar with XML format data files. I am from an Oracle 7.3 background but do not have much experience with Oracle 8 onwards.
    Disclaimer.
    Any views expressed in the above paragraphs are my own and not that of Hewlett Packard Ltd.

    We are loading XML into our database using CLOB datatypes. We don't use the XSU for inserts as it is too slow. We parse the incoming XML document into a PL/SQL record type and then build a generic insert. This might not work well if you have many tags to parse into columns. We also store the entire XML CLOB into a column without parsing the individual tags into separate columns. We then use Intermedia Text for fast, index-based searching within the XML column.
    Check out The Oracle XML Portal website for code examples on how to do this:
    www.webspedite.com/oracle

  • How to load PDF files into oracle database and display them in APEX

    Hi All,
    We have a requirement for loading the Loading PDF files (lots of PDf files) to the oracle database and then display the PDF files in the Oracel APEX report.
    So that User can view the PDF files. Our current APEX verison is 3.2..
    Please let me know how to implement it and where to find the sample application!
    Thanks in advanced!
    Jane

    Thanks Tony for your quick response!
    We need to load a lot of PDfs (history + current).
    I have a questions about the SQL loader. I am trying to insert a pdf file into a table by following the oracle loading sample:
    http://download.oracle.com/docs/cd/B10501_01/text.920/a96518/aload.htm
    Example Data File: loader2.dat
    This file contains the data to be loaded into each row of the table, articles_formatted.
    Each line contains a comma separated list of the fields to be loaded in articles_formatted. The last field of every line names the file to be loaded in to the text column:
    Ben Kanobi, plaintext,Kawasaki news article,../sample_docs/kawasaki.txt,
    But i don't know to where should I put my pdf file on the server.
    for example:
    ,../sample_docs/kawasaki.txt,
    Where is the file 'kawasaki.txt'??
    I try my local path, it didn't work. like c:\temp.
    then I loaded teh PDf file into our server(/findev20/olmtest/orafin/11.5.7/olmtestcomn/temp) , and In my data file. I put the path
    1, pdf_emp1,../findev20/olmtest/orafin/11.5.7/olmtestcomn/temp
    but I got the error: the system can not find the file specified.
    Where should I put the PDf files on the server and how to specify the path in the data file?
    Thanks!
    Jane

  • Loading xml file into oracle table

    Please guide as to how can xml file be loaded into corresponding oracle table.

    check out this :
    http://blogs.oracle.com/warehousebuilder/2007/09/leveraging_xdb.html
    Cheers
    Nawneet

  • How to Load XML files into Oracle 8 database.

    My company is currently using Oracle Aplications V. 10.7 character mode and intend to migrate to V.11.0.3 in the next months.
    We want to import data (XML format) in the OE module using Open Interfaces.
    How to proceed ?

    This forum is dedicated to the XML Features of 9iR2, and to a lesser extent 9i. Questions related to XML and earlier versions of the database should be posted in Technologies -> General -> XML...
    I will move this thread to the appropriate forum if required.

  • Error while loading XML files into scott user

    Hi All,
    I'm new to xml files. I need to load xml files into database through OWB.
    I have xml file in my local machine & am trying to load into table PO of Scott. Scott is registered as repository user.
    Followed same steps as specified in userguide.
    But, when executing the procedure ( in two ways one as just table name, and other as user.table name) it is showing the below error:
    Procedure is:(1)--with username.tablename
    begin
    wb_xml_load(
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>&&SAMPLES_DIR.sample1.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target dateFormat="yyyy.MM.dd">scott.PO</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    end;
    ERROR at line 1:
    ORA-20006: Error occurred while truncating target database object SCOTT.PO.
    Base exception: ORA-01031: insufficient privileges
    ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
    ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
    ORA-06512: at "SCOTT.SAMPLE1", line 3
    ORA-06512: at line 1
    Procedure is:(2) with out username
    begin
    wb_xml_load(
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>&&SAMPLES_DIR.sample1.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target dateFormat="yyyy.MM.dd">PO</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    end;
    ERROR at line 1:
    ORA-20006: Error occurred while truncating target database object PO.
    Base exception: ORA-00942: table or view does not exist
    ORA-06512: at "OWBSYS.WB_XML_LOAD_F", line 12
    ORA-06512: at "OWBSYS.WB_XML_LOAD", line 4
    ORA-06512: at line 2
    xml file:
    <ROWSET>
    <ROW>
    <ID>100</ID>
    <ORDER_DATE>2000.12.20</ORDER_DATE>
    <SHIPTO_NAME>Adrian Howard</SHIPTO_NAME>
    <SHIPTO_STREET>500 Marine World Parkway</SHIPTO_STREET>
    <SHIPTO_CITY>Redwood City</SHIPTO_CITY>
    <SHIPTO_STATE>CA</SHIPTO_STATE>
    <SHIPTO_ZIP>94065</SHIPTO_ZIP>
    </ROW>     
    </ROWSET>
    Note: Everything works fine if I create PO table in OWBSYS user and execute the procedurein OWBSYS user. OWBSYS.PO table will be loaded.
    What privileges are missing, what shouldI do if I want to execute the procedure from scott user and load the table of scott.
    Thanks in advance for the help.
    Regards,
    Joshna

    Hi Joshna,
    Please follow below steps to load xml file to oracle database.
    1.First connect to owb (Design Center) through your repository owner user (ex : REP_OWNER).
    2. Import WB_XML_LOAD procedure . and exit to repository owner.
    3. connect to owb design center through your repository user (ex : REP_USER)
    Create New mapping and drag one Constant Operator and create one attribute, paste / edit following code
    '<OWBXMLRuntime>'||
    '<XMLSource>'||
    '<file>E:\SOURCE\emp.xml</file>'||
    '</XMLSource>'||
    '<targets>'||
    '<target truncateFirst = "FALSE" dateFormat="yyyy.MM.dd">rep_user.emp</target>'||
    '</targets>'||
    '</OWBXMLRuntime>'
    4. Drag pre mapping operator and select WB_XML_LOAD procedure
    5. Connect Constant Operator attribute to pre mapping operator.
    6. Drag two dummy tables and connect source to target. (ex : drag t1 (table) tab two times and connect.
    7. Validate and deploy the mapping.
    8. grant necessary grant command to rep_owner user to rep_user user.
    (Note : target truncateFirst = "FALSE" by default truncate the table. So you have to give grant privileges
    To rep_user , select ,insert, delete privileges.
    9. Execute the mapping , and check EMP table. (Note : before loading EMP table delete all records ).
    10 . If you want more description please go through the below link
    http://download.oracle.com/docs/html/A95931_01/apf.htm
    Regards
    Venkat

  • Loading XML files into an 8.0.6 database...

    Hi,
    I've got an Oracle 8.0.6 instance (Sun E250 Solaris 5.7) with multiple import data feeds. I am currently using SQL*Loader to load this data which are flat text delimited files. My data feeds will soon be supplying XML files instead of these flat files which is great, unfortunately, I will not be able to upgrade in 8.1.7 in time so that I can use the XML parser.
    Is there anyway I can use SQL*Loader or some other tool to load XML files into my 8.0.6 database? If there is a way, could someone please send the information I would need to help perform this task?
    Thanks for all your help...
    Gerry D'Costa
    Database Administrator
    [email protected]
    12Snap.com

    Check out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
    Ben

  • Loading XML files into Database table

    Loading XML files into Database table
    Hi I have some XML files say 100 files in a virtual directory created using &quot;Create or replace directory command&quot; and those files need to be loaded into a table having a column of XMLTYPE. 1)How to load that using Oracle provided procedures/packages

    Check out the Oracle XDB Developer's Guide, Chapter 3. There is an example of using BFileName function to load the xml files from a directory object created using create or replace directory. It works really well.
    Ben

  • Best method to load XML data into Oracle

    Hi,
    I have to load XML data into Oracle tables. I tried using different options and have run into a dead end in each of those. I do not have knowledge of java and hence have restricted myself to PL/SQL solutions. I tried the following options.
    1. Using DBMS_XMLSave package : Expects the ROWSET and ROW tags. Connot change format of the incoming XML file (Gives error oracle.xml.sql.OracleXMLSQLException: Start of root element expected).
    2. Using the XMLPARSER and XMLDOM PL/SQL APIs : Works fine for small files. Run into memory problems for large files (Gives error java.lang.OutOfMemoryError). Have tried increasing the JAVA_POOL_SIZE but does not work. I am not sure whether I am changing the correct parameter.
    I have read that the SAX API does not hog memory resources since it does not build the entire DOM tree structure. But the problem is that it does not have a PL/SQL implementation.
    Can anyone PLEASE guide me in the right direction, as to the best way to achieve this through PL/SQL ??? I have not designed the tables so am flexible on using purely relational or object-relational design. Although would prefer to keep a purely relational design. (Had tried used object-relational for 1. and purely relational for 2. above)
    The XML files are in the following format, (EXAMINEEs with single DEMOGRAPHIC and multiple TESTs)
    <?xml version="1.0"?>
    <Root_Element>
    <Examinee>
    <MACode>A</MACode>
    <TestingJID>TN</TestingJID>
    <ExamineeID>100001</ExamineeID>
    <CreateDate>20020221</CreateDate>
    <Demographic>
    <InfoDate>20020221</InfoDate>
    <FirstTime>1</FirstTime>
    <LastName>JANE</LastName>
    <FirstName>DOE</FirstName>
    <MiddleInitial>C</MiddleInitial>
    <LithoNumber>73</LithoNumber>
    <StreetAddress>SomeAddress</StreetAddress>
    <City>SomeCity</City>
    <StateCode>TN</StateCode>
    <ZipCode>37000</ZipCode>
    <PassStatus>1</PassStatus>
    </Demographic>
    <Test>
    <TestDate>20020221</TestDate>
    <TestNbr>1</TestNbr>
    <SrlNbr>13773784</SrlNbr>
    </Test>
    <Test>
    <TestDate>20020221</TestDate>
    <TestNbr>2</TestNbr>
    <SrlNbr>13773784</SrlNbr>
    </Test>
    </Examinee>
    </Root_Element>
    Thanks for the help.

    Please refer to the XSU(XML SQL Utility) or TransX Utility(for Multi-language Document) if you want to load data in XML format into database.
    Both of them require special XML formats, please first refer to the following docs:
    http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/xsu/xsu_userguide.html
    http://otn.oracle.com/docs/tech/xml/xdk_java/doc_library/Production9i/doc/java/transx/readme.html
    You can use XSLT to transform your document to the required format.
    If you document is large, you can use SAX method to insert data into database. But you need to write the code.
    The following sample may be useful:
    http://otn.oracle.com/tech/xml/xdk_sample/xdksample_040602i.html

Maybe you are looking for

  • Adding new modules to Selection-screen

    Hi everyone, I created 3 selection-screens for my report, but I needed to control better their jump between screens, so I added PAI modules on each screen. The thing is that when I make a change on one of the screens the calling of the module disapea

  • Full-Text Search is Enabled But It Is Not Working.

    I Have Already Installed SQL SERVER 2008 ANd Full Text Search Is Also Running I Check It Via Query It Is Also Return !. Now What i M DO?????

  • Webhelp v browser-based AIR Help

    Hi, I 'm going to be writing help for a web-based application for the first time and am trialing Robohelp 9. Can anyone tell me the difference between the published files for Webhelp and browser-based AIR help? Would there be any technical difference

  • How to customize flash cc tools pannel?

    Hi, I want to get rid off some tools that I never use in Flash CC. They are the ones about 3D. In some place, I read that there is a "Customize tools panel" in Flash main menu, close to "preferences", and so on. I sow it in other computers and other

  • Return Vector from function and print it out.

    Hey guys, I am not sure I'm doing this right. I have a class that currently has one function "getVector". This takes a string that is input and turns into a Vector array and returns the array as Vector. Then in the second class I simply want to print