Adaptive Server version 12.5 stores the size of the master device in the config block. How you use the dataserver -b option depends on whether you are rebuilding a corrupted system database in a server installation that was:
First built in version 12.5, or
Upgraded to version 12.5.
With servers that were first built in version 12.5, dataserver retrieves and uses the master device size from the config block. If the config block is corrupt, use the dataserver -b option.
With servers that were upgraded to version 12.5, the master device size is written to the config block as part of the upgrade.
In master devices built in version 12.5 as well as for servers upgraded to version 12.5, Adaptive Server reports the size of the master device in the server’s error log that was created during the upgrade process to version 12.5, and looks like the following:
00:00000:00001:2001/06/07 19:27:46.95 server WARNING: *************************** 00:00000:00001:2001/06/07 19:27:46.96 server SQL Server booted against master device for different release. This message is to be expected during an upgrade. SQL Server version 12.5.0.0 Master device version 12.0.0.0 00:00000:00001:2001/06/07 19:27:46.96 server WARNING: *************************** 00:00000:00001:2001/06/07 19:27:46.98 server Master device size: 156.250000 megabytes, or 80000 virtual pages. (A virtual page is 2048 bytes.)
Once you obtain the size of the master device, include this information in the -b option when you use dataserver during the rebuild process.
Adaptive Server version 12.5 supports 2K, 4K, 8K, and 16K logical page sizes. master devices built using Adaptive Server version 12.5 store information about its logical page size in the config block. The server’s error log contains the system database’s logical page size:
00:00000:00001:2001/06/07 19:27:44.80 server The logical pagesize of the server is 2 Kb.
If you are rebuilding a corrupt system database in a server that was upgraded to version 12.5, dataserver uses the default logical page size of 2K.
If you are rebuilding a corrupt system database in a device built in 12.5, you do not need to specify the logical page size. The rewrite process retrieves the logical page size from the config block.
If the config block is corrupt, use the dataserver -z page size argument to specify the logical page size of the master device.
Obtain the page size of the master device you are rebuilding by checking a previous error log from its server, then specify that page size using the -z option. If the value you specify on the -z option differs from what the server finds in the config block, Adaptive Server reports a warning and does not perform the rewrite process. You can override this error using the -f option to force the rebuild.
During the rewrite master process, Adaptive Server examines each allocation page in the existing, and possibly corrupt, master device, to identify allocation units that belong to the master database. Adaptive Server uses the logical page size specified to create each allocation unit.
Therefore, if you provide an incorrect logical page size, data is read incorrectly while identifying allocation units. This results in a new master device that is rewritten with the wrong logical page size, potentially destroying previously existing model, tempdb, sybsystemdb, and other user databases.
If the specified master device size is smaller than the size of the initial master device, the search for allocation units that rightfully belong to the master database does not find space that should belong to the initial master device. If the specified master device size is too large, other databases that reside past the end of the initial master device are incorrectly scanned, which can cause corruption.
If you use the -b or -z option, Adaptive Server checks the sizes indicated in the options against the sizes indicated in the config block.
WARNING! If the master device size and logical page size values differ from the values used when the installation was created, the rewrite master process corrupts other databases on your master device.
The following examples show the error checking that is done when an incorrect size value is specified:
The master device size was 140MB when initially built, but the -b option specifies 200MB when rewriting the master database:
$SYBASE/$SYBASE_ASE/bin/dataserver -d/sybase/devices/master.dat -c$SYBASE/ASE_125.cfg -e/sybase/devices/125_error.log -w master -b 200M
00:00000:00000:2001/06/11 09:21:28.79 kernel Use license file /sybase/SYSAM-1_0/licenses/license.dat. 00:00000:00000:2001/06/11 09:21:28.79 kernel Checked out license ASE_SERVER 00:00000:00000:2001/06/11 09:42:15.02 kernel Using config area from primary master device.00:00000:00000:2001/06/11 09:42:15.12 server This installation's configured device size (71680 virtual pages) does not match that specified on the command line (102400 virtual pages). To use the configured size, omit the command line size; to use the command line size, specify 'forcebuild'.
The master device size had a logical page size of 2K when initially built, but the -z option specifies a 4K logical page when rewriting the master database:
$SYBASE/$SYBASE_ASE/bin/dataserver -d/sybase/devices/master.dat -c$SYBASE/ASE_125.cfg -e/sybase/devices/125_error.log -w master -z 4k
00:00000:00000:2001/06/11 09:21:28.79 kernel Use license file /sybase/SYSAM-1_0/licenses/license.dat. 00:00000:00000:2001/06/11 09:21:28.79 kernel Checked out license ASE_SERVER 00:00000:00000:2001/06/11 09:21:28.85 kernel Using config area from primary master device. 00:00000:00000:2001/06/11 09:21:28.97 server The configured server page size (2048 bytes) does not match that specified on the command line (4096 bytes). To use the configured size, omit the command line size; to use the command line size, specify 'forcebuild'.
Due to the complexity and risk of the following workaround, Sybase strongly recommends that you dump the master database and all databases that use space on the master device after you complete an upgrade to 12.5. You should dump these databases regularly.
[Bug #209913] During this procedure, the following error messages may occur; you can ignore them: 3479, 5859, and 11245.
To rebuild the master database
To rebuild the master database, use the 12.5 dataserver binary with the -b and -w flags. You can also use the -z flag to specify the logical page size. For example:
To rebuild master database on a 200MB master device upgraded from a pre-12.5 server to 12.5, enter:
dataserver -d master.dat -w master -b 200M
The logical page size for upgraded servers is 2K, so the -z flag is not needed here.
To rebuild a master device initially built using a 12.5 Adaptive Server of 250MB, with a logical page size of 8K, enter:
dataserver -d master.dat -w master
Assuming the config block is not corrupt, Adaptive Server retrieves the 250MB master device size and the 8K logical page size from the config block. The -b and -z flags are not necessary in this case.
If the config block is not corrupt, and the user specifies individual sizes, enter:
dataserver -d master.dat -w master -b 250M -z 8K
Adaptive Server reads the required values from the config block, and validates them against the user-specified values. If these two values match, the master database is built at the specified location.
If the config block is corrupt, enter:
dataserver -d master.dat -w master -b 250M -z 8K -forcebuild
The user specifies the required sizes, and forces a rebuild of the master database, overriding the values in the config block with user-specified values.
The rewriting of the master database goes through an internal upgrade process to rebuild the corrupt master database. Adaptive Server shuts down when it has finished, and may produce an output that looks similar to the following:
00:00000:00001:2001/06/11 09:20:47.66 kernel libomni1 - Component Integration Services: using 'Sybase Client-Library/12.5/P/SPARC/Solaris 2.8/1/DEBUG/Fri Mar 23 20:31:35 2001' 00:00000:00001:2001/06/11 09:20:47.70 server The logical pagesize of the server is 2 Kb. 00:00000:00001:2001/06/11 09:20:49.00 server Database 'master' appears to be at an older revision than the present installation; SQL Server will assess it, and upgrade it as required. 00:00000:00001:2001/06/11 09:20:49.07 server Database 'master': beginning upgrade step [ID 1]: Initialize disk and create empty allocation units on master device. 00:00000:00001:2001/06/11 09:20:50.24 server Database 'master': beginning upgrade step [ID 2]: Bootstrap basic system catalogs in database. 00:00000:00001:2001/06/11 09:20:54.22 server Database 'master': beginning upgrade step [ID 3]: creating index (table systypes, index ncsystypes) 00:00000:00001:2001/06/11 09:20:55.43 server Database 'master': beginning upgrade step [ID 4]: creating index (table sysobjects, index ncsysobjects) [...] 00:00000:00001:2001/06/11 09:20:57.38 server Database 'master': beginning upgrade step [ID 81]: Load initial set of attribute-definition rows into SYSATTRIBUTES. 00:00000:00001:2001/06/11 09:21:05.50 server Warning: Using only the first 30 characters for password 00:00000:00001:2001/06/11 09:21:06.86 server No. of rows in Master_sysmessages=4722 00:00000:00001:2001/06/11 09:21:06.86 server Total size of Master_sysmessages=547085 bytes (0.52 M) 00:00000:00001:2001/06/11 09:21:11.59 server Database 'master': beginning upgrade step [ID 251]: creating table (table syslogshold) [...] 00:00000:00001:2001/06/11 09:21:11.97 server Database 'master': beginning upgrade step [ID 602]: creating table (table sysusermessages) [...] 00:00000:00001:2001/06/11 09:21:15.23 server Database 'master': beginning upgrade step [ID 1345]: executing SQL statement (update sysattributes set int_value=) 00:00000:00001:2001/06/11 09:21:15.28 server Database 'master': beginning upgrade step [ID 1400]: noting the present database upgrade level 00:00000:00001:2001/06/11 09:21:15.62 kernel ueshutdown: exiting
Adaptive Server uses a variant of the upgrade process to rebuild the master database. Do not be concerned that the rewrite master process upgrades the entire server again.
Edit a copy of the RUN_servername file in your 12.5 Adaptive Server install directory to add the -m flag and the -T3608 trace flag. For example:
/$SYBASE/$SYBASE-ASE/bin/dataserver -d/$SYBASE/data/master.dat \ -sTEST -e/$SYBASE/$SYBASE-ASE/install/TEST_errorlog \ -i/$SYBASE/interfaces -M/$SYBASE/$SYBASE-ASE -m -T3608
Use this file to start the server in single-user mode.
For all devices added with disk init, you must run disk reinit. Check the output from sysdevices, if available, for a list of devices. You must give the correct logical and physical names and sizes for the disk reinit command. Obtain physical device names from an error log of a prior successful start of the server. Obtain logical names and sizes from records you have kept regarding your installation.
For more information on disk reinit, see the Reference Manual or the Error Messages and Troubleshooting Guide.
Run disk refit. When disk refit completes, Adaptive Server automatically shuts down.
Restart the server using the -m flag and the -T3608 trace flag.
Run:
dbcc checkalloc("master", fix)
You can ignore messages similar to the following:
EXTID:1536 (Alloc page: 1536) is initialzed. Extent follows: NEXT=0 PREV=0 OBJID=0 ALLOC=0x0 DEALL=0x0 INDID=1 STATUS=0x0 EXTID:1544 (Alloc page: 1536) is initialzed. Extent follows: NEXT=0 PREV=0 OBJID=0 ALLOC=0x0 DEALL=0x0 INDID==0 STATUS=0x0 EXTID:1552(Alloc page: 1536) is initialzed. Extent follows: ...
Shut down the server, and restart the server in the usual way; that is, without the -m flag and the trace flag.
Run dbcc checkalloc on all databases. No error messages are expected at this time.
Run the following commands from your Adaptive Server 12.5 directory:
isql -Usa -Ppassword -i scripts/installmaster isql -Usa -Ppassword -i scripts/instmsgs.ebf
If you are using jConnect, run:
isql -Usa -Ppassword -i scripts/installjconnect
If you are using two-phase commit or distributed transactions, run:
isql -Usa -Ppassword -i scripts/installcommit
Dump all databases.
All server-supplied system messages are reinstalled in U.S. English as part of this process. Localize these messages manually after this process.
The rebuild master process re-creates sysusermessages. Reinstall any messages that you installed in the master database.
If both your master and model databases are corrupt, you must first rebuild the master database as described in “Building the master database”. Rebuilding a model database when the master database is intact uses information from system catalogs in the master database to identify pieces of the existing model database in your server.
To rebuild the model database
Run the 12.5 version of dataserver using the -w parameter:
dataserver -d master.dat -w model
The -b and -z parameters are ignored.
The new model database then goes through an internal upgrade process that rebuilds the corrupt model database. When Adaptive Server completes this process, it displays the following and shuts down:
00:00000:00001:2001/06/13 11:54:58.00 server The transaction log in the database 'master' will use I/O size of 2 Kb. 00:00000:00001:2001/06/13 11:54:58.12 server Database 'model' appears to be at an older revision than the present installation; SQL Server will assess it, and upgrade it as required. 00:00000:00001:2001/06/13 11:54:58.14 server Database 'model': beginning upgrade step [ID 1]: Initialize disk and create empty allocation units on master device. 00:00000:00001:2001/06/13 11:54:59.13 server Database 'model': beginning upgrade step [ID 2]: Bootstrap basic system catalogs in database. 00:00000:00001:2001/06/13 11:54:59.63 server Database 'model': beginning upgrade step [ID 3]: creating index (table systypes, index ncsystypes) [...] 00:00000:00001:2001/06/13 11:55:09.40 server Database 'model': beginning upgrade step [ID 1400]: noting the present database upgrade level 00:00000:00001:2001/06/13 11:55:09.47 kernel ueshutdown: exiting
Edit a copy of the RUN_servername file in your 12.5 Adaptive Server install directory to add the -m flag. For example:
/$SYBASE/$SYBASE-ASE/bin/dataserver -d/data/master.dat \ -sTEST -e/$SYBASE/$SYBASE-ASE/install/TEST_errorlog \ -i/$SYBASE/interfaces -M/$SYBASE/$SYBASE-ASE -m
Use this file to start the server in single-user mode.
Run:
dbcc checkalloc("model", fix)
You can ignore messages similar to the following:
EXTID:1536 (Alloc page: 1536) is initialzed. Extent follows: NEXT=0 PREV=0 OBJID=0 ALLOC=0x0 DEALL=0x0 INDID=1 STATUS=0x0 EXTID:1544 (Alloc page: 1536) is initialzed. Extent follows: NEXT=0 PREV=0 OBJID=0 ALLOC=0x0 DEALL=0x0 INDID==0 STATUS=0x0 EXTID:1552(Alloc page: 1536) is initialzed. Extent follows: ...
Run:
dbcc checkalloc("model")
There should be no errors at this time.
Run the following command from your 12.5 Adaptive Server directory:
isql -Usa -Ppassword < scripts/installmodel
You can now shut down the server and restart it in your usual way; that is, without the -m flag.