Tag Archive: bug


Sybase

We’ve been upgrading a number of Sybase ASE databases from the end-of-life’d 12.5.x to v15.0.3 esd 4 the last few weeks.   My coworker (Degang He) ran into an interesting error when the upgrade process was failing on sysprocedures.

Database ‘my_db’: beginning upgrade step [ID 26]: alter table (table sysprocedures)
Command has been aborted.

Msg 3461, Level 20, State 1:
Server ‘my_server’, Line 1:
Database ‘my_db’: upgrade could not install required upgrade item ’26′. Please refer to previous error messages to determine the problem. Fix the problem, then try again.

Msg 3451, Level 20, State 1:
Server ‘my_server’, Line 1:
Database ‘my_db’: upgrade has failed for this database. Please refer to previous messages for the cause of the failure, correct the problem and try again.

Msg 3454, Level 20, State 1:
Server ‘my_server’, Line 1:

Database ‘my_db’: ASE could not completely upgrade this database; upgrade item 1501 could not be installed.

We looked on Sybase’s Solved Cases and Google but didn’t find anything that would really fit the problem.  So we called up Sybase Technical Support.  Somdev Sharma of Sybase was able to determine that this was a bug in the ASE 15x codeline and provided a workaround:

CR #643188:

Title Online database failed with 3461 error during upgrade , ‘max parallel degree’ >1

Workaround:

Before online the database, disable parallel sort via sp_configure ‘max parallel degree’,1

Sanitized:

Online database failed with 3461, 3451 and 3454 errors during upgrade sysprocedures table (upgrade  item ’26′). If ‘max parallel degree’ > 1, then please disable parallel sort with sp_configure ‘max parallel degree’, 1.

After disabling parallel sort, the database was upgraded successfully.

On my media server, I wanted to set up Perl’s CPAN but when I ran install Bundle::CPAN, I ctrl-c’d out of it when I noticed that bzip2 wasn’t installed.  Silly me.  Soon after I started receiving:

Can’t call method “value” on an undefined value at /usr/share/perl5/IO/Uncompress/RawInflate.pm

Reinstalling Perl and all the related ubuntu packages doesn’t fix it, nor does removing the ~root/.cpan dir.  There is an easy workaround though.

# aptitude remove libcompress-raw-zlib-perl
Reading package lists… Done
Building dependency tree      
Reading state information… Done
Reading extended state information      
Initializing package states… Done
Building tag database… Done      
The following packages are BROKEN:
  libio-compress-zlib-perl
The following packages have been kept back:
  bind9-host dnsutils libbind9-30 libisccfg30
The following packages will be REMOVED:
  libcompress-raw-zlib-perl
0 packages upgraded, 0 newly installed, 1 to remove and 4 not upgraded.
Need to get 0B of archives. After unpacking 319kB will be freed.
The following packages have unmet dependencies:
  libio-compress-zlib-perl: Depends: libcompress-raw-zlib-perl (>= 2.008) but it is not installable
Resolving dependencies…
The following actions will resolve these dependencies:

Remove the following packages:
apparmor-utils
libcompress-zlib-perl
libio-compress-zlib-perl
libmp3-tag-perl
librpc-xml-perl
libwww-perl
libxml-parser-perl
ubuntu-standard

Score is 592

Accept this solution? [Y/n/q/?]

Make a note of the packages that it will remove, then tell it to go ahead. It will remove these packages!

Start cpan, and type in

install Bundle::CPAN

. When it is complete, reinstall the ubuntu packages that you removed earlier (for example):

# aptitude install apparmor-utils libcompress-zlib-perl libio-compress-zlib-perl libmp3-tag-perl librpc-xml-perl libwww-perl libxml-parser-perl ubuntu-standard

That’s it. Your cpan is working again :)

The ASE 15 stored procedure sp_tables doesn’t work with SQL UDFs. sp_tables has the udfs coming back as system tables.

repro:
1) create a sql udf in a db
2) run sp_tables, you will see the UDF as a “SYSTEM TABLE”

DBADEV1.sybase_dba.1> sp_tables;
table_qualifier table_owner table_name table_type remarks
--------------- ----------- ---------- ---------- -------
sybase_dba dbo DATE_FORMAT SYSTEM TABLE NULL

In the above example, the DATE_FORMAT UDF is the one at Porting MySQL’s date_format function to Sybase ASE 15.0.2

I’ve opened a case with Sybase to get this fixed – I’ll post the CR # when I get it.

UPDATE:  Sybase assigned CR 497173 to this :)

If you’re like me, you’ve run into lots of different issues with the Sybase ASE DBMS over the years. Today, Drew Montgomery looked at what happens when the 12.5.x -> 12.5.4 upgrade goes bad:

If you receive the 8419 error on sysusers after applying ASE 12.5.4 (or any other upgrade for that matter) such as the following:

01:00000:00472:2007/12/10 14:46:03.86 server Error: 8419, Severity: 20, State: 3
01:00000:00472:2007/12/10 14:46:03.86 server Could not find index descriptor for objid 10, indid 3 in dbid 13.
01:00000:00472:2007/12/10 14:46:03.88 kernel ************************************
01:00000:00472:2007/12/10 14:46:03.88 kernel SQL causing error : select * from sysusers
01:00000:00472:2007/12/10 14:46:03.88 kernel ************************************
01:00000:00472:2007/12/10 14:46:03.88 server SQL Text: select * from sysusers
01:00000:00472:2007/12/10 14:46:03.89 kernel curdb = 13 tempdb = 9 pstat = 0×10000
01:00000:00472:2007/12/10 14:46:03.89 kernel lasterror = 8419 preverror = 0 transtate = 1

Fear not because Drew has you covered with a simple script that will fix the problem. Note that it involves a dump and load of the affected database but you could just restart the ASE server if you don’t mind the down time:

sp_configure "allow updates", 1
go
use db_with_8419
go

select * into tempdb..temp_sysusers from sysusers
go

select uid, cnt= count(*)
  into tempdb..temp_uid
  from tempdb..temp_sysusers
 group by uid
 having count(*) > 1
go

select s.uid, s.suid
  into tempdb..temp_fixuid
  from tempdb..temp_sysusers s, tempdb..temp_uid t
 where s.uid = t.uid
go

select uid, min(suid) suid
  into tempdb..temp_rmuid
  from tempdb..temp_fixuid
 group by uid
go

delete tempdb..temp_fixuid
  from tempdb..temp_fixuid f, tempdb..temp_rmuid r
 where f.uid = r.uid
   and f.suid = r.suid
go

alter table tempdb..temp_fixuid add cntr int identity
go

declare @max_uid int
select @max_uid = max(uid)
  from tempdb..temp_sysusers
 where suid > 16300

update sysusers
   set uid = @max_uid + cntr
  from sysusers s, tempdb..temp_fixuid f
 where s.uid = f.uid
   and s.suid = f.suid
go

use master
go

dump database db_with_8419 to "compress::N::/DumpLocation/dumpfilename.dmp"
go
load database db_with_8419 from "compress::/DumpLocation/dumpfilename.dmp"
go
online database db_with_8419
go

sp_configure "allow updates", 0
go

Bau-jen Liu over at Sybase came up with the following method but it does require rebooting ASE twice:

sp_configure "allow updates", 1
go
update ..sysobjects
set sysstat = 115, type = "U"
where name = "sysusers"
go

Shutdown ASE, reboot, and log back in as a user with sa_role.

use dbname
go

create unique index ncsysusers2 on sysusers(uid)
go

The above CREATE INDEX command may fail due to the presence of duplicate key rows in sysusers. If this occurs, recreate the index as non-unique first:

create index ncsysusers2 on sysusers(uid)
go

Now identify any duplicates that may exist in sysusers:

select uid, name, count(*)
from sysusers
group by uid
having count(*) > 1
go

Remove any duplicates found using the DELETE command and try the CREATE INDEX again:

create unique index ncsysusers2 on sysusers(uid)
go

Now, clean up after yourself:

update ..sysobjects
set sysstat = 113, type = "S"
where name = "sysusers"
go

sp_configure "allow updates", 0
go

Sybase has created bug # 298620 for this issue.

For those of us that use Sybase’s Replication Server, we have long ago been pacified into believing that there really isn’t much that can be done with Replication Server’s quirks but to endure them.

In today’s edition of the Sybase RepServer Quirks we take a look at the “out of mutexes” error.  A mutex is an exclusive lock on a resource.  If you receive an error about RepServer running out of mutexes, you just don’t have enough defined through RepServer.  Simple huh?

Of course it is.  Ahh..  but then how do how many mutexes your particular Sybase RepServer needs?  How many grains of sand are on the moon?  According to Sybase you should know this already but since you can’t read minds (I hope you can’t because I’m thinking of donuts and not RepServer), I’ll pass on what Sybase is saying when pressed about it (Greg Carter @ Sybase):

> Just to elaborate a bit more on this question of the number of mutexes; as
> you probably know the mutex requirements for RepServer increased
> dramatically with the SMP feature. I have since struggled to come up with a
> formula for estimating mutex requirements so that you may properly set the
> “num_mutexes” configuration. While in the latest iteration of this formula
> I have satisfied myself that all mutexes have been accounted for, still the
> estimate it provides seems to fall short in some cases.
>
> Recent investigations by Connectivity seem to indicate that the problem may
> not be with sizing mutex requirements, but rather with sizing message queue
> (“num_msgqueues”) requirements. It appears that Open Server may be using
> the total of the settings for “num_mutexes” and “num_msgqueues” as the
> upper bound for the creation of these two objects together. So it may be
> that even though “num_mutexes” has been sized properly, if “num_msgqueues”
> is too low then you may see a message regarding the failure to create a
> mutex or the failure to create a message queue depending on which one was
> being created at the time that upper bound was surpassed.
>
> The moral here is that until Open Server resolves this issue you need to
> verify the sizing of both “num_mutexes” and “num_msgqueues” in the event
> that either error message appears since you can not rely on the message to
> indicate which one is low.
>
> For your convenience I’ll include here the latest formulas for estimating
> mutex and message queue requirements. Note that the one for mutexes may not
> agree completely with the one that is given in the 12.6 SMP White Paper – I
> have not compared them.
>
> Mutex requirements for the optimized binary:
> num_mutexes = 75 + Num(partitions) + 4*Num(DSI/S) + 3*Num(DSI/E) +
> 2*Num(Dist) + 2*Num(RepAgent Exec) + 2*Num(RSI User) + 5*Num(Queues) +
> 5*Num(SQT Cache) + Num(rs_subscriptions rows) + Num(RSSD tables) +
> Setting(cm_max_connections) +
> 2*MAX(Admin connections) + 2*Num(Other Connections) + Num(Origins) +
> 2*Num(Threads) + MAX(subscription (de)mat)
>
> Where
> – “Other Connections” are connection to this RepServer including ID Server
> connections, RSM connections, etc.
> – “Origins” are the different origins (or primary databases) that could
> possibly have transactions flowing through this RepServer, whether by a
> RepAgent or by a route (intermediate included)
> – “Threads” includes every thread RepServer may start. These are the
> “Global” thread, the “Initialization” thread, threads for each of the
> daemons (dAIO, dCM, dVersion, dRec, dSub, dStats, dAlarm), RepAgent User
> threads, SQM Writer threads, SQT threads, Distributor threads, DSI/S and
> DSI/E threads, RSI User and RSI threads.
> – “subscription (de)mat” is the number of asynchronous subscription
> management requests for materializing or dematerializing that may be taking
> place at any moment.
>
> Note: For the diagnostic binary you will need to double the figure
> determined with the above formula.
>
> Message queue requirements for the optimized and diagnostic binary:
> num_msgqueues = 10 + Num(DSI/S) + Num(DSI/E) + Num(Queues) + Num(Dist)
>
> Thanks,
> G.Carter

Neither this explanation or the two equations are anywhere in the manuals.  I’ve opened feature request 485482 for RepServer to handle this automagically as there really is NO NEED for a RepServer admin to have to worry about this.  If you are or ever have run into this problem, give Sybase a holler and tell them to fix this bug.