You only need to build a new master device if your old master device is damaged beyond repair. Otherwise, you can recreate the master and model databases on your existing master device.
There are two procedures for recreating the master database: replacement of the master device, and forcing Adaptive Server to recreate the configuration area. Use the first procedure when only the master database corrupted. Use the second procedure if the master device's configuration area is also corrupt. You can often detect corruption in the configuration area because the server will refuse to run at all, complaining that this area is corrupt.
The following examples use the UNIX dataserver command. On Windows, use the sqlsrvr command.
Rebuild the master device with the dataserver -w option:
dataserver -w master
Your dataserver command may include other options such as command line flags specifying the device path name, server name, interfaces file name, and so on. These option are listed in the RUN_servername file that normally starts this server.
The -w master option causes Adaptive Server to search the device for database fragments belonging to the master database. After it finds these fragments, it writes a default master database into that space, then shuts down.
Restart Adaptive Server with the RUN_servername file.
If the configuration area is corrupt, you must use the -f option to force Adaptive Server to reconstruct this area. The syntax is:
dataserver -w master -f [-zpage_size] [-bdevice_size]
Your dataserver command may include other options such as command line flags specifying the device path name, server name, interfaces file name, and so on. These option are listed in the RUN_servername file that normally starts this server.
The following restrictions apply:
You
can specify the page size if it is wrong (for example, -z8k
).
You can specify the device size if it is wrong (for
example, -b125M
).
Any allocation units on the disk that appear corrupt, or that are not currently allocated, are allocated to the master database.
WARNING! Do not attempt to use this procedure to change your server’s logical page size. Doing so does not work, and further corrupts the device to the point where you cannot recover it. Any device size you specify must be accurate; dataserver -w does not alter the device’s size, but it may fail to find parts of some databases if the specified size is too small, and can fail entirely if the specified size is too large.
The -w master option, with or without -f, only recreates the master database, and All other allocation units on the disk are not changed, so you will probably be able to recover the data using 'disk refit' as described further down this chapter.
If the entire master device is corrupt (for example, in the case of a disk crash) you must replace the entire device by starting Adaptive Server in buildmaster mode:
If the existing master device is not on a raw partition and you plan to reuse it, remove the old master device file.
Run the server in buildmaster mode:
dataserver -zpage_size -bdevice_size [other options as appropriate]
WARNING! You cannot use this command to change the server's page size at this time. All the other devices for this server use the configured page size, and will not recover properly if you use a different page size. However, since you are creating a new file, you can change the device size at this point.
When determining how large to make your master device, keep in mind that this device reserves 8 KB for its configuration area. For example, if you specify the device size as 96 megabytes, the final bit of space is wasted because there isn't enough space for a full allocation unit. You should add an additional .01 megabyte to the space you require for the device to account for this overhead. So, to have a full 96 megabyte, specify -b96.01M.
When you use this method to rebuild the master device, Adaptive Server creates new, default databases for master, model, tempdb, and sybsystemdb. These databases are all as small as possible for your installation’s logical page size. If you intend to load backups to these databases, they may now be too small. You must increase their size with alter database before loading these backups.
Regardless of how your restore your master device, all users and passwords in your master database will be gone . The only remaining privileged login will be sa, with no password.
For details on dataserver, see the Utility Guide.