1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187
|
<?xml version="1.0" encoding="ISO-8859-1"?>
<!--
-
- This file is part of the OpenLink Software Virtuoso Open-Source (VOS)
- project.
-
- Copyright (C) 1998-2018 OpenLink Software
-
- This project is free software; you can redistribute it and/or modify it
- under the terms of the GNU General Public License as published by the
- Free Software Foundation; only version 2 of the License, dated June 1991.
-
- This program is distributed in the hope that it will be useful, but
- WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
- General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
-
-
-->
<refentry id="fn_trace_on">
<refmeta>
<refentrytitle>trace_on</refentrytitle>
<refmiscinfo>debug</refmiscinfo>
</refmeta>
<refnamediv>
<refname>trace_on</refname>
<refpurpose>Enable extra debug logging</refpurpose>
</refnamediv>
<refsynopsisdiv>
<funcsynopsis id="fsyn_trace_on">
<funcprototype id="fproto_trace_on">
<funcdef>integer <function>trace_on</function></funcdef>
<paramdef>in <parameter>parameter</parameter> varchar</paramdef>
</funcprototype>
</funcsynopsis>
</refsynopsisdiv>
<refsect1 title="desc_trace_on">
<title>Description</title>
<para>This function requires dba privileges.</para>
<para>
This function enables logging specified server operations for debugging purposes.
The log entries will be shown at the server console (if started with foreground option) and will be written into the server message log file.
The traceable events are divided into several groups: user activity, transactions, compilation of the SQL statements, DDL statements, statements execution and VDB actions.
</para>
</refsect1>
<refsect1 id="params_trace_on">
<title>Parameters</title>
<para>The following options are available for logging:</para>
<simplelist>
<member><emphasis>user_names</emphasis> - include the full user name,
otherwise user ID will be logged.</member>
<member><emphasis>user_log</emphasis> - log the connects/disconnects for users.</member>
<member><emphasis>failed_log</emphasis> - log incorrect logins.</member>
<member><emphasis>compile</emphasis> - log the names of procedures / triggers
name compiled.</member>
<member><emphasis>ddl_log</emphasis> - log the DDL statements execution.</member>
<member><emphasis>client_sql</emphasis> - log the compilation of the
client's SQL statements (first 500 chars).</member>
<member><emphasis>errors</emphasis> - log all server errors.</member>
<member><emphasis>dsn</emphasis> - log the connection/disconnection
to DSNs, registration and removal of the DSNs, compilation of the
SQL statements executed thru the VDB.</member>
<member><emphasis>sql_send</emphasis> - log the compilation of SQL
statements executed thru the VDB.</member>
<member><emphasis>transact</emphasis> - log the transactions.</member>
<member><emphasis>remote_transact</emphasis> - log the remote transactions.</member>
<member><emphasis>exec</emphasis> - log SQL statement execution.</member>
<member><emphasis>soap</emphasis> - log SOAP server requests and responses.</member>
<member><emphasis>thread</emphasis> - log THRD_1 %ld OS threads freed.
This is when OS threads are freed due to inactivity (being idle for more
than ThreadCleanupInterval time).</member>
<member><emphasis>cursor</emphasis> - log CURS_[0-9] - various VDB statements actions.</member>
</simplelist>
</refsect1>
<refsect1 id="ret_trace_on"><title>Return Types</title>
<para>Upon success zero will be returned, otherwise an error is signalled.</para>
<para>The message log file and/or server debug screen will list details for activated
log options. The formats are as follows:</para>
<screen>
USER_0 (user) (IP) (peer) logout
USER_1 (user) (IP) (peer) login
</screen>
<screen>
FAIL_0 (user) (IP) (peer)
</screen>
<screen>
COMP_0 (user) (IP) (peer) trigger (name)
COMP_1 (user) (IP) (peer) procedure (name)
</screen>
<screen>
DDLC_0 (user) (IP) (peer) Create table (name)
DDLC_1 (user) (IP) (peer) Drop table (name)
DDLC_2 (user) (IP) (peer) Create procedure (name)
DDLC_3 (user) Drop procedure (name)
DDLC_4 (user) Create view (name)
DDLC_5 (user) Create index (name) or (table name)
DDLC_6 (user) Drop index (name) or (table name)
DDLC_7 (user) Rename table (new name) or (old name)
DDLC_8 (user) Create trigger (name) or (table name)
DDLC_9 (user) drop trigger (name) or (table name)
</screen>
<screen>
CSLQ_0 (user) (IP) (peer) (sql)
</screen>
<screen>
ERRS_0 (code) (server code) (error text)
</screen>
<screen>
DSNL_0 (dsn) (sql)
DSNL_1 Disconnecting DSN (name)
DSNL_2 (user) (IP) Registration remote data source (name)
DSNL_3 (user) Disconnect remote data source (name)
</screen>
<screen>
DSNS_0 (dsn) (sql) (prepare)
DSNS_1 (dsn) (sql) (execute)
</screen>
<screen>
LTRS_0 (user) (from) (peer) Begin transact tnx
LTRS_1 (user) (from) (peer) (Commit / Rollback) transact txn
LTRS_2 (user) (from) (peer) Restart transact txn
</screen>
<screen>
RTRS_0 (user) (from) (peer) (dsn) Begin transact tnx autocommit: (on/off)
RTRS_1 (user) (from) (peer) (dsn) (Commit / Rollback) transact tnx autocommit: (on/off)
</screen>
<screen>
EXEC_0 (user) (from) (peer) Exec cursor (stmt)
EXEC_1 (user) (from) (peer) (stmt) Exec (n) time(s)
</screen>
<screen>
SOAP_0 (request)
SOAP_1 (response)
</screen>
</refsect1>
<refsect1 id="errors_trace_on"><title>Errors</title>
<table><title>Errors signalled by <function>trace_on</function></title>
<tgroup cols="3">
<thead>
<row>
<entry>SQLState</entry><entry>Error Code</entry><entry>Error Text</entry>
</row>
</thead>
<tbody>
<row>
<entry><errorcode>22005</errorcode></entry>
<entry><errorcode>SR322</errorcode></entry>
<entry><errorname>"option" is not valid trace_on option</errorname></entry>
</row>
</tbody>
</tgroup>
</table>
<para></para>
</refsect1>
<refsect1 id="examples_trace_on">
<title>Examples</title>
<example id="ex_trace_on"><title>Simple example</title>
<para>To show users logging in to the server and failed user logins</para>
<screen>
SQL> trace_on ('user_log', 'failed_log');
Done. -- 0 msec.
SQL>
The server console and log file may thus contain lines such as:
...
17:17:24 Server online at 1111 (pid 2173)
17:17:36 USER_0 0 xxx.xx.xx.xxx 1111:2 logout
17:17:40 USER_1 0 xxx.xx.xx.xxx 1111:3 login
17:17:45 USER_0 0 xxx.xx.xx.xxx 1111:3 logout
17:18:04 FAIL_0 dba xxx.xx.xx.xxx
...
</screen>
</example>
</refsect1>
<refsect1 id="seealso_trace_on"><title>See Also</title>
<para><link linkend="fn_trace_off"><function>trace_off()</function></link></para>
<para><link linkend="fn_trace_status"><function>trace_status()</function></link></para>
</refsect1>
</refentry>
|