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
An error is returned if you specify the DBF parameter with the LINKS or Server connection parameters.
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.
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;