|Oracle® Database Administrator's Guide
11g Release 2 (11.2)
|PDF · Mobi · ePub|
To observe RECO automatically resolving the local portion of the transaction
To practice manually resolving in-doubt distributed transactions and observing the results
This section describes the features available and the steps necessary to perform such operations.
You can include comments in the
COMMENT parameter of the
COMMIT statement. To intentionally induce a failure during the two-phase commit phases of a distributed transaction, include the following comment in the
COMMIT COMMENT 'ORA-2PC-CRASH-TEST-n';
where n is one of the following integers:
|1||Crash commit point after collect|
|2||Crash non-commit-point site after collect|
|3||Crash before prepare (non-commit-point site)|
|4||Crash after prepare (non-commit-point site)|
|5||Crash commit point site before commit|
|6||Crash commit point site after commit|
|7||Crash non-commit-point site before commit|
|8||Crash non-commit-point site after commit|
|9||Crash commit point site before forget|
|10||Crash non-commit-point site before forget|
For example, the following statement returns the following messages if the local commit point strength is greater than the remote commit point strength and both nodes are updated:
COMMIT COMMENT 'ORA-2PC-CRASH-TEST-7'; ORA-02054: transaction 1.93.29 in-doubt ORA-02059: ORA_CRASH_TEST_7 in commit comment
At this point, the in-doubt distributed transaction appears in the
DBA_2PC_PENDING view. If enabled, RECO automatically resolves the transaction.
The RECO background process of an Oracle Database instance automatically resolves failures involving distributed transactions. At exponentially growing time intervals, the RECO background process of a node attempts to recover the local portion of an in-doubt distributed transaction.
RECO can use an existing connection or establish a new connection to other nodes involved in the failed transaction. When a connection is established, RECO automatically resolves all in-doubt transactions. Rows corresponding to any resolved in-doubt transactions are automatically removed from the pending transaction table of each database.
You can enable and disable RECO using the
ALTER SYSTEM statement with the
DISABLE DISTRIBUTED RECOVERY options. For example, you can temporarily disable RECO to force the failure of a two-phase commit and manually resolve the in-doubt transaction.
ALTER SYSTEM DISABLE DISTRIBUTED RECOVERY;
Alternatively, the following statement enables RECO so that in-doubt transactions are automatically resolved:
ALTER SYSTEM ENABLE DISTRIBUTED RECOVERY;
Note:Single-process instances (for example, a PC running MS-DOS) have no separate background processes, and therefore no RECO process. Therefore, when a single-process instance that participates in a distributed system is started, you must manually enable distributed recovery using the preceding statement.