Enable SQL tracing

After you specify user as the mode in the SQLTRACE configuration parameter, you must run the SQL administration API task() or admin() function to turn SQL history tracing on for a particular user.

You must be connected to the sysadmin database as user informix or another authorized user.

Global SQL tracing is not required to be enabled to allow SQL tracing for a particular user.

To enable SQL tracing for a particular user, run the SQL administration API task() or admin() function with set sql tracing on as the first argument and the user session ID as the second argument.

To enable user SQL tracing for all users except root or informix, you can run a task() or admin() function with the set sql tracing on argument and information that defines the users.

Example

The following example enables SQL tracing for the user with the session ID of 74:
EXECUTE FUNCTION task("set sql user tracing on", 74); 

The following example enables the tracing of SQL statements of users who are currently connected to the system as long as they are not logged in as user root or informix.

dbaccess sysadmin -<<END  
 execute function task("set sql tracing on", 1000, 1,"low","user");
 select task("set sql user tracing on", sid)
 	FROM sysmaster:syssessions 	
  WHERE username not in ("root","informix"); 
END

For more information about the task() and admin() functions, see the HCL Informix® Administrator's Reference.


Copyright© 2019 HCL Technologies Limited