To restore a failed master database, perform the following steps:
- Run dataserver with the –b and –d options to create a new master device:
dataserver -d /dev/rsd1b –b 100M - Start SAP ASE in single-user mode:
startserver -f RUN_SYBASE –m - You can use the master database, but presently it doesn’t have any references
to any user databases or sybsystemprocs.
If master was expanded beyond its default size, run alter database to extend it. - Update the backup server name in sysservers if it isn’t SYB_BACKUP:
begin transaction
update sysservers set srvnetname = “PROD_BACKUP”
where servname = “SYB_BACKUP”
commit transaction - Load the backup of the master database; after the load completes, it will shut
down SAP ASE automatically:
load database master from “/full/path/name/master.dump” - Start SAP ASE in single-user mode, and check that all databases/devices/logins
appear to be restored correctly. - If everything appears okay, you’re nearly done. Shut down and restart SAP ASE
normally, and skip to step 9. - If everything doesn’t appear okay, you have more work to do. If additional
devices, databases, logins, or users of master were created after the last backup
of master, you’ll need to re-create them.
SAP ASE provides two commands to recover existing devices and databases to
a restored master database:
– disk reinit
– disk refit
Use disk reinit to recover devices created since the last dump of master; disk
reinit restores information to sysdevices without reinitializing the device,
which retains the data which is on the device. Values supplied to disk reinit
should match values supplied to the original disk init command.
The syntax for disk reinit follows:
disk reinit name = logical_device_name,
physname = physical_device_name,
vdevno = virtual_device_number,
size = number_of_pages | K | G | T
disk refit is used after running disk reinit to rebuild the sysusages and sysdatabases tables in master from the database fragments found on the restored devices.
- Assuming you need to run it, after executing disk refit, SAP ASE will automatically
shut down the server. You should restart SAP ASE in single-user mode
and verify that all databases are properly restored and are the correct sizes. Run
dbcc checkalloc() on all recovered databases. If everything appears okay, shut
down and restart SAP ASE normally. Any changes or additions to logins, configuration
options, remote servers, remote logins, and roles will still need to be
re-created.
The moral of the story is to keep frequent backups of the master database! Best
practice is to schedule a nightly backup of the master database. In addition, back
up the master database after each command that affects disks, storage, databases,
segments, logins, roles, and so on.