Error 5018



Message text

Caution:  You have set up this database to include space on disk %d for both data and the transaction log.  This can make recovery impossible if that disk fails.


Error 5018 is raised when you execute alter database to add storage space, and the disk map for the database is found to contain both data and log segments.

The message can also be raised in another situation. When you load a database from dump, Adaptive Server compares the segments on the dump with the device allocations in the target database. If they match, the server maintains the allocations. If, however, there is a mismatch, the load will remap segments to the free device allocations. The remapping may result in mixed data and log segments, raising the 5018 error.

Why is recovery difficult when data and log are mixed? To understand this, consider first what happens when you keep data and log separate, and make a complete database backup (say) every 7 days. If the device containing the data crashes, you can restore the database from the latest backup, then apply the committed transactions from the log device, restoring the database to practically the last moments before failure.

In contrast, if data and log are mixed and the device fails, you can only restore the database up to the time of the last full backup, since there is no way to apply the transaction log.


If the error was raised when creating a database

Unless you are creating small, non-critical databases, always place the log on a separate device. This allows you to dump transaction logs, ensures full recovery from hard disk crashes and has many other benefits including performance improvement. For details, refer to “Placing the Transaction Log on a Separate Device” in the chapter “Creating and Managing User Databases” in the System Administration Guide: Volume 2.

if the error was raised when loading a database

It is likely that there is a mismatch in the segment mappings between the dump’s source and target databases. To correct this problem:

  1. In the source server (where the dump is to be executed), run the following query:

    1> use master
    2> go
    1> select * from sysusages where dbid=db_id("<database_name>")
    2> go

    Each line of output corresponds to a segment, with a segmap of 4 denoting a log segment, and any other segmap denoting a data segment. Save the output.

  2. Dump the database.

  3. Create the target database for load, specifying the segments in the same order and with the same sizes as defined by the query output in step 1. For simplicity, make sure that all non-log segments have a segmap value of 3; if you had user-defined segments, the load will automatically remap these segments.

    Check that the segment mappings are the same, by running the following query for the new database:

    1> select * from sysusages where dbid=db_id("<database_name>")
    2> go
  4. Load the database.

Versions in which this error is raised

All versions