WEB开发网
开发学院数据库Oracle DB2和 Oracle的并发控制(锁)比较 阅读

DB2和 Oracle的并发控制(锁)比较

 2008-09-08 12:53:33 来源:WEB开发网   
核心提示: db2 select * from table(snapshot_lock('DBNAME',-1)) as locktable监控锁信息db2 select * from table(snapshot_lockwait('DBNAME',-1) as lo

db2 select * from table(snapshot_lock('DBNAME',-1)) as locktable监控锁信息

db2 select * from table(snapshot_lockwait('DBNAME',-1) as lock_wait_table监控应用程序锁等待的信息

4.2 事件监控方式:

当使用事件监控器进行锁的监控时候,只能监控死锁(死锁的产生是因为由于锁请求冲突而不能结束事务,并且该请求冲突不能够在本事务内解决。通常是两个应用程序互相持有对方所需要的锁,在得不到自己所需要的锁的情况下,也不会释放现有的锁)的情况,具体步骤如下:

db2 create event monitor dlock for deadlocks with details write to file '$HOME/dir'

db2 set event monitor dlock state 1

db2evmon -db dbname -evm dlock看具体的死锁输出(如下图)

   Deadlocked Connection ...
 Deadlock ID:  4
 Participant no.: 1
 Participant no. holding the lock: 2
 Appl Id: G9B58B1E.D4EA.08D387230817
 Appl Seq number: 0336
 Appl Id of connection holding the lock: G9B58B1E.D573.079237231003
 Seq. no. of connection holding the lock: 0126
 Lock wait start time: 06/08/2005 08:10:34.219490
 Lock Name    : 0x000201350000030E0000000052
 Lock Attributes : 0x00000000
 Release Flags  : 0x40000000
 Lock Count   : 1
 Hold Count   : 0
 Current Mode  : NS - Share (and Next Key Share)
 Deadlock detection time: 06/08/2005 08:10:39.828792
 Table of lock waited on   : ORDERS
 Schema of lock waited on   : DB2INST1
 Tablespace of lock waited on : USERSPACE1
 Type of lock: Row
 Mode of lock: NS - Share (and Next Key Share)
 Mode application requested on lock: X  - Exclusive
 Node lock occured on: 0
 Lock object name: 782
 Application Handle: 298
 Deadlocked Statement:
  Type   : Dynamic
  Operation: Execute
  Section : 34
  Creator : NULLID
  Package : SYSSN300
  Cursor  : SQL_CURSN300C34
  Cursor was blocking: FALSE
  Text   : UPDATE ORDERS SET TOTALTAX = ?, TOTALSHIPPING = ?,
  LOCKED = ?, TOTALTAXSHIPPING = ?, STATUS = ?, FIELD2 = ?, TIMEPLACED = ?,
  FIELD3 = ?, CURRENCY = ?, SEQUENCE = ?, TOTALADJUSTMENT = ?, ORMORDER = ?,
  SHIPASCOMPLETE = ?, PROVIDERORDERNUM = ?, TOTALPRODUCT = ?, DESCRIPTION = ?,
  MEMBER_ID = ?, ORGENTITY_ID = ?, FIELD1 = ?, STOREENT_ID = ?, ORDCHNLTYP_ID = ?,
  ADDRESS_ID = ?, LASTUPDATE = ?, COMMENTS = ?, NOTIFICATIONID = ? WHERE ORDERS_ID = ?
 List of Locks:
   Lock Name          : 0x000201350000030E0000000052
   Lock Attributes       : 0x00000000
   Release Flags        : 0x40000000
   Lock Count         : 2
   Hold Count         : 0
   Lock Object Name      : 782
   Object Type         : Row
   Tablespace Name       : USERSPACE1
   Table Schema        : DB2INST1
   Table Name         : ORDERS
   Mode            : X  - Exclusive
   Lock Name          : 0x00020040000029B30000000052
   Lock Attributes       : 0x00000020
   Release Flags        : 0x40000000
   Lock Count         : 1
   Hold Count         : 0
   Lock Object Name      : 10675
   Object Type         : Row
   Tablespace Name       : USERSPACE1
   Table Schema        : DB2INST1
   Table Name         : BKORDITEM
   Mode            : X  - Exclusive(略去后面信息)

5 Oracle 多粒度封锁机制的监控

为了监控Oracle系统中锁的状况,我们需要对几个系统视图有所了解:

上一页  5 6 7 8 9 10 

Tags:DB Oracle 并发

编辑录入:爽爽 [复制链接] [打 印]
赞助商链接