The following steps demonstrate how to port the master device to a different disk. While executing this task, please refer to SYBASE's related documentation Technical Documents #1324 entitled "Segment Remapping with Load database When Moving a Database ").
Note that you must stop SQL Server applications before executing buildmaster.
The key to success is that the contents of each row in the new sysusages system table are consistent with those in the old sysusages system table.
- Perform dbcc checks on the master database and back up the master database.
- Run the select * from table_name command and keep the output content. Table_name includes sysdevices, sysusages, and sysdatabases. Similarly, you can use the bcp command.
- Execute the sp_configure command and keep the output content.
- Copy the $ SYBASE/server_name.cfg file for retention.
- Shut down SQL/ASE Server.
- Run the following command to create a new master device:
UNIX: buildmaster-d <master_device>-ssize
VMS: buildmaster/disk = <master_device>/size = size
(Size is in the unit of page, 1 page = 2 K)
- Edit the RUN_server_name file. The-d (UNIX) or/device (VMS) parameter points to the new setting.
Backup name.
- Start SQL/ASE Server in single-user mode:
UNIX: startserver-f RUN_sever_name-m
VMS: startserver/server = server_name/masterrecover
- Run the select * from sysdevices command and keep the output content.
- Make sure that the contents of each row in the new sysusages system table are consistent with those in the old sysusages system table, and that the system table sysusages is correct if no alter database is performed after the Server is configured. If you have performed alter database, you need to execute these scripts in the original order. If there is no script, you need to find the alter database parameter in the information of the stored sysusages system table.
- Shutdown SQL/ASE Server and start the Server in single-user mode to check whether the contents of the sysusages system table are correct.
- If the configured Backup Server name is not SYB_BACKUP, run the following command:
1> sp_configure "allow updates", 1
2> go
1> update sysservers set srvnetname = "name in interfaces file"
Where srvname = "SYB_BACKUP"
2> go
- Load the master database. If the size of the new master device is different from that of the old one, the Server will Shut down. Note that the new system table will be overwritten, and you need to adjust the size of the master device in the Sysdevices system table. Perform the following two steps:
- Start the Server in single-user mode.
- If the size of the new device is different from that of the old one, run the following command:
1> sp_configure "allow updates", 1
2> go
1> update sysdevices set high = nnnn where name = "master"
2> go
The nnnn is the size of the master device in the unit of page 2 K). This value can be found from the information in the reserved sysdevices system table. If the created device is larger than the old one, execute: 1) Create a database that is about the same size as the master device. The purpose of this operation is to reinitialize the allocation page so that the entire master device is available. 2) Delete the database.
- Restart the Server.
- Backup master database.
Note:
- Before loading the master database, make sure that the character set and language module of SQL Server are the same as the character set and language module of the backup master database.
- Use sp_helpsort to check whether the character set is the same as that of the language module before and after the task is executed.
(