Reports information about active transactions.
sp_tranactions ["xid", xid_value] | ["state", {"heuristic_commit" | "heuristic_abort" | "prepared" | "indoubt"} [, "xactname"]] | ["gtrid", gtrid_value]
sp_transactions
xactkey type coordinator starttime state connection dbid spid loid failover srvname namelen xactname ------------------------------ ---- ----------- ---------------- --------- ---------- ---- ---- ---- -------- -------- ------- ------------------- 0x00000b1700040000dd6821390001 Local None Jun 1 1999 3:47PM Begun Attached 1 1 2 Resident Tx NULL 17 $user_transaction 0x00000b1700040000dd6821390001 Remote ASTC Jun 1 1999 3:47PM Begun NA 0 8 0 Resident Tx caserv2 108 00000b1700040000dd6821390001-aa01f04ebb9a-00000b1700040000dd6821390001-aa0 1f04ebb9a-caserv1-caserv1-0002
sp_transactions "xid", "00000b1700040000dd6821390001-aa01f04ebb9a-00000b1700040000dd6821390001-aa01f04ebb9a-caserv1-caserv1-0002"
xactkey type coordinator starttime state connection dbid spid loid failover srvname namelen xactname commit_node parent_node gtrid ------------------------------ ----------- ----------- ---------- ------- ---------- ------ ------ --------- -------- --------- ---------- ------- ------------- ------------- ------------- 0x00000b2500080000dd6821960001 External ASTC Jun 1 1999 3:47PM Begun Attached 1 8 139 Resident Tx NULL 108 00000b1700040000dd6821390001-aa01f04ebb9a-00000b1700040000dd6821390001-aa0 1f04ebb9a-caserv1-caserv1-0002 caserv1 caserv1 00000b1700040000dd6821390001-aa01f04ebb9a
sp_transactions "state", "prepared"
sp_transactions "state", "prepared", "xactname"
sp_transactions "gtrid", "00000b1700040000dd6821390001-aa01f04ebb9a"
xactkey type coordinator starttime state connection dbid spid loid failover srvname namelen xactname commit_node parent_node ------------------------------ ------- ---------- ----------------- ----------- ---------- ------ ------ ----------- ------------ --------------- ------- ------------- ------------- 0x00000b1700040000dd6821390001 Local None Jun 1 1999 3:47PM Begun Attached 1 1 2 Resident Tx NULL 17 $user_transaction caserv1 caserv1
sp_transactions translates data from the systransactions table to display information about active transactions. systransactions itself comprises data in the syscoordinations table, as well as in-memory information about active transactions.
sp_transactions with no keywords displays information about all active transactions.
sp_transactions with the xid keyword displays the gtrid, commit_node, and parent_node columns only for the specified transaction.
sp_transactions with the state keyword displays information only for the active transactions in the specified state.
sp_transactions with both xid and xactname displays only the transaction names for transactions in the specified state.
sp_transactions with the gtrid keyword displays information only for the transactions with the specified global transaction ID.
sp_transactions replaces the sp_xa_scan_xact procedure provided with XA-Library and XA-Server products.
Column | Description |
---|---|
xactkey | The column shows the internal transaction key that the SAP ASE server uses to identify the transaction. |
type | The column indicates the type of transaction:
|
coordinator | The column indicates the method or protocol used to manage a distributed
transaction. The values for coordinator are:
|
starttime | The column indicates the time that the transaction started. |
state | The column indicates the state of the transaction at the time
sp_transactions ran:
|
connection | The column indicates whether or not the transaction is currently associated with
a thread:
|
dbid | The column indicates the database ID of the database in which transaction started. |
spid | The column indicates the server process ID associated with the transaction. If the transaction is “Detached,” the “spid” value is 0. |
loid | The column indicates the unique lock owner ID from master.dbo.systransactions. |
failover | The column indicates the failover state for the transaction:
|
srvname | The column indicates the name of the remote server on which the transaction is executing. This column is only meaningful for remote transactions. For local and external transactions, srvname is null. |
namelen | The column indicates the total length of the xactname value. xactname is the transaction name. For local transactions, the transaction name may be defined as part of the begin transaction command. External transaction managers supply unique transaction names in a variety of formats. For example, X/Open XA-compliant transaction managers supply a transaction ID (xid) consisting of a global transaction identifier and a branch qualifier, both of which are stored in xactname. |
gtrid | For transactions coordinated by the SAP ASE server, the column displays the global transaction ID. Transaction branches that are part of the same distributed transaction share the same gtrid. You can use a specific gtrid with the sp_transactions gtrid keyword to determine the state of other transaction branches in the same distributed transaction. sp_transactions cannot display the gtrid for transactions that have an external coordinator. For transactions coordinated by an X/Open XA-compliant transaction manager, MSDTC, or SYB2PC, the gtrid column shows the full transaction name supplied by the external coordinator. |
commit_node | For transactions coordinated by the SAP ASE server, the column indicates the server that executes the outermost block of the distributed transaction. This outermost block ultimately determines the commit status of all subordinate transactions. For transactions not coordinated by the SAP ASE server,
commit_node displays one of these values:
|
parent_node | For transactions coordinated by the SAP ASE server, the column indicates the server that is coordinating the external transaction on the local server. For transactions not coordinated by the SAP ASE server, parent_node displays the same values as those displayed by commit_node. Note:
The values for commit_node and parent_node
can be different, depending on the levels of hierarchy in the distributed
transaction.
|
See also Using Adaptive Server Distributed Transaction Management Features.
Any user can execute sp_transactions. Permission checks do not differ based on the granular permissions settings.
Values in event and extrainfo columns from the sysaudits table are:
Information | Values |
---|---|
Event | 38 |
Audit option | exec_procedure |
Command or access audited | Execution of a procedure |
Information in extrainfo |
|