If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > DB2 > OS User Id information

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 12-04-08, 13:21
rmarzullo rmarzullo is offline
Registered User
 
Join Date: May 2007
Posts: 56
OS User Id information

I am running DB2 ESE v9.1.4 on Windows 64 bits server.
I would like ot know if there is any way (if any simple) to obtain OS User Id information which is connecting / accessing information against DB2 database. I can see this information for example on tools cush as DB2 Monitor (freeware tool). So I know it is possible somehow.

Customer requested to have this information at application level so that they can store who is doing what (without audit tables).

Could anyone help me please?

Thanks
Reply With Quote
  #2 (permalink)  
Old 12-04-08, 13:46
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Snapshot functions?

select * from table (snapshot_appl_info('YOURDB', -1)) t
Reply With Quote
  #3 (permalink)  
Old 12-04-08, 14:29
rmarzullo rmarzullo is offline
Registered User
 
Join Date: May 2007
Posts: 56
Thanks Nick!
It worked like a Champ! That's exactly what I was looking for.

One question though, I don't need to run any "get snapshot for application" before issuing this SQL in order to refresh those snapshot tables right?
I mean if I connect to a database and I want to know who is accessing (is terms of user id) I don't need to "refresh this table?

Regards
Reply With Quote
  #4 (permalink)  
Old 12-04-08, 14:35
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
No, you don't need to refresh anything, it retrieves the monitor data dynamically.
Reply With Quote
  #5 (permalink)  
Old 12-05-08, 05:36
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
If you just want to know the users connected, you can also try the following on shell prompt:

db2 "list applications show detail" | awk '{print $1}'
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
  #6 (permalink)  
Old 12-05-08, 08:18
n_i n_i is offline
:-)
 
Join Date: Jun 2003
Location: Toronto, Canada
Posts: 4,449
Quote:
Originally Posted by JAYANTA_DATTA
db2 "list applications show detail" | awk '{print $1}'
Just curious, why do you use "show detail" if you are only extracting the first column anyway?
Reply With Quote
  #7 (permalink)  
Old 12-05-08, 17:12
Marcus_A Marcus_A is offline
Registered User
 
Join Date: May 2003
Location: USA
Posts: 5,196
Separately, I noticed in 9.5 (not sure about 9.1) they finally got rid of the hex values of the client IP address on the list applications command and display it in normal decimal format.
__________________
M. A. Feldman
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
IBM Certified DBA on DB2 for z/OS and OS/390
Reply With Quote
  #8 (permalink)  
Old 12-07-08, 03:54
JAYANTA_DATTA JAYANTA_DATTA is offline
Registered User
 
Join Date: Oct 2004
Location: DELHI INDIA
Posts: 336
Quote:
Originally Posted by n_i
Just curious, why do you use "show detail" if you are only extracting the first column anyway?

No extra significance. Just put the complete command, "show detail" can be ignored. Thanks for pointing out.
__________________

Jayanta Datta
DB2 UDB DBA
IBM India, Global Delivery
New Delhi
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On