Oracle® Database Administrator's Guide 11g Release 1 (11.1) Part Number B28310-01 |
|
|
View PDF |
The data dictionary of each database stores information about all open distributed transactions. You can use data dictionary tables and views to gain information about the transactions. This section contains the following topics:
The following view shows the database links that have been defined at the local database and stored in the data dictionary:
View | Purpose |
---|---|
DBA_2PC_PENDING |
Lists all in-doubt distributed transactions. The view is empty until populated by an in-doubt transaction. After the transaction is resolved, the view is purged. |
Use this view to determine the global commit number for a particular transaction ID. You can use this global commit number when manually resolving an in-doubt transaction.
The following table shows the most relevant columns (for a description of all the columns in the view, see Oracle Database Reference):
Table 33-1 DBA_2PC_PENDING
Execute the following script, named pending_txn_script
, to query pertinent information in DBA_2PC_PENDING
(sample output included):
COL LOCAL_TRAN_ID FORMAT A13 COL GLOBAL_TRAN_ID FORMAT A30 COL STATE FORMAT A8 COL MIXED FORMAT A3 COL HOST FORMAT A10 COL COMMIT# FORMAT A10 SELECT LOCAL_TRAN_ID, GLOBAL_TRAN_ID, STATE, MIXED, HOST, COMMIT# FROM DBA_2PC_PENDING / SQL> @pending_txn_script LOCAL_TRAN_ID GLOBAL_TRAN_ID STATE MIX HOST COMMIT# ------------- ------------------------------ -------- --- ---------- ---------- 1.15.870 HQ.ACME.COM.ef192da4.1.15.870 commit no dlsun183 115499
This output indicates that local transaction 1.15.870
has been committed on this node, but it may be pending on one or more other nodes. Because LOCAL_TRAN_ID
and the local part of GLOBAL_TRAN_ID
are the same, the node is the global coordinator of the transaction.
The following view shows which in-doubt transactions are incoming from a remote client and which are outgoing to a remote server:
When a transaction is in-doubt, you may need to determine which nodes performed which roles in the session tree. Use to this view to determine:
All the incoming and outgoing connections for a given transaction
Whether the node is the commit point site in a given transaction
Whether the node is a global coordinator in a given transaction (because its local transaction ID and global transaction ID are the same)
The following table shows the most relevant columns (for an account of all the columns in the view, see Oracle Database Reference):
Table 33-2 DBA_2PC_NEIGHBORS
Column | Description |
---|---|
|
Local transaction identifier with the format integer.integer.integer. Note: When |
|
|
|
For incoming transactions, the name of the client database that requested information from this local node; for outgoing transactions, the name of the database link used to access information on a remote server. |
|
For incoming transactions, the local account used to connect by the remote database link; for outgoing transactions, the owner of the database link. |
|
When When |
Execute the following script, named neighbors_script
, to query pertinent information in DBA_2PC_PENDING
(sample output included):
COL LOCAL_TRAN_ID FORMAT A13
COL IN_OUT FORMAT A6
COL DATABASE FORMAT A25
COL DBUSER_OWNER FORMAT A15
COL INTERFACE FORMAT A3
SELECT LOCAL_TRAN_ID, IN_OUT, DATABASE, DBUSER_OWNER, INTERFACE
FROM DBA_2PC_NEIGHBORS
/
SQL> CONNECT SYS/password@hq.acme.com
SQL> @neighbors_script
LOCAL_TRAN_ID IN_OUT DATABASE DBUSER_OWNER INT
------------- ------ ------------------------- --------------- ---
1.15.870 out SALES.ACME.COM SYS C
This output indicates that the local node sent an outgoing request to remote server sales
to commit transaction 1.15.870
. If sales
committed the transaction but no other node did, then you know that sales
is the commit point site, because the commit point site always commits first.