
Q: Altering the size of master device
Quote:
> Is it possible to alter the size of master device without dropping and
> recreating it ? (probably with mirroring ?)
Yes, its possible. I posted an untested method a little
while back. Since then I've thought of another method
as well. So I'll summarise both here.
1) Use buildmaster (or sybinit) to create a new master
device to the size you want. Dump your old master
database and then load it over the new one. Edit
your run script to reflect the new location of the
master device. This should work, but I haven't tested
it so I can't gaurantee it. You will have problems if
you have placed fragments of other databases on the
master device other than the master and model databases,
or if you have extended the sizes of the model or tempdb
databases on the master device. A solution for this is
to alter the entries in the sysusages table of the old
master to match those in the new one before you dump it
and load over the new.
2) This method can only work with raw disk partitions.
First, create a new device with disk init on the raw
partition to the size you want. This zeros the device
and records the device's entry in the sysdevices table.
Note the high and low values for its entry in sysdevices.
Look up the Sybase manuals for an explanation of how
the server stores the vdevno in the high bits of the
low and high fields. Since master's vdevno is always 0,
the value of its low field is always 0 and the high
field should match the size in 2k pages exactly. I
think for the new device you can just subtract low from
high to get the size in 2k pages. Next, drop this new
device, then mirror the master device onto that location.
Unmirror the primary master. Alter the sysdevices table
to show the new size for master in the high field.
Edit your run script to point to the new location of
the master device and then bounce your server. Test
that this method works by either creating a new database
on the master device (the easiest way to check - if it
works drop the db, if it fails, your OK. If its corrupt
drop it with a dbcc call) or altering the master database
itself (risky if it fails - could possibly corrupt master).
In either case take the usual precautions. Make dumps of
anything vital (including master itself). Log everyone
else off etc.
If you try one of these, let us know what happens.
This should probably go into the FAQ since it seems
to be becoming a recurring question.
-am