Non-Master Device Containing Pieces of tempdb Is Lost

Follow this procedure if a device containing pieces of tempdb, other than the master device, has been lost:

  1. Start Adaptive Server in single-user mode. Refer to “How to Start Adaptive Server in Single-User Mode”.

  2. Print out the sysusages table for tempdb using the following command:

    1> select * from sysusages where dbid=2
    2> go
    

  3. Delete all but the first entry in sysusages for tempdb (dbid=2). Make sure that the segmap column for the first entry is 7. If the model database has been increased beyond its default size, do not reduce the size of tempdb so that it is smaller than model. If the size of model is larger than the default 2MB, call Sybase Technical Support.

    WARNING! disk refit or disk reinit will fail on any master database on which this procedure is used.

    For example:

    1> begin transaction
    2> delete master..sysusages 
    3> where dbid=2 and lstart != 0
    4> go
    

    1> update master..sysusages set segmap = 7
    2> where dbid = 2
    3> go
    

    1> select * from master..sysusages where dbid=2
    2> go
    

  4. If the above select command produced the following output:

    dbid  segmap  lstart  size
    

    2     7       0       1024
    

    continue to step 5. If it did not, roll back the transaction and contact Sybase Technical Support.

  5. Commit the transaction and shut down Adaptive Server using the following commands:

    1> commit transaction
    2> go
    

    1> shutdown
    2> go
    

  6. Start Adaptive Server in multiuser mode. Refer to “Returning Adaptive Server to Multiuser Mode”.

  7. Disallow updates to system catalogs:

    1> sp_configure "allow updates", 0
    2> go
    

  8. Drop (sp_dropdevice) and reinitialize (disk init) the lost device. If user databases are on the same device with tempdb, you may have to drop those databases also, before dropping and reinitializing the lost device.

  9. Use the alter database command to restore tempdb to the desired size.

  10. Dump the master database.