按不同的顺序delete,就会发生死锁啊
T1时刻:
session 1:
e95fp7@suse1:~> db2 +c "delete from test1 where c1=1"
DB20000I The SQL command completed successfully.
session 2:
e95fp7@suse1:~> db2 +c "delete from test1 where c1=2"
DB20000I The SQL command completed successfully.
T2时刻:
session 1:
e95fp7@suse1:~> db2 +c "delete from test1 where c1=2"
session 2:
e95fp7@suse1:~> db2 +c "delete from test1 where c1=1"
DB21034E The command was processed as an SQL statement because it was not a
valid Command Line Processor command. During SQL processing it returned:
SQL0911N The current transaction has been rolled back because of a deadlock
or timeout. Reason code "2". SQLSTATE=40001
收起