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

SQL Anywhere 17 » SQL Anywhere Server - SQL Reference » SQL statements » Alphabetical list of SQL statements

ALTER TRACE EVENT SESSION statement

Adds or removes trace events from a session, adds or removes targets from a session, or starts or stops a trace session.

Syntax
ALTER TRACE EVENT SESSION session-name 
[ ON SERVER ]    
{ ADD TRACE EVENT trace-event-name [,...]  
  | DROP TRACE EVENT trace-event-name [,...]
  | ADD TARGET FILE [ ( SET target-parameter-name=target-parameter-value [, ...] ) ]
  | DROP TARGET target-name [, ...] ]
  | STATE = { START | STOP }
}
target-parameter-name :
{ filename_prefix 
 | max_size
 | num_files
 | flush_on_write
 | compressed }
Parameters
  • ON SERVER clause

    Alters a trace event session that is recording trace events from all databases on the database server. If this clause is not specified, then only the trace event session on the current database is altered.

  • ADD TRACE EVENT

    The name of the trace event being added to the session.

  • DROP TRACE EVENT

    The name of the trace event being removed from the session.

  • ADD TARGET

    The name of the target being added to the session. Information about the trace events that are part of the session is logged to this target (file).

  • DROP TARGET

    The name of the target being removed from the session.

Remarks

Adding or dropping trace events or targets from a running trace session causes the session to pause briefly to make the changes and then resume after the changes are made. You do not need to stop a tracing session to add or drop trace events or targets. Adding or removing a trace event from a session that has already started has the side effect that some trace events are missed while a session is temporarily paused.

System privileges

You must have the MANAGE ANY TRACE SESSION system privilege.

Side effects

None

Standards
  • ANSI/ISO SQL Standard

    Not in the standard.

Example

The following example creates a trace event called my_event, creates a trace event session called my_session, and starts the session:

CREATE TEMPORARY TRACE EVENT my_event( id INTEGER, information LONG VARCHAR );
CREATE TEMPORARY TRACE EVENT SESSION my_session
    ADD TRACE EVENT my_event, -- user event
    ADD TRACE EVENT SYS_ConsoleLog_Information -- system event
    ADD TARGET FILE ( SET filename_prefix='my_trace_file' ); -- add a target
ALTER TRACE EVENT SESSION my_session
     STATE = START;