[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

comp.lang.ruby

Integer overflow in OCI8

Andreas Habel

1/14/2005 5:54:00 PM

Hi,

I`m writing a tiny agent in ruby to simplyfy my daily dba jobs and
monitor the database activity, especially the state of my standby databases.

My library of choice is RubyOCI8 because it`s the only one I think,
where I can logon as SYSDBA. Please correct me if I´m wrong!

The following statement caused OCI8 to die
SQL> SELECT * FROM DBA_TEMP_FILES;

OCIError: ORA-01455: Ueberlauf von Integer-Datentyp bei Umwandlung der
Spalte
#translation: Overflow of integer-datatype during conversion of column

from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:499:in `fetch'
from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:499:in `fetch_a_row'
from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:499:in `do_ocicall'
from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:499:in `fetch_a_row'
from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:312:in `fetch'
from ./lib/database.rb:284:in `tempfiles'
from (irb):16


My system:
RDBMS Oracle 9.2.0.4 Enterprise / Standard Edition (tested both)
Client 9.2.0.6 / 10.0.1.3 (tested both)
OS: Windows 2000 / 2003 (Client / Server)
RubyInstaller is up to date

The killing value seems to be the column MAXBYTES with a value of
34,359,721,984. The strange thing is, if I call DBA_DATA_FILES instead,
where MAXBYTES is equal to MAXBAYTES in *_TEMP_FILES, I got no problems.

Can anyone imagine what`s the problem ?

Below you see the result of the query in SQL*Plus.

Thx
Andreas



FILE_NAME
--------------------------------------------------------------------------------
FILE_ID TABLESPACE_NAME BYTES BLOCKS STATUS
---------- ------------------------------ ---------- ---------- ---------
RELATIVE_FNO AUT MAXBYTES MAXBLOCKS
INCREMENT_BY
------------ --- ------------------------------------ ----------
------------
USER_BYTES USER_BLOCKS
---------- -----------
H:\ORACLE\ORADATA\BODEV\TEMP01.DBF
1 TEMP 131072000 16000 AVAILABLE
1 YES 34359721984 4194302
80
130023424 15872
1 Answer

KUBO Takehiro

1/15/2005 3:40:00 AM

0

Andreas Habel <mail@exceptionfault.de> writes:

> Hi,
>
> I`m writing a tiny agent in ruby to simplyfy my daily dba jobs and
> monitor the database activity, especially the state of my standby databases.
>
> My library of choice is RubyOCI8 because it`s the only one I think,
> where I can logon as SYSDBA. Please correct me if I´m wrong!
>
> The following statement caused OCI8 to die
> SQL> SELECT * FROM DBA_TEMP_FILES;
>
> OCIError: ORA-01455: Ueberlauf von Integer-Datentyp bei Umwandlung der
> Spalte
> #translation: Overflow of integer-datatype during conversion of column
>
> from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:499:in `fetch'
> from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:499:in `fetch_a_row'
> from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:499:in `do_ocicall'
> from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:499:in `fetch_a_row'
> from c:/ruby/lib/ruby/site_ruby/1.8/OCI8.rb:312:in `fetch'
> from ./lib/database.rb:284:in `tempfiles'
> from (irb):16

Please change line 449 of oci8.rb as following:
From: if precision <= 9 # the precision of Fixnum (assuming 31 bit integer)
To: if precision > 0 && precision <= 9 # the precision of Fixnum (assuming 31 bit integer)

The datatype of MAXBYTES is NUMBER whose scale and precision are not
specified. In that case scale and precision are zeros, so ruby-oci8
define it as Fixnum.

> My system:
> RDBMS Oracle 9.2.0.4 Enterprise / Standard Edition (tested both)
> Client 9.2.0.6 / 10.0.1.3 (tested both)
> OS: Windows 2000 / 2003 (Client / Server)
> RubyInstaller is up to date
>
> The killing value seems to be the column MAXBYTES with a value of
> 34,359,721,984. The strange thing is, if I call DBA_DATA_FILES instead,
> where MAXBYTES is equal to MAXBAYTES in *_TEMP_FILES, I got no problems.

In my environment I get problems in also DBA_DATA_FILES.

BTW I must release ruby-oci8 next version...

--
KUBO Takehiro
kubo@jiubao.org