Starts a diagnostic tracing session (starts sending diagnostic information to the diagnostic tables).
ATTACH TRACING TO { LOCAL DATABASE | connect-string } [ LIMIT { size | history } ]
connect-string : the connection string for the database
size : SIZE nnn { MB | GB }
history : HISTORY nnn { MINUTES | HOURS | DAYS }
nnn : integer
connect-string The connection string required to connect to the database receiving the tracing information. This parameter is only required when the database being profiled is different from the database receiving the data.
The following connection parameters are allowed in connect-string: DBF, DBKEY, DBN, Host, Server, LINKS, PWD, UID.
Specify DBF relative to the database server to which you want to connect. If you do not specify a different database server, then the database server to which you are currently connected attempts to start the tracing database identified by the DBF connection parameter.
An error is returned if you specify the DBF parameter with the LINKS or Server connection parameters.
For more information about connction parameters, see Connection parameters.
LIMIT clause The volume limit of data stored in the tracing database, either by size, or by length of time.
The ATTACH TRACING statement is used to start a tracing session for the database you want to profile. You can only use it once a tracing level has been set. You can set the tracing level using Sybase Central, or using the sa_set_tracing_level system procedure. See sa_set_tracing_level system procedure.
Once a session is started, tracing information is generated according to the tracing levels set in the sa_diagnostic_tracing_level table. You can send the tracing data to tracing tables within the same database that is being profiled, by specifying LOCAL DATABASE. Alternatively, you can send the tracing data to a separate tracing database by specifying a connection string (connect-string) to that database. The tracing database must already exist, and you must have permissions to access it.
You can limit the amount of tracing data to store using the LIMIT SIZE or LIMIT HISTORY clauses. Use the LIMIT SIZE clause
when you want to limit the volume of tracing data to a certain size, as measured in megabytes or gigabytes. Use the LIMIT
HISTORY clause to limit the volume of tracing data to a period of time, as measured in minutes, hours, or days. For example,
HISTORY 8 DAYS
limits the amount of tracing data stored in the tracing database to 8 days' worth.
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 and -x dbeng12/dbsrv12 server option.
Packets that contain potentially sensitive data are visible on the network interface, even when tracing to a local database. For security purposes, you can specify encryption in the connection string.
To see the current tracing levels set for a database, look in the sa_diagnostic_tracing_level table. See sa_diagnostic_tracing_level table.
To see where tracing data is being sent to, examine the SendingTracingTo database property. See SendingTracingTo database property.
Must be connected to the database being profiled and must have DBA or PROFILE authority.
None.
SQL/2008 Vendor extension.
The following example sets the tracing level to 1 using the sa_set_tracing_level system procedure. Then it starts a tracing session. Tracing data generated for the local database will be sent to the mytracingdb tracing database on another computer, as shown by the specified connection string. A maximum of two hours of tracing data will be maintained during the tracing session. Note that the ATTACH TRACING statement example is all on one line.
CALL sa_set_tracing_level( 1 ); ATTACH TRACING TO 'uid=DBA;pwd=sql;server=remotedbsrv;dbn=mytracingdb;host=winxp-32' LIMIT HISTORY 2 HOURS; |
Discuss this page in DocCommentXchange.
|
Copyright © 2010, iAnywhere Solutions, Inc. - SQL Anywhere 12.0.0 |