Page and object allocation

When you initialize a database device, the disk init command divides the new space into allocation units. The size of the allocation unit depends on the size of the logical pages your server uses (2, 4, 8, or 16K). The first page of each allocation unit is an allocation page, which tracks the use of all pages in the allocation unit. Allocation pages have an object ID of 99; they are not real database objects and do not appear in system tables, but dbcc errors on allocation pages report this value.

When a table of an indexed partition requires space, Adaptive Server allocates a block of 8 pages to the object. This 8-page block is called an extent. Each allocation unit contains 32 extents. The size of the extent also depends on the size of the server logical pages. Adaptive Server uses extents as a unit of space management to allocate and deallocate space as follows:

Every time space is allocated or deallocated on an extent, Adaptive Server records the event on the allocation page that tracks the extents for that object. This provides a fast method for tracking space allocations in the database, since objects can shrink or grow without excess overhead.

Figure 11-1 shows how data pages are set up within extents and allocation units in Adaptive Server databases.

Figure 11-1: Page management with extents

Graphic showing a page chain and how the page chain comprises an extent and an allocation unit.

dbcc checkalloc checks all allocation pages (page 0 and all pages divisible by 256) in a database and reports on the information it finds. dbcc indexalloc and dbcc tablealloc check the allocation of specific database objects.