Creates a user trace event session.
CREATE [ OR REPLACE ] TEMPORARY TRACE EVENT SESSION session-name [ event-definition [ , ... ] ] [ target-definition [ , ... ] ]
event-definition :
ADD TRACE EVENT event-name
target-definition : ADD TARGET target-name [ SET target-parameter-name=target-parameter-value [ ,... ] ]
target-name : FILE
target-parameter-name : { filename_prefix | max_size | num_files | flush_on_write | compressed }
session-name The name of the trace event session.
event-name The name of the trace event to add to the session. System- and user-defined trace events are supported. Call the sp_trace_events system procedure to obtain a list of system-defined trace events.
target-name The only supported value is FILE.
target-parameter-name The following target parameters are supported:
target-parameter-name | target-parameter-value |
---|---|
filename_prefix | An ETD file name prefix with or without a path. All ETD files have the extension .etd. This parameter is required. |
max_size | The maximum size of the file in bytes. The default is 0, which means there is no limit on the file size and it grows as long as disk space is available. Once the specified size is reached, a new file is started. |
num_files | The number of files where event tracing information is written, and it is used only if max_size is set. If all the files reach the maximum specified size, the database server starts overwriting the oldest file. |
flush_on_write | A value that controls whether disk buffers are flushed for each event that is logged. The values yes, true, no, and false are accepted. The default is false. When this parameter is turned on, the performance of the database server may be reduced if many trace events are being logged. |
compressed | A value that controls compression of the ETD file to conserve disk space. The values on and off are accepted. The default is off. |
OR REPLACE clause This clause creates a trace event session or replaces an existing trace event session with the same name.
Trace event sessions do not run until they are explicitly started with the ALTER TRACE EVENT SESSION statement. Trace event sessions can be used to capture trace events related to system behavior or for a particular user. Trace event sessions are stored in memory and are dropped when the database server stops if they have not been dropped explicitly.
You must have the MANAGE ANY TRACE SESSION system privilege.
None
SQL/2008 Vendor extension.
The following statement creates an event tracing session that records information about the user-defined event my_event and the system-defined event ConsoleLogInformation to a file named my_trace_file:
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 |
![]() |
Discuter à propos de cette page dans DocCommentXchange.
|
Copyright © 2013, SAP AG ou société affiliée SAP - SAP Sybase SQL Anywhere 16.0 |