When you start a tracing session, you also configure the type of tracing you want to perform, and specify where you want the tracing data to be stored. Your tracing session continues until you explicitly request that it stops.
In order to start a tracing session, TCP/IP must be running on the database server(s) on which the tracing database and production database are running. See Using the TCP/IP protocol.
Starting a tracing session is also referred to as attaching tracing. Likewise, stopping a tracing session is referred to as detaching tracing. The SQL statements for starting and stopping tracing are ATTACH TRACING and DETACH TRACING, respectively.
Connect to the database you want to profile.
Choose Mode > Application Profiling.
If the Application Profiling wizard appears, click Cancel to close it.
Select the database, and choose File > Tracing. If a submenu appears, choose Configure and Start Tracing.
The Database Tracing wizard appears.
Follow the instructions in the Database Tracing wizard to configure and capture a tracing session:
On the Tracing Detail Level page, select the level of tracing, and narrow the tracing scope, if needed.
On the Edit Tracing Levels page, customize tracing settings as required.
On the Create External Database page:
Select Create a New Tracing Database.
Specify the user name and password that you used to connect to the production database.
Select Start Database on the Current Server.
Click Create Database.
The Database Tracing wizard creates the tracing database by unloading the schema and permission information from the production database, and then loading it into the newly-created tracing database.
On the Start Tracing page:
Select Save Tracing Data in an External Database.
Specify the user name and password that you specified for the tracing database. These should match the user name and password you used to connect to the production database.
Specify the database server and database name in the form of a partial connect string. For example:
Under Do You Want to Limit the Volume of Trace Data That Is Stored, choose an option for the volume of tracing database to save.
Allow applications to interact with the database for a period of time to allow data to be gathered.
When you are done gathering tracing data, select the database and choose File > Tracing > Stop Tracing with Save.
The Database Tracing wizard ends the tracing session and stores the captured data in the diagnostic tables.
Connect to the database as the DBA.
Use the sa_set_tracing_level system procedure to set the desired tracing levels.
Start tracing by executing an ATTACH TRACING statement.
Stop tracing by executing a DETACH TRACING statement.
You can view the diagnostic tracing data in Application Profiling mode in Sybase Central. See Application profiling.
This example shows how to start tracing on the current database, store the tracing data in a separate database, and set a two hour limit on the amount of data to store. This example is all on one line:
ATTACH TRACING TO 'UID=DBA;PWD=sql;ENG=dbsrv10;DBN=tracing;LINKS=tcpip' LIMIT HISTORY 2 HOURS;
This example shows how to start tracing on the current database, store the tracing data in the local database, and set a two megabyte limit on the amount of data to store:
ATTACH TRACING TO LOCAL DATABASE LIMIT SIZE 2 MB;
This example shows how to stop tracing and save the diagnostic data that was captured during the tracing session:
DETACH TRACING WITH SAVE;
This example shows how to stop tracing and not save the diagnostic data.
DETACH TRACING WITHOUT SAVE;