Case study 27: Move master device file to new location
Sybase ASE version: All
Background story: I've been egoistically searching through google for my name, and found one old post I've forgot, regarding this subject, and now I would like to publish it.
Task: Describe a process of moving master device to new location.
Solution:This can be very helpful if You want to move master device to another location, for example, during standard installtion, it is set to standard location, and now You would like to move it to another. The easiest way to do this is by using device mirroring. In text which follow I am going to describe this process.
Start Sybase ASE server, log to the Sybase Central as sa user and open tab Database devices.
Right click on master device and select properties.
In master device properties, open Mirror tab and set options as shown in picture, set new master data file name and location, and click OK.
With this step we set a mirror of master data file to another file.
Right click on master device once again and select properties.
In master device properties, open Mirror tab and set options as shown in picture:
With this step we unmirror master data file from primary(old) to secondary(new).
As we can see from following picture, master device is now on new master data file:
Shutdown Sybase ASE and remove old master data file from original folder to some temporay location. DO NOT DELETE ORIGINAL MASTER FILE UNTIL PROCESS IS FINISHED.
Now, Sybase ASE startup script should be changed. Find Your $SYBASE\install folder and edit RUN_your_sybase_database_server_name script. You will see that in this file, location of original master data file is entered. Change that entry with new master data file name and location.
For example, original line would be:
C:\Sybase15\ASE-15_0\bin\sqlsrvr.exe -dC:\Sybase15\data\master.dat -sUSERX15 -eC:\Sybase15\ASE-15_0\install\USERX15.log -iC:\Sybase15\ini -MC:\Sybase15\ASE-15_0
Change it to:
C:\Sybase15\ASE-15_0\bin\sqlsrvr.exe -dC:\Sybase15\data\master_new.dat -sUSERX15 -eC:\Sybase15\ASE-15_0\install\USERX15.log -iC:\Sybase15\ini -MC:\Sybase15\ASE-15_0
For Sybase on UNIX this is the end of the process. Now You can start Your ASE by executing RUN_your_sybase_database_server_name script.
For Windows, becauase You can start Sybase also through services.msc console, which reads Sybase startup parameters from another location one step more is needed.
Type regedit.exe, open registry and go to the following entry:
HKEY_LOCAL_MACHINE\SOFTWARE\SYBASE\Server\your_sybase_database_server_name\Parameters and look at the parameter Arg0
You will see that is showing on old master device file. As in earlier step, change it to point to new master device file. Now start Sybase through services.msc or by executing RUN_your_sybase_database_server_name script.
If everything is ok, then You can delete original master device file.