Tracking Database Changes

SAP ASE uses transactions to keep track of all database changes. Transactions are SAP ASE units of work. A transaction consists of one or more Transact-SQL statements that succeed—or fail—as a unit.

Each SQL statement that modifies data is considered a transaction. Users can also define transactions by enclosing a series of statements within a begin transaction...end transaction block. See “Transactions: Maintaining Data Consistency and Recovery,” in the Transact-SQL Users Guide.

Each database has its own transaction log, the system table syslogs. The transaction log automatically records every transaction issued by each database user. You cannot turn off transaction logging.

The transaction log is a write-ahead log. When a user issues a statement that modifies the database, SAP ASE writes the changes to the log. After all changes for a statement have been recorded in the log, they are written to an in-cache copy of the data page. The data page remains in cache until the memory is needed for another database page. At that time, it is written to disk.

If any statement in a transaction fails to complete, SAP ASE reverses all changes made by the transaction. SAP ASE writes an “end transaction” record to the log at the end of each transaction, recording the status (success or failure) of the transaction.