Hi Monks,

I have run into an issue when inserting BLOBs into Oracle using DBI.

When our database ran out of space - records were still inserted into the table but the BLOBs were not inserted resulting in incomplete records (zero byte BLOBs).

I have been tasked with making sure that my script does not insert a row if this space issue comes up again. Our DBA created a test database for me to test this issue.

I created a test script to test insertions using both AutoCommit and a manual commmit/rollback insert.

When using AutoCommit - the record is inserted with a zero-byte BLOB. By inserted - I mean that the other non-BLOB data fields were inserted into the table.

DBI trace (level 1) shows the lob extension failure:

abcdefghijklmnopqrstuvw...', :p8=561] at test_script.pl line 75. ][ORA +-01691: unable to extend lob segment OBX.SYS_LOB0000095979C00009$$ by + 128 in tablespace OBX (DBD ERROR: OCILobWrite in post_execute_lobs)] at te +st_script.pl line 81.

Using manual commit/rollback, the results were as expected with no record inserted into the table and the following message received:

abcdefghijklmnopqrstuvw...', ...)= ( 1 ) [1 items] at test_file.txt li +ne 71 <- bind_param_inout(8, SCALAR(0x276f2f4), ...)= ( 1 ) [1 items] at + test_script.pl line 72 !! ERROR: 1691 'ORA-01691: unable to extend lob segment OBX.SYS_LO +B0000095979C00009$$ by 128 in tablespace OBX (DBD ERROR: OCILobWrite +in post_execute_lobs)' (err#1) <- execute= ( undef ) [1 items] at test_file.txt line 75 !! ERROR: 1691 CLEARED by call to rollback method <- rollback= ( 1 ) [1 items] at test_file.txt line 80 <- DESTROY(DBI::st=HASH(0x276f014))= ( undef ) [1 items] at test_s +cript.pl line 81 <- DESTROY(DBI::db=HASH(0x265ed64))= ( undef ) [1 items] at test_s +cript.pl line 81

While I can fix this issue easily by making the script use a manual commit/rollback - my question is whether the AutoCommit response is as expected? I would have expected the same result with the entire record being rolled back.

Has anyone else had any experience with this issue?

Thank you!

Chris


In reply to DBI BLOB Insert Issue - Database out of space by tokpela

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post, it's "PerlMonks-approved HTML":



  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, details, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, summary, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.