Provides a list of transactions that are indoubt. You can interactively commit, roll back, or forget the indoubt transactions.
Forgetting a transaction releases resources held by a heuristically completed transaction (that is, one that has been committed or rolled back heuristically). An indoubt transaction is one which has been prepared, but not yet committed or rolled back.
This command returns a list of indoubt transactions on the executed node.
None
Database. If implicit connect is enabled, a connection to the default database is established.
A blank space must separate the command letter from its argument.
Before a transaction is committed, rolled back, or forgotten, the transaction data is displayed, and you are asked to confirm the action.
An indoubt transaction is a global transaction that was left in an indoubt state. This occurs when either the transaction manager (TM) or at least one resource manager (RM) becomes unavailable after successfully completing the first phase (that is, the PREPARE phase) of the two-phase commit protocol. The RMs do not know whether to commit or to roll back their branch of the transaction until the TM can consolidate its own log with the indoubt status information from the RMs when they again become available. An indoubt transaction can also exist in an MPP environment.
If LIST INDOUBT TRANSACTIONS is issued against the currently connected database, the command returns the information about the indoubt transactions in that database.
Only transactions whose status is indoubt (i), or missing commit acknowledgment (m), or missing federated commit acknowledgment (d) can be committed.
Only transactions whose status is indoubt (i), missing federated rollback acknowledgment (b), or ended (e) can be rolled back.
Only transactions whose status is committed (c), rolled back (r), missing federated commit acknowledgment (d), or missing federated rollback acknowledgment (b) can be forgotten.
In the commit phase of a two-phase commit, the coordinator node waits for commit acknowledgments. If one or more nodes do not reply (for example, because of node failure), the transaction is placed in missing commit acknowledgment state.
Indoubt transaction information is valid only at the time that the command is issued. After you are in interactive dialog mode, transaction status might change because of external activities. However, the output is not refreshed on the client if the status changes on the server. If this happens, and you attempt to process an indoubt transaction which is no longer in an appropriate state, an error message is displayed. You need to quit the interactive session and reissue the LIST INDOUBT TRANSACTIONS command with the WITH PROMPTING option to obtain the most current status.
$ db2 list indoubt transactions with prompting
1. originator: DB2 Enterprise Server Edition
appl_id: *LOCAL.DB2.130919175827 sequence_no: 0001 status: i
timestamp: 09/19/2013 13:58:35 auth_id: CASTELLE
log_full: n type: RM
xid: 00001D3400000008 0000000000010000 00000030
c/r/f/l/h/q: r 1
1. originator: DB2 Enterprise Server Edition
appl_id: *LOCAL.DB2.130919175827 sequence_no: 0001 status: i
timestamp: 09/19/2013 13:58:35 auth_id: CASTELLE
log_full: n type: RM
xid: 00001D3400000008 0000000000010000 00000030
Do you want to heuristically ROLLBACK this in-doubt transaction? (y/n) y
SQL0969N There is no message text corresponding to SQL error "-1725" in the
message file on this workstation. The error was returned from module
"SQLRR0AC" with original tokens "39". SQLSTATE=58005
SQL0998N Error occurred during transaction or heuristic processing. Reason
Code = "39". Subcode = "". SQLSTATE=58005
c/r/f/l/h/q:
The following is a sample interactive session: In-doubt Transactions for Database SAMPLE
1. originator: XA
appl_id: *LOCAL.DB2.95051815165159 sequence_no: 0001 status: i
timestamp: 05-18-1997 16:51:59 auth_id: SMITH log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F93DD A92F8C4FF3000000
0000BD
2. originator: XA
appl_id: *LOCAL.DATABASE.950407161043 sequence_no: 0002 status: i
timestamp: 04-07-1997 16:10:43 auth_id: JONES log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F95FE B62F8C4FF3000000
0000C1
.
.
.
Enter in-doubt transaction command or 'q' to quit.
e.g. 'c 1' heuristically commits transaction 1.
c/r/f/l/q: c 1
1. originator: XA
appl_id: *LOCAL.DB2.95051815165159 sequence_no: 0001 status: i
timestamp: 05-18-1997 16:51:59 auth_id: SMITH log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F93DD A92F8C4FF3000000
0000BD
Do you want to heuristically commit this in-doubt transaction ? (y/n) y
DB20000I "COMMIT INDOUBT TRANSACTION" completed successfully
c/r/f/l/q: c 5
DB20030E "5" is not a valid in-doubt transaction number.
c/r/f/l/q: l
In-doubt Transactions for Database SAMPLE
1. originator: XA
appl_id: *LOCAL.DB2.95051815165159 sequence_no: 0001 status: c
timestamp: 05-18-1997 16:51:59 auth_id: SMITH log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F93DD A92F8C4FF3000000
0000BD
2. originator: XA
appl_id: *LOCAL.DATABASE.950407161043 sequence_no: 0002 status: i
timestamp: 04-07-1997 16:10:43 auth_id: JONES log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F95FE B62F8C4FF3000000
0000C1
.
.
.
c/r/f/l/q: r 2
2. originator: XA
appl_id: *LOCAL.DATABASE.950407161043 sequence_no: 0002 status: i
timestamp: 04-07-1997 16:10:43 auth_id: JONES log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F95FE B62F8C4FF3000000
0000C1
Do you want to heuristically rollback this in-doubt transaction ? (y/n) y
DB20000I "ROLLBACK INDOUBT TRANSACTION" completed successfully
c/r/f/l/q: l 2
2. originator: XA
appl_id: *LOCAL.DATABASE.950407161043 sequence_no: 0002 status: r
timestamp: 04-07-1997 16:10:43 auth_id: JONES log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F95FE B62F8C4FF3000000
0000C1
c/r/f/l/q: f 2
2. originator: XA
appl_id: *LOCAL.DATABASE.950407161043 sequence_no: 0002 status: r
timestamp: 04-07-1997 16:10:43 auth_id: JONES log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F95FE B62F8C4FF3000000
0000C1
Do you want to forget this in-doubt transaction ? (y/n) y
DB20000I "FORGET INDOUBT TRANSACTION" completed successfully
c/r/f/l/q: l 2
2. originator: XA
appl_id: *LOCAL.DATABASE.950407161043 sequence_no: 0002 status: f
timestamp: 04-07-1997 16:10:43 auth_id: JONES log_full: n type: RM
xid: 53514C2000000017 00000000544D4442 00000000002F95FE B62F8C4FF3000000
0000C1
c/r/f/l/q: q