The scratch database and the sysaltusages table

The sysaltusages table

The sysaltusages system table is a new data-only-locked table that is used to map page numbers in an archive database to the actual page within either the database dump and its stripes or the modified pages section. However, unlike the sysusages table in a traditional database, the sysaltusages table does not map every logical page in the database. sysaltusages maps:

sysaltusages has the following columns:

dbid    location    lstart    start    size    vstart    vdevno    segmap

where:

The sysaltusages table looks similar to Figure 3-2.

NoteBecause sysaltusages is a row-locked catalog, you may need to periodically use reorg to reclaim logically deleted space.

Figure 3-2: The sysaltusages table

The scratch database

The scratch database stores the new sysaltusages table. The scratch database is used to provide flexibility as to where the sysaltusages table is located.

The scratch database can be any database (with some exceptions like master and temporary databases.) Sybase recommends that you dedicate a database that is used only as a scratch database, because:

Apart from hosting the sysaltusages table, this database is like any other. You can use threshold procedures and other space management mechanisms to manage space within the database.

You can specify a database that may be used as a scratch database by entering:

sp_dboption <db name>, "scratch database", "true"

Each archive database can be assigned to only one scratch database at a time, but multiple archive databases can use the same scratch database. If you have a large number of archive databases, you may want to define multiple scratch databases.