Error 5034



Message text

ALTER DATABASE was successful. Cannot modify the last-chance threshold because the database ’%.*s’ is in read-only mode.


Each database that stores its transaction log on a separate segment has a last chance threshold (LCT). This is an estimate of the number of free log pages that would be required to back up the transaction log.

Error 5034 is raised when you use alter database to extend log space on a read-only database. The database is altered and log space added, but the LCT cannot be modified because this requires an update to systhresholds, which is not possible in a read-only database.

Error 5034 is followed immediately by error 5035 ("Remember to execute SELECT LCT_ADMIN(’LASTCHANCE’, %d), when the database is made writable.

NoteVersion and earlier raise error 3906 (“Attempt to BEGIN TRANsaction in database ’%.*s’ failed because database is READ ONLY.") when alter database is used to extend log space. The database is altered and log space added, but the LCT cannot be modified. See “Error 3906” for details.


Re-establish the LCT after the database is available for updates using the following steps:

  1. Use the following command to determine the new last-chance threshold:

    1> use <database name>
    2> go
    1> select lct_admin("reserve", <log size in pages>)
    2> go

    For example, on a 20MB transaction log (containing 10240 2KB pages):

    1> select lct_admin("reserve", 10240)
    2> go

    The resulting value is the amount of space required to dump the transaction log.

  2. Modify the LCT using:

    1> select lct_admin(’lastchance’, <new threshold>)
    2> go

Additional information

Refer to “Creating a Free-Space Threshold for the Log Segment” in the chapter “Managing Free Space with Thresholds” in the System Administration Guide: Volume 2 for additional information on setting thresholds.

For databases normally operated in read-only mode, no updates occur on the database and so there is no need to update the LCT.

Versions in which this error is raised

All versions