Sybase ASE server request logs

logssybasesybase-ase

Is it possible to log each SQL query statement received from clients for a Sybase ASE server 15.7 , same as SET general_log = 1; command for mysql.
Thanks

Best Answer

you could enable the MDA tables (little performance overhead) then use first sp_monitor 'statement'. If it is not enough, you could select into the MDA tables to see the statement running in ASE server such as:

print "**** SQL of the 10 statements having the most CPU time used ****"

select top 10 a.KPID,a.BatchID,a.LineNumber,a.CpuTime,a.StartTime,b.SQLText
from master..monSysStatement a, master..monSysSQLText b
where a.KPID = b.KPID
and a.BatchID = b.BatchID
order by a.CpuTime desc

List of MDA tables: http://infocenter.sybase.com/help/topic/com.sybase.infocenter.dc70002.1550/pdf/asemtpst.pdf