Subject: | bug with BFILEs and ora_auto_lob=>0 in DBD::Oracle? |
Date: | Mon, 20 Feb 2012 16:54:39 +0100 |
To: | bug-DBD-Oracle [...] rt.cpan.org, timb [...] cpan.org, yanick [...] cpan.org |
From: | Norbert Debes <norbert.debes [...] oradbpro.com> |
Hi Tim, Yannick,
I'd like to report this issue on the otherwise excellent Perl DBI and
DBD::Oracle.
It seems that BFILEs don't work with ora_auto_lob => 0 in DBD::Oracle.
The problem appears to be that BFILEs need to be *explicitly opened*.
There is also a separate constant in OCI for BFILEs which I guess would
be worth adding to DBD::Oracle. This constant does not seem to be
available in DBD::Oracle. Page 2-10 in 11.2 OCI manual has this table:
Table 2--2 Descriptor Types
Description C Datatype OCI Type Constant
snapshot descriptor OCISnapshot OCI_DTYPE_SNAP
result set descriptor OCIResult OCI_DTYPE_RSET
*LOB datatype locator OCILobLocator OCI_DTYPE_LOB
BFILE datatype locator OCILobLocator OCI_DTYPE_FILE*
Here's what happens when I run the attached program/testcase:
E:\home\ndebes\it\perl>perl bfiledmp.pl
DBI version 1.616 DBD version 1.30
File size 181120 bytes
BFILE LOB locator: OCILobLocatorPtr=SCALAR(0x95377c); ora_lob_is_init: 1
BFILE LOB locator: OCILobLocatorPtr=SCALAR(0x95377c); ora_lob_is_init: 1
DBD::Oracle::db ora_lob_read failed: ORA-22289: cannot perform FILEREAD
operation on an unopened file or LOB (DBD ERROR: OCILobRead) at
bfiledmp.pl line 401.
ora_lob_read returned 0 bytes
I'm trying to read the alert log over Oracle Net and TCP/IP as part of
some monitoring routine. Since the alert log is appended to I want to
read only the additional lines. That's not possible with ora_auto_lob =>
1 which places the entire file's contents into a variable value.
On 2/20/2012 13:51, Cornel Albert wrote:
If you have a running Oracle instance, create a directory like this:
Show quoted text
SQL> col bdump new_value bdump
SQL> select value as bdump from v$parameter where
name='background_dump_dest';
BDUMP
--------------------------------------------------------------------------------
C:\software\oracle\diag\rdbms\eleven2\eleven2\trace
Show quoted textSQL> create or replace directory BACKGROUND_DUMP_DEST as '&bdump';
old 1: create or replace directory BACKGROUND_DUMP_DEST as '&bdump'
new 1: create or replace directory BACKGROUND_DUMP_DEST as
'C:\software\oracle\diag\rdbms\eleven2\eleven2\trace'
Directory created.
Show quoted textSQL> select * from dba_directories where
directory_name='BACKGROUND_DUMP_DEST';
OWNER DIRECTORY_NAME
------------------------------ ------------------------------
DIRECTORY_PATH
--------------------------------------------------------------------------------
SYS BACKGROUND_DUMP_DEST
C:\software\oracle\diag\rdbms\eleven2\eleven2\trace
Show quoted textSQL> $dir
C:\software\oracle\diag\rdbms\eleven2\eleven2\trace\alert_eleven2.log
C:\\software\\oracle\\diag\\rdbms\\eleven2\\eleven2\\trace\\alert_eleven2.log
Show quoted textSQL> $ls -l
C:\software\oracle\diag\rdbms\eleven2\eleven2\trace\alert_eleven2.log
-rw-r--r-- 1 ndebes None 181276 Feb 20 16:43
C:\software\oracle\diag\rdbms\eleven2\eleven2\trace\alert_eleven2.log
Now you can read alert_<ORACLE_SID>.log over Oracle Net as a BFILE.
Testcase attached.
/Here's a little tidbit: while Oracle failed to document the new SYSASM
feature in the Oracle® Call Interface Programmer's Guide 11g Release 2
(11.2) E10646-04 October 2009 you've already documented it and
DBD::Oracle supports it. Good job!/
--
Mit freundlichen Grüßen/Kind regards
Norbert Debes
Hinweis: Kontaktdaten s. angehängte vcard/Note: contact information in attached vcard
Message body is not shown because sender requested not to inline it.
Message body is not shown because sender requested not to inline it.