sqldbgr

Description

sqldbgr is a command line utility that debugs stored procedures and triggers. As with many source-level debuggers, you can:

NoteYou do not have the ability to view sqldbgr version strings.

Syntax

sqldbgr
	-U username
	-P password
	-S host:port

Parameters

-U username

specifies the user name. You must insert a space between -U and username.

-P password

specifies the user password. You must insert a space between -P and password.

-S host:port

specifies the machine name and the port number. You must insert a space between -S and host:port.

Examples

Example 1

Shows sqldbgr debugging stored procedures and triggers on host MERCURY:

$SYBASE/$SYBASE_ASE/bin/sqldbgr -U sa -P -S MERCURY:16896
(sqldbg) stop in sp_who
Breakpoint moved to line 20
(sqldbg) run sp_who
(sp_who::20)if @@trancount = 0
(sqldbg) next
(sp_who::22)    set chained off
(sqldbg) cont
fid spid status loginame origname hostname blk_spid dbname cmd block_xloid
0   2    sleeping NULL   NULL     0        master   NETWORK HANDLER      0
0   3    sleeping NULL   NULL     0        master   NETWORK HANDLER      0
0   4    sleeping NULL   NULL     0        master   DEADLOCK TUNE        0
0   5    sleeping NULL   NULL     0        master   MIRROR HANDLER       0
0   6    sleeping NULL   NULL     0        master   ASTC HANDLER         0
0   7    sleeping NULL   NULL     0        master   ASTC HANDLER         0
0   8    sleeping NULL   NULL     0        master   CHECKPOINT SLEEP     0
0   9    sleeping NULL   NULL     0        master   HOUSEKEEPER          0
0   10   running  sa     sa       0        master   SELECT               0
0   11   sleeping sa     sa
(sqldbg) show breakpoints
1 stop in sp_who
(sqldbg)

Example 2

In this example, the System Administrator first logs in to Adaptive Server using isql, then starts sqldbgr from the command line to debug a stored procedure that is running in another task:

$SYBASE/$SYBASE_OCS/bin/isql -U sa -P 
1> select @@spid
2> go
------
12
1>
$SYBASE/$SYBASE_ASE/bin/sqldbgr -U sa -P -S MERCURY:16896
(sqldbg) attach 13
The spid is invalid
(sqldbg) attach 12
(sqldbg) show breakpoints
(sqldbg) stop in sp_who
Breakpoint moved to line 20
(sqldbg) /* at this point run the sp_who procedure from spid 12 */
(sqldbg) where
(sp_who::20::@loginname = <NULL>)
(ADHOC::1::null)
(sqldbg) next
(sp_who::22)    set chained off
(sqldbg) next
(sp_who::25)set transaction isolation level 1
(sqldbg) cont
(sqldbg) /* at this point the sp_who result will show up in the isql screen */
(sqldbg) detach 12
(sqldbg) 

Usage