在 SQL Server 中,處理分布式事務通常涉及以下步驟:
設置分布式事務:
BEGIN DISTRIBUTED TRANSACTION
開始一個分布式事務。BEGIN DISTRIBUTED TRANSACTION
WITH (
XACT_TIMEOUT = 60,
MAX_LOG_SIZE = 1024 MB,
LOG_BACKUP_ALIGNMENT = 1 MB,
LOG_BACKUP_SIZE = 1024 MB,
LOG_BACKUP_COUNT = 10,
COMMITTED_TYPE = 2,
COMMITTED_VALUE = 1,
DEADLOCK_PRIORITY = 10000,
ENCRYPTED = OFF,
ALLOW_SINGLE_USER = OFF,
READ_ONLY = OFF,
TRACK_ACTIVITY = OFF,
XACT_IS_ROUNDDOWN = OFF,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_PREEMPTIVE_ABORT = OFF,
XACT_SYNCHRONIZED = OFF,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT_COMMIT_DELAY = 0,
XACT_COMMIT_RATE = 0,
XACT_COMMIT_MODE = AUTO_COMMIT,
XACT_SUPPRESS_楊洋 = OFF,
XACT_USER_INSTANCE = OFF,
XACT_AUTO_COMMIT_SUBTRAN = OFF,
XACT