8 Replies Latest reply on Dec 15, 2011 5:19 AM by alwu-Oracle

    ORA-06502 during bulk load

    655091
      I am using v11.2 with the new Jena adapter.

      I am trying to upload data from a bunch of ntriple files to the triple store via the bulk load interface in the Jena adaptor- aka. bulk append. The code does something like this

      while(moreFiles exist)
      {
      readFilesToMemory;

      bulkLoadToDatabase using the options "MBV_JOIN_HINT=USE_HASH PARALLEL=4"
      }


      Loading the first set of triples goes well. But when I try to load the second set of triples, I get the exception below.

      Some thoughts:
      1) I dont think this is data problem because I uploaded all the data during an earlier test + when I upload the same data on an empty database it works fine.
      2) I saw some earlier posts with similar error but none of the seem to be using the Jena adaptor..
      3) The model also has a OWL Prime entailment in incremental mode.
      4) I am not sure if this is relevant but... Before I ran the current test, I mistakenly launched multiple of java processes that bulk loaded the data. Ofcourse I killed all the processes and dropped the sem_models and the backing rdf tables they were uploading to.


      EXCEPTION
      java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
      ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 3164
      ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 4244
      ORA-06512: at "MDSYS.SDO_RDF", line 276
      ORA-06512: at "MDSYS.RDF_APIS", line 693
      ORA-06512: at line 1

      at oracle.jdbc.driver.SQLStateMapping.newSQLException(SQLStateMapping.java:70)
      at oracle.jdbc.driver.DatabaseError.newSQLException(DatabaseError.java:131)
      at oracle.jdbc.driver.DatabaseError.throwSqlException(DatabaseError.java:204)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:455)
      at oracle.jdbc.driver.T4CTTIoer.processError(T4CTTIoer.java:413)
      at oracle.jdbc.driver.T4C8Oall.receive(T4C8Oall.java:1034)
      at oracle.jdbc.driver.T4CCallableStatement.doOall8(T4CCallableStatement.java:191)
      at oracle.jdbc.driver.T4CCallableStatement.executeForRows(T4CCallableStatement.java:950)
      at oracle.jdbc.driver.OracleStatement.doExecuteWithTimeout(OracleStatement.java:1222)
      at oracle.jdbc.driver.OraclePreparedStatement.executeInternal(OraclePreparedStatement.java:3387)
      at oracle.jdbc.driver.OraclePreparedStatement.execute(OraclePreparedStatement.java:3488)
      at oracle.jdbc.driver.OracleCallableStatement.execute(OracleCallableStatement.java:3840)
      at oracle.jdbc.driver.OraclePreparedStatementWrapper.execute(OraclePreparedStatementWrapper.java:1086)
      at oracle.spatial.rdf.client.jena.Oracle.executeCall(Oracle.java:689)
      at oracle.spatial.rdf.client.jena.OracleBulkUpdateHandler.addInBulk(OracleBulkUpdateHandler.java:740)
      at oracle.spatial.rdf.client.jena.OracleBulkUpdateHandler.addInBulk(OracleBulkUpdateHandler.java:463)
      at oracleuploadtest.OracleUploader.loadModelToDatabase(OracleUploader.java:84)
      at oracleuploadtest.RunOracleUploadTest.main(RunOracleUploadTest.java:81)

      thanks!
      Ram.
        • 1. Re: ORA-06502 during bulk load
          alwu-Oracle
          Can you please cut & paste the code snippet you used on the Java side?

          Thanks,

          Zhe Wu
          • 2. Re: ORA-06502 during bulk load
            Sdas-Oracle
            You have encountered a bug having to do with the length of the schema qualified name of the staging table. As a workaround, please shorten the name of the staging table so that the length(schema_name)+length(staging_table_name) <= 25.

            Please note that Jena adapter automatically generates the staging table name using the RDF model name appended to a short prefix of length 5. So, for your testing, please use a shorter model name for now so that length(schema_name)+length(generated staging_table_name) <= 25.

            We will fix this bug and make the fix available at the earliest opportunity.

            Thanks,
            - Souri.
            • 3. Re: ORA-06502 during bulk load
              796925
              Is there something more subtle going on here?

              I have got in a muddle this morning.
              I thought I saw this bug in the behavior of my code yesterday, with a simple test failing with this error.
              So I wrote work-around code that uses batch loader instead of bulk loader if the 25 condition is exceeded.

              Then today, I started by writing a test that would fail if the oracle issue mentioned in this thread were resolved, to remind me to remove my work-around in the future.

              However, that test failed, and I now cannot reproduce the issue described in this thread; I removed my work-around code and the tests that were failing yesterday are now succeeding!
              Such is life, but it is confusing.

              So any advice on this issue appreciated.

              Jeremy
              • 4. Re: ORA-06502 during bulk load
                796925
                PS I have reverted my code, and can now reproduce the error. I will investigate further and report back.
                • 5. Re: ORA-06502 during bulk load
                  796925
                  The addInBulk method needs to be called twice to trigger the bug. Here is a test case that passes only while the bug is present! (It is to remind me to remove the workaround code when the fix gets through to my code).

                  @Test
                       public void testThatOracleBulkBugIsNotYetFixed() throws SQLException {
                            char nm[] = new char[22-TestDataUtils.getUserID().length()-TestOracleHelper.ORACLE_USER.length()];
                            Arrays.fill(nm,'A');
                            TestOracleHelper helper = new TestOracleHelper(new String(nm)); // actual name is TestDataUtils.getUserID() +"_" + nm
                            GraphOracleSem og = helper.createGraph();
                            Node n = RDF.value.asNode();
                            Triple triples[] = new Triple[]{new Triple(n,n,n)};
                            try {
                                 og.getBulkUpdateHandler().addInBulk(triples, null);
                                 // Oracle bug hits on second call:
                                 og.getBulkUpdateHandler().addInBulk(triples, null);
                            }
                            catch (SQLException e) {
                                 if (e.getErrorCode()==6502) {
                                 return; // we have a work-around for this expected error;
                                 }
                                 throw e; // some other problem.
                            }
                            
                            Assert.fail("It seems that an Oracle update (has the ora jar been updated?) resolves a silly bug - please modify BulkLoaderExportMode");
                       }

                  Jeremy
                  • 6. Re: ORA-06502 during bulk load
                    alwu-Oracle
                    Hi Jeremy,

                    Can you please use the following constructor instead of that helper? I want to see the exact name you passed in.

                    og = new GraphOracleSem(... )

                    I am asking because I tried your code and did not see any problem.

                    Thanks,

                    Zhe
                    • 7. Re: ORA-06502 during bulk load
                      366556
                      Souri,

                      I think you're are right, I'm getting the following exception when I use a model name with 17 characters (table name 21 characters). But when I use a shorter name it works.
                      I'm using the recent Jena Adaptor 11.2.3 and this bug is still there:

                      java.sql.SQLException: ORA-06502: PL/SQL: numeric or value error: character string buffer too small
                      ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 3164
                      ORA-06512: at "MDSYS.SDO_RDF_INTERNAL", line 4244
                      ORA-06512: at "MDSYS.SDO_RDF", line 276
                      ORA-06512: at "MDSYS.RDF_APIS", line 693
                      ORA-06512: at line 1

                      Edited by: arielah on Dec 14, 2011 12:47 PM
                      • 8. Re: ORA-06502 during bulk load
                        alwu-Oracle
                        Hi arielah,

                        Which version of Oracle DB are you using?

                        Thanks,

                        Zhe