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

SQL Anywhere 10.0.1 » SQL Anywhere Server - SQL Usage » Monitoring and Improving Performance » Advanced application profiling using diagnostic tracing

Changing tracing settings while a tracing session is in progress Next Page

Creating a tracing session


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.

Note

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.

To create a tracing session (Sybase Central)
  1. Connect to the database you want to profile.

  2. Choose Mode > Application Profiling.

    If the Application Profiling wizard appears, click Cancel to close it.

  3. Select the database, and choose File > Tracing. If a submenu appears, choose Configure and Start Tracing.

    The Database Tracing wizard appears.

  4. Follow the instructions in the Database Tracing wizard to configure and capture a tracing session:

    1. On the Tracing Detail Level page, select the level of tracing, and narrow the tracing scope, if needed.

    2. On the Edit Tracing Levels page, customize tracing settings as required.

    3. 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.

      • Click Next.

    4. 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:

        ENG=Server47;DBN=TracingDB
    5. 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.

    6. Click Finish.

  5. Allow applications to interact with the database for a period of time to allow data to be gathered.

  6. 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.

To create a tracing session (Interactive SQL)
  1. Connect to the database as the DBA.

  2. Use the sa_set_tracing_level system procedure to set the desired tracing levels.

  3. Start tracing by executing an ATTACH TRACING statement.

  4. 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.

Examples

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;
See also