Skip to end of metadata
Go to start of metadata
General Information on Traceflags

Traceflags are settings that change ASE’s default behaviors

Historically, there have been two main interfaces:

  • Activated at boot-time using -T parameter to the dataserver binary in the RUN_SERVER file. Flags that affect recovery must be activated this way.
  • Interactively activated by a client using DBCC TRACEON and deactivated using DBCC TRACEOFF

    There is also a method that applies only to ASE run as a service on the Windows platform.

Traceflags sometimes behave as if they were session specific, but this is not actually the case. ASE maintains one global array to track traceflags. Some traceflags affect all spids, some affect only spids that have used dbcc traceon to turn on at least one traceflag - that session is then affected by all traceflags that are on. When a session turns off a traceflag, the flag is turned off for all spids as well.

More recently, Switches have also been introduced. Switches are similar to traceflags but have a few important differences:

  • Switches are session specific except when specifically turned on with the "serverwide" option.
  • Switches can have both a number and a string name. Switch numbers map directly to Trace numbers.
  • SET SWITCH ON is designed to give you feedback if you try to turn on a switch number that hasn't been defined. DBCC TRACEON cannot tell you if you are turning on a trace flag number that has not been defined.

How to tell which traceflags are on:

  • Boot-time traceflags shown in errorlog during initialization:

00:00000:00000:2005/09/20 12:32:55.06 kernel Unix interval timer enabled for sysclk interrupts.
00:00000:00000:2005/09/20 12:32:58.85 kernel engine 0, os pid 18221
00:00000:00000:2005/09/20 12:32:59.08 server Active traceflags: 1623, 3477
00:00000:00001:2005/09/20 12:33:01.15 kernel libomni1 - Component Integration Services: using 'Sybase Client-Library/15.0/P/DRV.15.0.0/SPARC/Solaris 2.8/BUILD1 500-050/OPT/Mon Jul 11 18:20:12 2005'

  • Messages are output to the errorlog when a traceflag is turned on or turned off:

00:0002:00000:00034:2020/04/06 03:17:04.49 server  DBCC TRACEON 3604, SPID 34
00:0002:00000:00035:2020/04/06 03:31:40.75 server  DBCC TRACEOFF 3699, SPID 35

1> dbcc traceflags
2> go
Active traceflags: 1623, 3477

  • DBCC ISTRACEON (<N>) checks individual flags; @@error is set to 0 if the flag is active and set to -1 if the flag is not active.

1> dbcc istraceon(2203)
2> go
1> if @@error = 0 [your code here]
2> go

More information on traceflags and a list of publicized ASE traceflags is available at SET options, Switches, and Traceflags


  • No labels