Method for enabling tracing SQL statements in SybaseASE15.x

Source: Internet
Author: User
When it comes to tracking SQL statements, some people may ask about this function, and some may think of using the audit function. To track SQL statements and enable the audit function, it will become a waste or

When it comes to tracking SQL statements, some people may ask about this function, and some may think of using the audit function. To track SQL statements and enable the audit function, it will become a waste or

When it comes to tracking SQL statements, some people may ask about this function. Some may think of using the audit function. To track SQL statements and enable the audit function, it will become a waste, maybe the user just wants to track all the SQL statements of a certain connection?

Take a simple example:

1> set tracefile "d:/abc.txt"
2> go
1> set show_sqltext on
2> set statistics io on
3> go
1> select * from t123
2> go
Id col2
-------------------------------------------

Open d: \ abc.txt, And the content is as follows:

========================================================== ==========================================================
Application Tracing report for spid 26 from application "isql"
Run by login "sa" on host "SEAN-E6400"
Tracing started on 05:15:34. 48
========================================================== ==========================================================

05:15:50. 70
No useful sqltext available.
Total writes for this command: 0
End of Batch 4

05:15:55. 28
SQL Text: select * from t123

Table: t123 scan count 1, logical reads: (regular = 1 APL = 0 total = 1), physical reads: (regular = 0 APL = 0 total = 0 ), APT IOs used = 0
Total writes for this command: 0
End of Batch 5

In this case, it is quite convenient. The index lists the on/off option on the top and common ones here:

1. set show_sqltext
2. set showplan
3. set statistics io
4. set statistics time
5. set statistics plancost

Note:

Set tracefile" " This is the matching of the trail All SQL statements connected


Set tracefile" "Only trace all SQL statements currently connected.

Set tracefile on/off (enable or disable)

Of course, dbcc traceon (100) will also output some tracing results on the server side.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.