How to change default device in Sybase

After installation of ASE(Sybase), master device is the default device. This has to be changed immediately after installation of ASE(Sybase) to avoid allocate user database space to master device. We can do that by executing stored procedure sp_diskdefault. Before run this stored procedure, create the device first.

If we want to change the current device to another, first we have to off the current device using parameter defaultoff. Then, we have to execute the sp_diskdefault with defaulton option. If we have to follow these two points otherwise no changes will be done.

For example, if we create simple database without specifying the device information then it uses default database. Below syntax uses master device as default until we change it specific device.

CREATE database k2school
go

How to change default device in Sybase

Syntax to change the default device:

sp_diskdefault logicalname, {defaulton | defaultoff}

Examples:

Create device first

To off the master device as default in Sybase

exec sp_diskdefault master, defaultoff

To add device k2data as default device for database creation.

exec sp_diskdefault k2data, defaulton

You can leave a response, or trackback from your own site.

Leave a Reply

Powered by k2schools