Snapshot可以抓取某一個時間點下,monitor switches所收集的資料。因此在進行snapshot前,需先開啟monitor switches,這裡以lock的switch為例
db2 update monitor switches using lock on
接著查一下monitor switch是否被打開了
db2 get monitor switches
確定LOCK的switch被打開後,執行下列指令,就可以抓取LOCK這個monitor switches所收集的資料了
db2 get snapshot for locks on db_name
以下為範例結果
Database Lock Snapshot
Database name = SAMPLE
Database path = C:\DB2\NODE0000\SQL00001\
Input database alias = SAMPLE
Locks held = 5
Applications currently connected = 1
Agents currently waiting on locks = 0
Snapshot timestamp = 06-05-2002 17:08:25.048027
Application handle = 8
Application ID = *LOCAL.DB2.0098C5210749
Sequence number = 0001
Application name = db2bp.exe
CONNECT Authorization ID = DB2ADMIN
Application status = UOW Waiting
Status change time = Not Collected
Application code page = 1252
Locks held = 5
Total wait time (ms) = 0
List Of Locks
Lock Name = 0x02000300050000000000000052
Lock Attributes = 0x00000000
Release Flags = 0x00000001
Lock Count = 1
Hold Count = 0
Lock Object Name = 5
Object Type = Row
Tablespace Name = USERSPACE1
Table Schema = DB2ADMIN
Table Name = STAFF
Mode = U
Lock Name = 0x02000300000000000000000054
Lock Attributes = 0x00000000
Release Flags = 0x00000001
Lock Count = 1
Hold Count = 0
Lock Object Name = 3
Object Type = Table
Tablespace Name = USERSPACE1
Table Schema = DB2ADMIN
Table Name = STAFF
Mode = IX
Lock Name = 0x01000000010000000100810056
Lock Attributes = 0x00000000
Release Flags = 0x40000000
Lock Count = 1
Hold Count = 0
Lock Object Name = 0
Object Type = Internal Variation Lock
Mode = S
Lock Name = 0x41414141414A48520000000041
Lock Attributes = 0x00000000
Release Flags = 0x40000000
Lock Count = 1
Hold Count = 0
Lock Object Name = 0
Object Type = Internal Plan Lock
Mode = S
Lock Name = 0x434F4E544F4B4E310000000041
Lock Attributes = 0x00000000
Release Flags = 0x40000000
Lock Count = 1
Hold Count = 0
Lock Object Name = 0
Object Type = Internal Plan Lock
Mode = S
由上面的例子可以看到,目前資料有1個應用程式連接,而這個應用程式產生了5個lock,目前這個應用程式花費0秒在等lock
沒有留言:
張貼留言