Good afternoon:
We use a product on AIX box, which uses Informix IDS 9.4 as database.
We would like to enable EXPLAIN on for certain users for the whole
session. Is there an Unix shell variable which when set thru .profile,
can capture the information about all SQLs that ran from that Unix
Session.
Thank you in advance for your inputs.
Jim
↪ replying to goggleaccount@dodgeit.com
goggleaccount@dodgeit.com wrote:
> Good afternoon:
>
> We use a product on AIX box, which uses Informix IDS 9.4 as database.
> We would like to enable EXPLAIN on for certain users for the whole
> session. Is there an Unix shell variable which when set thru .profile,
> can capture the information about all SQLs that ran from that Unix
> Session.
No. If you cannot change the application to do this, perhaps in response to
an environment var you define yourself, you can use:
onmode -Y session_id 1 # Turn on SET EXPLAIN for a session
onmode -Y session_id 0 # Turn off SET EXPLAIN
However, it will not capture any queries prepared prior to issuing the
command. You could try to start the set explain ASAP with a startup script
for the app something like:
#!/usr/bin/ksh
run_my_app &
pid=$!
onmode -Y $(onstat -g ses|fgrep " $pid "|cut -d\\ -f 1) 1
You might need a 'sleep 1' before the onmode to make sure the task has
connected to the server, and this will only work if the task is being run on
the same machine as the server.
Art S. Kagel