Re: db2 cmds: to display user querie

Re: db2 cmds: to display user querie

 

  

hi

use db2 Event monitor / snapshopts
example

# db2 "get dbm monitor switches"

DFT_MON_STMT - collecting SQL statements information

Listing applications connected to the database
db2 => list application

db2 => connect to dbname

db2 => update monitor switches using statement on
DB20000I The UPDATE MONITOR SWITCHES command completed successfully.

Creating SQL event monitor for capturing the SQL statements for the user
PAYMENT1:

db2 => create event monitor SQLNODE1_PAY1 for statements where
AUTH_ID='PAYMENT1' write to
file '/home/db2inst1/pay1_1' NONBLOCKED REPLACE ON NODE 1 LOCAL
DB20000I The SQL command completed successfully.
Activate the SQL event monitors for the user PAYMENT1: db2 => set event
monitor SQLNODE1_PAY1 state=1
DB20000I The SQL command completed successfully.
Checking status for the SQL event monitor switch:db2 => get monitor switches
SQL Statement Information (STATEMENT) = ON 05-22-2003
10:12:49.890612
db2 => select EVMONNAME,TARGET,NODENUM,MONSCOPE from syscat.eventmonitors

EVMONNAME TARGET NODENUM MONSCOPE
------------------ -------------------- ------- --------
SQLNODE1_PAY1 /home/db2inst1/pay1_1 1 L
SQLNODE1_PAY9 /home/db2inst1/pay9_1 1 L
SQLNODE2_PAY1 /home/db2inst1/pay1_2 2 L
SQLNODE2_PAY9 /home/db2inst1/pay9_2 2 L
Reporting Bad SQL Code Stopping the SQL collection for users PAYMENT1 and
PAYMENT9:db2 => set event monitor SQLNODE1_PAY1 state=0
DB20000I The SQL command completed successfully.
The generated file is a non-readable binary file. We will use the standard
DB2 system command db2evmon to format trace file to the readable format. >>
db2evmon -path /home/db2inst1/pay1_1 > sql_payment1_node1.txt
Reading /tmp/00000000.evt ...
check the text file for the sql statements

Regards
Thirumaran

----- Original Message -----
From: "ighiurea " <db2udbdba-ezmlmshield-x36533152.[Email address protected]
To: "LazyDBA Discussion" <[Email address protected]
Sent: Wednesday, July 28, 2004 12:16 AM
Subject: db2 cmds: to display user querie


> Hi,
> is it a way in db2 to find what querie each one of the users are
> running in db2 cvo, db2 list application /show detail seems useless at
> all ......!!!!
>
>
>
> Isabella
>
>
>
>
> ---------------------------------------------------------------------
> PLEASE CLICK REPLY-ALL TO SEND A REPLY TO EVERYONE
> website: http://www.LazyDBA.com
> To unsubscribe: http://www.lazydba.com/unsubscribe.html
> For additional commands, e-mail: db2udbdba-[Email address protected]
>


DB2 & UDB email list listserv db2-l LazyDBA home page