Determining if there is space to be initialized

Adaptive Server synchronizes a portion of the data and log segments synchronously before making the database available, allowing the initializer to work ahead of any commands that require space in the database. However, you may occasionally see a performance impact to commands normally run against the database while Adaptive Server is busy initializing the space. This occurs because a command that requires space that is not yet initialized must initialize the space before it proceeds.

Information about initialized space is stored in sysattributes.

To determine if there is space not yet initialized in the database (for example, if the initializer terminated prematurely and left part of the database uninitialized), issue a query similar to:

select lstart=object_info1, size=object_info2, segmap=object_info3
from master..sysattributes where class=42 and object=db_id("mydb")
lstart           size             segmap
 -----------     -----------  -----------
        1536         3584000            3
        5120           51200            4

If the query returns one or more rows, the database contains space not yet initialized (in this query, the mydb database). This query does not indicate if the asynchronous initialization service task is running, only that it is not finished (if it was finished, the result set would contain zero rows).

Use a query similar to the following to determine if the initializer is running on a specific database (in this query, the test database):

select spid from sysprocesses 
where dbid=db_id("test") and cmd="CRDB AUINIT"
 spid 
------
    22

Adaptive Server prints this message to the error log once the asynchronous initialization service task is running:

Asynchronous initialization of database 'database_name' has completed.

If the asynchronous initialization service task stops prematurely, Adaptive Server prints this message to the error log:

Asynchronous database initialization terminated
prematurely for database '%.*s'. Use DBCC 
DBREPAIR(%.*s, async_database_init, start) to restart 
it if required as uninitialized pages will incur a small 
performance penalty when they are first referenced.