SAP Sybase ASE 15.7 sp_helpdb arithmetic overflow Msg 3606



Warning! This is technical page relating to SAP Sybase ASE dataservers


This page is only of interest to Sybase specialists.

To return back to the main menu click on this link: Push Pull Signs Main Menu

What the error looked like...

Msg 3606, Level 16, State 0:
Server 'WOODLANE', Procedure 'sp_helpdb', Line 817:
Arithmetic overflow occurred.
(return status = -6)

When using sp_helpdb...

1> sp_helpdb pushpullsigns

 name                       db_size                    owner        dbid     created                  durability           lobcomplvl           inrowlen         status
 -------------------------- -------------------------- ------------ -------- ------------------------ -------------------- -------------------- ---------------- ------------------------------------------------------------------------------------------------
 pushpullsigns                  1281.0 MB              alcook          4     Aug 06, 2013             full                          0               NULL         select into/bulkcopy/pllsort, trunc log on chkpt

(1 row affected)
 device_fragments                                             size                       usage                                    created                                            free kbytes
 ------------------------------------------------------------ -------------------------- ---------------------------------------- -------------------------------------------------- --------------------------------
 DATA001                                                            30.0 MB              data only                                Aug  6 2013  4:53PM                                              96
 LOG001                                                             10.0 MB              log only                                 Aug  6 2013  4:53PM                                not applicable
 DATA001                                                             5.0 MB              data only                                Aug 13 2013  3:27PM                                               0
 DATA001                                                            10.0 MB              data only                                Aug 13 2013  4:02PM                                               0
 DATA002                                                           500.0 MB              data only                                Aug 14 2013 12:57PM                                          244324
 LOG002                                                            500.0 MB              log only                                 Aug 14 2013 12:58PM                                not applicable
 LOG001                                                             10.0 MB              log only                                 Aug 22 2013 10:56AM                                not applicable
 LOG002                                                             50.0 MB              log only                                 Aug 22 2013 11:15AM                                not applicable
 LOG002                                                             30.0 MB              log only                                 Aug 22 2013 11:21AM                                not applicable
 LOG002                                                             50.0 MB              log only                                 Aug 22 2013 12:14PM                                not applicable
 LOG002                                                              8.0 MB              log only                                 Aug 22 2013 12:26PM                                not applicable
 LOG002                                                             18.0 MB              log only                                 Aug 22 2013 12:27PM                                not applicable
 LOG002                                                             60.0 MB              log only                                 Aug 22 2013 12:45PM                                not applicable

Msg 3606, Level 16, State 0:
Server 'WOODLANE', Procedure 'sp_helpdb', Line 817:
Arithmetic overflow occurred.
(return status = -6)


How it came about...

On a development version of Sybase ASE 15.7 (set with database 4k page size) running on Centos Linux was doing some testing of 15.7 and large transactions.

After getting the database above to LOG SUSPEND I then killed the process.

During the rollback process the above error showed up.


SAP Sybase ASE and linux versions...

Output from select @@version within ASE:

Adaptive Server Enterprise/15.7/EBF 21341 SMP SP101 /P/x86_64/Enterprise Linux/ase157sp101/3439/64-bit/FBO/Thu Jun 6 16:08:18 2013


output from linux command "uname -a"

Linux linuxdev.home 2.6.32-358.14.1.el6.x86_64 #1 SMP Tue Jul 16 23:51:20 UTC 2013 x86_64 x86_64 x86_64 GNU/Linux

Output from linux command "lsb_release -a"

LSB Version: :base-4.0-amd64:base-4.0-noarch:core-4.0-amd64:core-4.0-noarch:graphics-4.0-amd64:graphics-4.0-noarch:printing-4.0-amd64:printing-4.0-noarch
Distributor ID: CentOS
Description: CentOS release 6.4 (Final)
Release: 6.4
Codename: Final

Finding where the problem was...

@pagekb is set to 4 by the stored procedure as the server database page size is configured as 4kb.

Modified code for the get round:

25> select convert(char, (lct_admin("logsegment_freepages", @curdbid)
26> - 1 * lct_admin("reserved_for_rollbacks", @curdbid))
27> * @pagekb)
28>
29>


30> print " "

31> print "Calculation:"

32>

This is the code from sp_helpdb...

33> select convert (char, (lct_admin("logsegment_freepages", @curdbid)
34> - lct_admin("reserved_for_rollbacks", @curdbid))
35> * @pagekb)
36>
37>
38>
(1 row affected)
(1 row affected)


logsegment_freepages

------------------------------------------------------------
8655

(1 row affected)
reserved_for_rollbacks

------------------------------------------------------------
74521
(1 row affected)
With * 1 fix

This shows the value calculated after multiplying by 1
------------------------------------------------------------
-263464
(1 row affected)
Error as per sp_helpdb...


Calculation:
Msg 3606, Level 16, State 0:
Server 'WOODLANE', Line 33:
Arithmetic overflow occurred.


Conclusion

The value being returned from

lct_admin("reserved_for_rollbacks", @curdbid)

is causing the error and multiplying by 1 creates a get round to the problem.

The modified code using the "1 *" get round is:

select convert(char, (lct_admin("logsegment_freepages", @curdbid)
- 1 * lct_admin("reserved_for_rollbacks", @curdbid))
* @pagekb)

This is a transient error and can be difficult to reproduce as the value for "reserved_for_rollbacks" after a while is reset by the system and sp_helpdb starts working ok again. Showing a negative value for log free isn't ideal and maybe changing the code to show zero for log free when the database is in this state would be better.

Contact Information

If this bug gets fixed please let me know and I'll update this page.

cookalastair @ btinternet.com

Last update to this page - 13th November 2013

Push Pull Sign Green Red