START_LOG

Begin logging index and document service requests. The index logs are written to the database trace files.

Syntax

CTX_OUTPUT.START_LOG(logfile in varchar2, overwrite in default true);

logfile

Specify the name of the log file. Starting with Oracle Database 12c Release 2 (12.2), the logfile parameter is ignored. The logs are now appended to the database trace files. Use the dictionary views such as V$DIAG_INFO and V$PROCESS to find the path to your current session’s trace file or to the trace file for each Oracle Database process.

The Automatic Diagnostic Repository Command Interpreter (ADRCI) utility can also be used to access the trace files.

overwrite

Specify whether you want to overwrite or append to the original query log file specified by logfile, if it already exists. Starting with Oracle Database 12c Release 2 (12.2), this parameter is ignored. By default, all logs are appended to the database trace file.

Examples

begin
CTX_OUTPUT.START_LOG('mylog1');
end;

To view the indexing logs, search for COMPONENT_NAME='CONTEXT_INDEX' in view V$DIAG_TRACE_FILE_CONTENTS:

select PAYLOAD from V$DIAG_TRACE_FILE_CONTENTS where COMPONENT_NAME='CONTEXT_INDEX' and TRACE_FILENAME = trc_name;

To view the query logs, search for COMPONENT_NAME='CONTEXT_QUERY' in view V$DIAG_TRACE_FILE_CONTENTS:

select PAYLOAD from V$DIAG_TRACE_FILE_CONTENTS where COMPONENT_NAME='CONTEXT_QUERY' and TRACE_FILENAME = trc_name;

Parallel Query (PQ) workers have trace filenames of the type: SID_pxxx_PID.trc. To see the traces in the parallel workers:

select TRACE_FILENAME, PAYLOAD from V$DIAG_TRACE_FILE_CONTENTS where COMPONENT_NAME='CONTEXT_INDEX' and TRACE_FILENAME LIKE '%p00%';

Notes

No logs are written if the PDB lockdown profile CTX_LOGGING is enabled.

Logging does not have to be on to start tracing, and vice-versa.

Logging is associated with a session-it can log operations that take place within a single session, and, conversely, cannot make measurements across sessions.

Filenames used in CTX_OUTPUT.START_LOG are restricted to the following characters: alphanumeric, minus, period, space, hash, underscore, single and double quotes. Any other character in the filename will raise an error.