web analytics

Sybase simplified sp_who procedure

The procedure displays only the necessary fields from sysprocesses:

create procedure sp_who_all as select PR.spid , PR.fid , substring(suser_name(PR.suid),1,10) Login_name, substring(PR.program_name,1,10) Program , PR.status , cmd , substring(db_name(dbid),1,19) db_name, substring(tran_name,1,22) tran_name, blocked, physical_io from master..sysprocesses PR go

Process all databases in Sybase

#!/usr/bin/ksh echo "Started…" print -u2 -n "Enter password:" stty -echo read PASS stty echo print rm -f databases.lst isql -U sa -S $DSQUERY -w 999<<EOF | awk ‘/DBLABEL/ { print $2 }’ > databases.lst $PASS select ‘DBLABEL’ "XXX", name from master..sysdatabases go exit EOF for DB in $(cat databases.lst) ; do print -u2 "Processing $DB […]