|
|
The DBMS_TRANSACTION package provides a programmatic interface to a number of the SQL transaction statements. The majority of these procedures (advise_commit through rollback_force) have SQL equivalents that you can invoke directly from within PL/SQL. Thus, many PL/SQL programmers choose to use the SQL equivalents rather than these procedures. However, the last five procedures (begin_discrete_transaction through step_id) have no equivalents and
The ADVISE_COMMIT procedure specifies that "commit" in-doubt transaction advice is sent to remote databases during distributed transactions.
The advice generated by this procedure appears on the remote database in the ADVICE column of the DBA_2PC_PENDING data dictionary view if the distributed transaction becomes in-doubt (i.e., a network or machine failure occurs during the commit). The remote database administrator can then review the DBA_2PC_PENDING information and manually commit or roll back in-doubt transactions using the FORCE clause of the COMMIT or ROLLBACK commands. Each call to an ADVISE procedure remains in effect for the duration of that connection or until a different
This procedure is equivalent to the SQL command, ALTER SESSION ADVISE COMMIT. The specification is:
PROCEDURE DBMS_TRANSACTION.ADVISE_COMMIT;
The ADVISE_NOTHING procedure specifies that no in-doubt transaction advice is sent to remote databases during distributed transactions. Advice is handled as described for ADVISE_COMMIT. This procedure is equivalent to the SQL command, ALTER SESSION ADVISE NOTHING. The specification is:
PROCEDURE DBMS_TRANSACTION.ADVISE_NOTHING;
The ADVISE_ROLLBACK procedure specifies that "rollback" in-doubt transaction advice is sent to remote databases during distributed transactions. Advice is handled as described for ADVISE_COMMIT. This procedure is equivalent to the SQL command, ALTER SESSION ADVISE ROLLBACK. The specification is:
PROCEDURE DBMS_TRANSACTION.ADVISE_ROLLBACK;
The COMMIT procedure ends the current transaction and makes permanent all pending changes. It also erases savepoints and releases all locks. It is provided primarily for completeness. It is equivalent to the COMMIT command, which is already implemented as part of PL/SQL. I recommend using the SQL command rather than the procedure. The specification is:
PROCEDURE DBMS_TRANSACTION.COMMIT;
The COMMIT_COMMENT procedure
PROCEDURE DBMS_TRANSACTION.COMMIT_COMMENT (cmnt VARCHAR2);
The COMMIT_FORCE procedure manually commits local in-doubt, distributed transactions. Any decisions to force in-doubt transactions should be made after consulting with the database administrator(s) at the remote database location(s). If the decision is made to locally force any transactions, the database administrator should either commit or rollback such transactions as was done by nodes that successfully resolved the transactions. Otherwise, the administrator should query the DBA_2PC_PENDING views ADVICE and TRAN_COMMENT
[2] For more information on this topic, see "Manually Overriding In-Doubt Transactions" in Oracle8 Server Distributed Systems .
PROCEDURE DBMS_TRANSACTION.COMMIT_FORCE (xid VARCHAR2, scn VARCHAR2 DEFAULT NULL);
The READ_ONLY procedure establishes the current transaction as a read-consistent transaction (i.e., repeatable reads). Once a transaction is designated as read-only, all queries within that transaction can only see changes committed prior to that transactions start. Thus, read-only transactions let you issue two or more queries against tables that may be undergoing concurrent
PROCEDURE DBMS_TRANSACTION.READ_ONLY;
The READ_WRITE procedure establishes the current transaction as a read-write transaction. This is the default transaction mode. This procedure is equivalent to the SQL command, SET TRANSACTION READ WRITE. The specification is:
PROCEDURE DBMS_TRANSACTION.READ-WRITE;
The ROLLBACK procedure ends the current transaction and undoes all pending changes. It also erases savepoints and releases all locks. It is provided primarily for completeness. It is equivalent to the ROLLBACK command, which is already implemented as part of PL/SQL. I recommend using the SQL command rather than the procedure. The specification is:
PROCEDURE DBMS_TRANSACTION.ROLLBACK;
The ROLLBACK_FORCE procedure manually rolls back local in-doubt, distributed transactions. The parameter identifies the transaction's local or global transaction ID. To find these transaction IDs, query the data dictionary view DBA_2PC_PENDING. Any decisions to force in-doubt transactions should be made after consulting with the database administrator(s) at the remote database location(s), as described for COMMIT_FORCE. This procedure is equivalent to the SQL command, ROLLBACK FORCE. The specification is:
PROCEDURE DBMS_TRANSACTION.ROLLBACK_FORCE (xid VARCHAR2);
The ROLLBACK_SAVEPOINT procedure rolls back the current transaction to a previously declared savepoint. It is provided primarily for completeness. It is equivalent to the ROLLBACK SAVEPOINT command, which is already implemented as part of PL/SQL. I recommend using the SQL command rather than the procedure. The specification is:
PROCEDURE DBMS_TRANSACTION.ROLLBACK_SAVEPOINT;
The SAVEPOINT procedure identifies a logical point within a transaction to which you can later roll back. It is provided primarily for completeness. It is equivalent to the SAVEPOINT command, which is already implemented as part of PL/SQL. I recommend using the SQL command rather than the procedure. The specification is:
PROCEDURE DBMS_TRANSACTION.SAVEPOINT;
The USE_ROLLBACK_SEGMENT procedure
PROCEDURE DBMS_TRANSACTION.USE_ROLLBACK_SEGMENT (rb_name VARCHAR2);
The BEGIN_DISCRETE_TRANSACTION procedure streamlines transaction processing so short transactions can execute more
[3] For more information on this topic, see "Using Discrete Transactions" in Oracle8 Server Tuning .
PROCEDURE DBMS_TRANSACTION.BEGIN_DISCRETE_TRANSACTION;
The PURGE_MIXED procedure deletes information about a given in-doubt, distributed transaction that has had mixed
[4] For more information on this topic, see "Manually Overriding In-Doubt Transactions" in Oracle8 Server Distributed Systems .
PROCEDURE DBMS_TRANSACTION.PURGE_MIXED (xid VARCHAR2);
The PURGE_LOST_DB procedure deletes information about a given in-doubt, distributed transaction that has had mixed outcomes due to a lost database. This occurs when an in-doubt, distributed transaction is able to commit or roll back on one node and other nodes have either
PROCEDURE DBMS_TRANSACTION.PURGE_LOST_DB (xid VARCHAR2);
The LOCAL_TRANSACTION_ID function returns the unique identifier for the current transaction. The function returns NULL if there is no current transaction. The specification is:
FUNCTION DBMS_TRANSACTION.LOCAL_TRANSACTION_ID (create_transaction BOOLEAN := false) RETURN VARCHAR2;
The STEP_ID function returns the unique positive integer that orders the DML operations of the current transaction. The specification is:
FUNCTION DBMS_TRANSACTION.STEP_ID RETURN VARCHAR2;
|
|
|
|
| C.14 DBMS_SQL |
|
C.16 DBMS_UTILITY |
Copyright (c) 2000 O'Reilly & Associates. All rights reserved.