By default, only the DBSA can view
onstat -g sql
syssqltrace
information. However, when the UNSECURE_ONSTAT configuration parameter
is set to
1
, all users can view this information.
Syntax:
You can specify one of the following invocations.
Invocation
Explanation
onstat -g sql
Displays a one line summary for each session
onstat -g sql
sessionid
Displays SQL information for a specific session
Note:
Encrypted
passwords and password hint parameters in encryption functions are
not shown. The following figure displays an encrypted password in
the
Last parsed SQL statement
field.
Figure 1.
onstat -g sql
command output for a completed SQL statement
onstat -g sql 22
Sess SQL Current Iso Lock SQL ISAM F.E. Current
Id Stmt type Database Lvl Mode ERR ERR Vers Explain Role
22 - test CR Not Wait 0 0 9.03 Off hr
Last parsed SQL statement :
select id, name, decrypt_char(ssn, 'XXXXXXXXXX') from emp
Sess SQL Current Iso Lock SQL ISAM F.E.
Id Stmt type Database Lvl Mode ERR ERR Vers Explain
28 SELECT sysmaster CR Not Wait 0 0 9.24 Off
Current statement name : unlcur
Current SQL statement (8) :
select * from systables, syscolumns, sysindexes
QUERY_TIMEOUT setting: 0 (No Timeout)
Clock time elapsed : 00:00:12
Last parsed SQL statement :
select * from systables, syscolumns, sysindexes
The
QUERY_TIMEOUT
setting and clock time are displayed only for running queries, not for DML or
DDL statements or administration operations.