13-Jul-2008: Network trace in Oracle RDBMS

There're well-known parameters trace_level_server and trace_level_client in sqlnet.ora, which are defining debugging level of trace files.

A lot of network functions may call a special trace writer function which put passed information into trace file.

Usually, software developer with common sense makes trace writer function checking current debug level and let this tracer writer decide if to write any information to file. In this case his code is relatively clean and clear.

Oracle RDBMS developers make decision about this before trace writer function called, so code may looks like:

if (trace_is_enabled) write_to_trace (current_function_name, trace_level, message);

Most likely, this code is actually written using #define macros.

At least, Oracle 8.1.5 win32 installation contain C:\Oracle\Ora81\NETWORK\TNSAPI\SRC\ folder where TNSAPI.C file may be found: it contain some trace writer calls using macros, although, I cannot found there a macros definition.

For example:

    /* enable the tracing */
		/* it is an explicit NVstring, so use it directly */
		NLTRUSR((NLTRTRC, "Name is already an NVstring.\n"));
		    NLTRUSR((NLTRTRC, "Name is %s.\n", hdl->service_tnshdl));

So, in this case, code is not so clear, but here we can see time economy at the place of trace writer function prolog and epilog. Not a bad idea at all.

This open sourced site and this page in particular is hosted on GitHub. Patches, suggestions and comments are welcome.

→ [list of blog posts, my twitter/facebook]

The page last updated on 27-April-2016