Hi friends
What is the best way to keep track of number of users logged into
database everyday.
Where does db2 store user connection information ? does it keep a log
of user connections?
meaning can i say, on last monday who logged in to database and when ?
Thanks in advance for repliers.
I appreciate your help.
rick
Dave Hughes - 26 Mar 2008 15:15 GMT
> Hi friends
>
[quoted text clipped - 11 lines]
>
> rick
The DB2 audit facility [1] is one possible way to do this (although it
might be overkill). It includes the ability to track successful and
unsuccessful access attempts to the database or objects within the
database. The results are stored in a log file which can be loaded into
a table [2] for analysis (e.g. to extract only those records related to
database access attempts). Specifically, I think you'd want to look at
CHECKING records [3] with the CONNECT access type where the event
status is >= 0 (i.e. successful connection; <0 would indicate a failed
connection attempt).
[1]
http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb
.admin.doc/doc/c0005483.htm
[2]
http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb
.admin.doc/doc/t0011540.htm
[3]
http://publib.boulder.ibm.com/infocenter/db2luw/v9/topic/com.ibm.db2.udb
.admin.doc/doc/r0005640.htm
Cheers,
Dave.
stefan.albert - 26 Mar 2008 15:26 GMT
Hi Rick,
connection information is not stored (unless you have audit
enabled...)
You can get the current users logged on with "db2 list applications
[show detail]"
You can also get a complete list of all logons with the help on the
event monitor for connections.
There you have the information you want:
* logon time, names, some environment (see **1)
* logoff time, cpu usage, etc... (see **2)
But it's a bit unhandy to retrieve the information you want...
**1 )))))))))))))))))))))))))))))))))))))))))))))))))
4) Connection Header Event ...
Appl Handle: 969
Appl Id: *N0.dwhprod.080325230005
Appl Seq number: 0001
DRDA AS Correlation Token: *N0.dwhprod.080325230005
Program Name : db2bp
Authorization Id: DWHPROD
Execution Id : dwhprod
Codepage Id: 819
Territory code: 0
Client Process Id: 4853950
Client Database Alias: DWHDB
Client Product Id: SQL08029
Client Platform: Unknown
Client Communication Protocol: Local
Client Network Name: apdwh1.nbg.sdv.sdvrz
Connect timestamp: 03/26/2008 00:00:02.824930
**2 )))))))))))))))))))))))))))))))))))))))))))))))))
5) Connection Event
Appl Handle: 616
Appl Id: *N0.dwhprod.080325230002
Appl Seq number: 0006
Record is the result of a flush: FALSE
Application Status: SQLM_UOWWAIT
Lock Statistics:
Lock Waits: 0
Total time waited on locks (milliseconds): 0
Deadlocks: 0
Lock escalations: 0
X lock escalations: 0
Lock timeouts: 0
Sort Statistics:
Sorts: 0
Total sort time (milliseconds): 0
Sort overflows: 0
Hash Statistics:
Hash Joins: 0
Hash Loops: 0
Hash Join Small Overflows: 0
Hash Join Overflows: 0
Buffer Pool Statistics:
Buffer pool logical data page reads: 568
Buffer pool physical data page reads: 0
Buffer pool data page writes: 0
Buffer pool logical index page reads: 578
Buffer pool physical index page reads: 0
Buffer pool index page writes: 0
Buffer pool read time (milliseconds): 0
Buffer pool write time (milliseconds): 0
Time spent waiting for a prefetch: 0 milliseconds
Unread prefetch pages: 0
Workspace Statistics:
Shared workspace high water mark: 109066224
Total shared workspace overflows: 0
Total shared workspace section lookups: 3
Total shared workspace section inserts: 2
Private workspace high water mark: 19484
Total private workspace overflows: 0
Total private workspace section lookups: 3
Total private workspace section inserts: 3
Direct I/O Statistics:
Sectors read directly: 0
Sectors written directly: 0
Direct read requests: 0
Direct write requests: 0
Direct read time: 0
Direct write time: 0
SQL Statement counts
Commit SQL statements: 4
Rollback SQL statements: 0
Dynamic SQL statements: 10
Static SQL stmts: 4
Failed SQL statements: 0
Select SQL statements: 1
Data Definition Language SQL statements: 1
Update/Insert/Delete SQL statements: 1
Internal counts
Internal auto rebinds: 0
Internal rows deleted: 0
Internal rows updated: 0
Internal rows inserted: 0
Internal commits: 1
Internal rollbacks: 0
Internal rollbacks due to deadlock: 0
Row counts
Rows deleted: 0
Rows inserted: 0
Rows updated: 0
Rows selected: 1
Rows read: 568
Rows written: 0
Binds/Precompiles: 0
Rejected block cursor requests: 0
Accepted block cursor requests: 0
Package Cache Statistics
Package Cache Lookups: 19
Package Cache Inserts: 3
Section Lookups: 10
Section Inserts: 5
Catalog Cache Statistics
Catalog Cache Overflows: 0
Catalog Cache High Water Mark: 0
Catalog Cache Lookups: 15
Catalog Cache Inserts: 0
CPU times
User CPU time: 0.023042 seconds
System CPU time: 0.003204 seconds
Memory usage:
Node Number: 0
Memory Pool Type: Application Heap
Current size (bytes): 147456
High water mark (bytes): 147456
Configured size (bytes): 33783808
Disconnection Time: 03/26/2008 00:00:05.013925
> Hi friends
>
[quoted text clipped - 11 lines]
>
> rick
rick - 26 Mar 2008 16:10 GMT
> Hi Rick,
>
[quoted text clipped - 162 lines]
>
> - Show quoted text -
Thanks a lot guys