lct_admin

Description

Manages the last-chance threshold.

Returns the current value of the last-chance threshold.

Aborts transactions in a transaction log that has reached its last-chance threshold.

Syntax

lct_admin({{"lastchance" | "logfull" | "reserved_for_rollbacks"},
	database_id
	|"reserve", {log_pages | 0 }
	| "abort", process-id [, database-id]})

Parameters

lastchance

creates a last-chance threshold in the specified database.

logfull

returns 1 if the last-chance threshold has been crossed in the specified database and 0 if it has not.

reserved_for_rollbacks

determines the number of pages a database currently reserved for rollbacks.

database_id

specifies the database.

reserve

obtains either the current value of the last-chance threshold or the number of log pages required for dumping a transaction log of a specified size.

log_pages

is the number of pages for which to determine a last-chance threshold.

0

returns the current value of the last-chance threshold. The size of the last-chance threshold in a database with separate log and data segments does not vary dynamically. It has a fixed value, based on the size of the transaction log. The last-chance threshold varies dynamically in a database with mixed log and data segments.

abort

aborts transactions in a database where the transaction log has reached its last-chance threshold. Only transactions in LOG SUSPEND mode can be aborted.

logsegment_freepages

describes the free space available for the log segment. This is the total value of free space, not per-disk.

process-id

The ID (spid) of a process in log-suspend mode. A process is placed in log-suspend mode when it has open transactions in a transaction log that has reached its last-chance threshold (LCT).

database-id

the ID of a database whose transaction log has reached its LCT. If process-id is 0, all open transactions in the specified database are terminated.

Examples

Example 1

This creates the log segment last-chance threshold for the database with dbid 1. It returns the number of pages at which the new threshold resides. If there was a previous last-chance threshold, it is replaced:

select lct_admin("lastchance", 1)

Example 2

Returns 1 if the last-chance threshold for the database with db_id of 6 has been crossed, and 0 if it has not:

select lct_admin("logfull", 6)

Example 3

Calculates and returns the number of log pages that would be required to successfully dump the transaction log in a log containing 64 pages:

select lct_admin("reserve", 64)

-----------
         16 

Example 4

Returns the current last-chance threshold of the transaction log in the database from which the command was issued:

select lct_admin("reserve", 0)

Example 5

Aborts transactions belonging to process 83. The process must be in log-suspend mode. Only transactions in a transaction log that has reached its LCT are terminated:

select lct_admin("abort", 83)

Example 6

Aborts all open transactions in the database with database ID 5. This form awakens any processes that may be suspended at the log segment last-chance threshold:

select lct_admin("abort", 0, 5)

Example 7

Determines the number of pages reserved for rollbacks in the pubs2 database, which has a pubid of 5:

select lct_admin("reserved_for_rollbacks", 5, 0)

Example 8

Describes the free space available for a database with database ID of 4:

select lct_admin("logsegment_freepages", 4)

Usage

Standards

SQL92 – Compliance level: Transact-SQL extension.

Permissions

Only a System Administrator can execute lct_admin abort. Any user can execute the other lct_admin options.

See also

Command dump transaction

Function curunreservedpgs

System procedures sp_thresholdaction