Recovering the sybsystemprocs database  Restoring sybsystemprocs with load database

Chapter 13: Restoring the System Databases

Restoring sybsystemprocs with installmaster

This section assumes that your sybsystemprocs database exists, but is corrupt. If sybsystemprocs does not exist, skip this section; you must create it using create database.

To restore sybsystemprocs with installmaster:

  1. Check to see which devices currently store sybsystemprocs. sp_helpdb probably will not work at this time, but the following query will:

    select  lstart,
    size / (power(2,20)/@@maxpagesize) as 'MB',
    d.name as 'device name',
    case when segmap = 4 then 'log'
    when segmap & 4 = 0 then 'data'
    else 'log and data'
    end as 'usage'
    from sysusages u, sysdevices d
    where d.vdevno = u.vdevno
    and d.status & 2 = 2
    and dbid = db_id('sybsystemprocs')
    order by 1
    

    The result probably shows sybsystemprocs all on one disk fragment, and having log and data as its usage, but you may have a more complex layout than that. Save this query’s results for later use.

  2. Drop the database.

    drop database sybsystemprocs
    

    If that succeeds and the device is undamaged, go to step 3.

    If the drop database fails, perform either:

    If you removed sybsystemprocs by hand or recreated the sybsystemprocs device, shut down Adaptive Server using shutdown with nowait. If you dropped the sybsystemprocs device and it was not a raw partition, remove the physical file. Restart Adaptive Server.

  3. Recreate the sybsystemprocs device. If you dropped the sybsystemprocs device, create a new one via disk init. Then recreate sybsystemprocs using one of the methods below using the results you wrote down in step 1.

    NoteIf you plan to load a backup copy of sybsystemprocs, you can include the for load option with the create database or alter database commands. However, you must use load database to load it before it can be used for any other purpose.

  4. Run the installmaster script to create the Sybase-supplied system procedures.

    On Unix platforms:

    isql -Usa -Ppassword -Sserver_name -i $SYBASE_/$SYBASE_ASE/scripts/installmaster
    

    On Windows (from the %SYBASE%\%SYBASE_ASE%\scripts directory):

    isql -Usa -Ppassword -S<server_name> -i instmstr
    
  5. If your site added any procedures or made other changes in sybsystemprocs, you must make these changes.





Copyright © 2005. Sybase Inc. All rights reserved. Restoring sybsystemprocs with load database

View this book as PDF