DBA > Job Interview Questions > Sybase Interview Questions and Answers

How to swap a db device with another

More DBA job interview questions and answers at http://dba.fyicenter.com/Interview-Questions/

(Continued from previous question...)

How to swap a db device with another

Here are four approaches. Before attempting any of the following: Backup, Backup, Backup.
Dump and Restore
1. Backup the databases on the device, drop the databases, drop the devices.
2. Rebuild the new devices.
3. Rebuild the databases (Make sure you recreate the fragments correctly - See Ed Barlow's scripts (http://www.tiac.net/users/sqltech/) for an sp that helps you do this if you've lost your notes. Failure to do this will possibly lead to data on log segments and log on data segments).
4. Reload the database dumps!

Twiddle the Data Dictionary - for brave experts only.

1. Shut down the server.
2. Do a physical dump (using dd(1), or such utility) of the device to be moved.
3. Load the dump to the new device
4. Edit the data dictionary (sysdevices.physname) to point to the new device.

The Mirror Trick
1. Create a mirror of the old device, on the new device.
2. Unmirror the primary device, thereby making the _backup_ the primary device.
3. Repeat this for all devices until the old disk is free.

dd (Unix only)

(This option is no use if you need to move a device now, rather if you anticipate moving a device at some point in the future.)
You may want to use this approach for creating any database.
Create (or use) a directory for symbolic links to the devices you wish to use. Then create your database, but instead of going to /dev/device, go to /directory/symlink - When it comes time to move your devices, you shut down the server, simply dd(1) the data from the old device to the new device, recreate the symbolic links to the new device and restart the ASE. Simple as that.

(Continued on next question...)

Other Job Interview Questions