While supporting a high-volume transaction period in our
shop, I noticed that db2top Start Date and Start Time (option d for database)
showed a very recent date and time. I was 100% sure that the DB was not
restarted or activated recently.
[-]19:57:36,refresh=2secs(0.002) Database
AIX,member=[1/1],DB2INST1:MYDB
lqqqqqqqqqqqqqqwqqqqqqqqqqqqwqqqqqqqqqqqqwqqqqqqqqqqqqwqqqqqqqqqqqk
x x 25%x 50%x 75%x 100%x
xMaxActSess x
x
xSortMemory x x
xLogUsed x-
x
xFCM
BufLow x
x
mqqqqqqqqqqqqqqvqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqqj
Start Date Start
Time Status Shthres
Buffers FCMBuf OtherMem
2017/11/25 09:23:44
Active 0 16.4G
768.0K 2.2G
Sessions ActSess
LockUsed LockEscals Deadlocks LogReads
LogWrites
48 0 0% 0 0 0 0
L_Reads P_Reads
HitRatio A_Reads Writes
A_Writes Lock Wait
7,197 0
100.00% 0.00% 0 0 0
Sortheap SortOvf PctSortOvf AvgPRdTime AvgDRdTime
AvgPWrTime AvgDWrTime
20.0K 3
2.50% 0.00 0.00 0.00 0.00
My co-worker did some research and gave a beautiful
explanation. Thanks Mr. Manoj. Here it is.
This command gives you info on when the DB was deactivated/activated.
But there are some caveats, read carefully:
Go to the db2diaglog path and issue this.
cat db2diag.log|grep -ip "FUNCTION: DB2 UDB, base sys
utilities, sqeLocalDatabase::FreeResourcesOnDBShutdown"
The output will look something like this. Give attention to
the last line in each paragraph:
2017-10-17-15.52.19.081050-240 E1495007A440 LEVEL: Event
PID :
15073374 TID : 26036 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB
: MYDB
APPHDL : 0-3
HOSTNAME: myhost
EDUID :
26036 EDUNAME: db2agent
(idle) 0
FUNCTION: DB2 UDB, base sys utilities,
sqeLocalDatabase::FreeResourcesOnDBShutdown, probe:15579
STOP : DATABASE: MYDB : DEACTIVATED: YES
2017-10-24-07.35.32.144318-240 E110103488A527 LEVEL: Event
PID : 33572592 TID : 29101 PROC : db2sysc 0
INSTANCE: db2inst1 NODE : 000 DB
: MYDB
APPHDL : 0-29188 APPID: 100.00.000.00.12345.171024112052
AUTHID : myid HOSTNAME: myhost
EDUID :
29301 EDUNAME: db2agent
(idle) 0
FUNCTION: DB2 UDB, base sys utilities,
sqeLocalDatabase::FreeResourcesOnDBShutdown, probe:15579
STOP : DATABASE: MYDB : DEACTIVATED: NO
2017-11-25-09.23.43.726522-300
E261286318A515 LEVEL: Event
PID : 33572592
TID : 40505 PROC :
db2sysc 0
INSTANCE: db2inst1
NODE : 000
DB : MYDB
APPHDL :
0-52137
APPID: 172.16.104.17.38242.171125142340
AUTHID : MYID
HOSTNAME: myhost
EDUID :
40505
EDUNAME: db2agent (mydb) 0
FUNCTION: DB2 UDB, base sys utilities,
sqeLocalDatabase::FirstConnect, probe:1000
START
: DATABASE: MYDB : ACTIVATED: NO
ACTIVATED or DEACTIVATED “YES” means, the database has
been activated or deactivated by an user that has the access to do it, such a
DBA or System Admin.
ACTIVATED “NO” means, the database has been activated by
DB2 automatically when the database was not started manually, and a CONNECT TO
(or an implicit connect) has been issued in an application.
DEACTIVATED “NO” means, the database has been deactivated
by DB2 automatically when the last application has disconnected from the DB.
Best practice is to activate the DB manually as soon as the
database is started.