Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SAP Sybase SQL Anywhere 16.0 » SQL Anywhere Server - SQL Usage » Performance improvements, diagnostics, and monitoring » Performance monitoring and diagnostic tools » Diagnostic tracing

 

Creating a diagnostic tracing session (SQL)

You can start a tracing session by executing the ATTACH TRACING statement in Interactive SQL.

Prerequisites

You must have the DIAGNOSTICS system role, and the MANAGE PROFILING system privilege.

Context and remarks

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, respectively, ATTACH TRACING and DETACH TRACING.

 Task
  1. Connect to the database.

  2. Use the sa_set_tracing_level system procedure to set the tracing levels. For example:

    CALL sa_set_tracing_level( 1 );
  3. Start tracing by executing an ATTACH TRACING statement.

  4. Stop tracing by executing a DETACH TRACING statement.

Results

The tracing session is created and completed.

Next

The diagnostic tracing data can be viewed in Application Profiling mode in Sybase Central.

Example

This example shows how to start diagnostic 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 assumes there is a user ID DBA with password sql with the correct privileges:

ATTACH TRACING TO 'UID=DBA;PWD=sql;Server=server47;DBN=tracing;Host=myhost' 
LIMIT HISTORY 2 HOURS;

This example shows how to start diagnostic 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 diagnostic tracing and save the diagnostic data that was captured during the tracing session:

DETACH TRACING WITH SAVE;

This example shows how to stop diagnostic tracing and not save the diagnostic data.

DETACH TRACING WITHOUT SAVE;

 See also