Display statistics on sessions executing SQL statements
The output of the onstat -g sql command contains statistics on the SQL statements executed by the session
To obtain information about the last SQL statement that each session executed, issue the onstat -g sql command with the appropriate session ID.
Figure 1 shows sample
output for this option using the same session ID obtained from the onstat
-u sample in Figure 1.
Figure 1. onstat
-g sql output
onstat -g sql 15
Sess SQL Current Iso Lock SQL ISAM F.E.
Id Stmt type Database Lvl Mode ERR ERR Vers
15 SELECT vjp_stores CR Not Wait 0 0 9.03
Current statement name : slctcur
Current SQL statement :
select l.customer_num, l.lname, l.company, l.phone, r.call_dtime,
r.call_descr from customer l, vjp_stores@gilroy:cust_calls r where
l.customer_num = r.customer_num
Last parsed SQL statement :
select l.customer_num, l.lname, l.company, l.phone, r.call_dtime,
r.call_descr from customer l, vjp_stores@gilroy:cust_calls r where
l.customer_num = r.customer_num