Sybase Device Creation

Sybase Devices are storage areas to create the database. Without devices we cannot create databases. Sybase uses logical devices to manage the database space. A logical device is a name of Physical area or file name.

More about Sybase Devices:

  • By default master device is first device created at the time of ASE(Sybase) installation. By default master, model, tempdb and sybsystemtempdb database are occupies the master device.
  • Logical Device name can be upto 255 characters.
  • Device size can be upto 4TB.
  • ASE supports 2,147,483,648 devices.
  • Vdevno(Virtual Device number) can be from 1 to 2,147,483,647.
  • By default size of the device is number of virtual pages(page size of the server). If we want to specify the size in KB, MB,… then we have to add m or M, k or K, ……

Sybase Device Creation Syntax:

disk init
name = “device_name”,
physname = { ‘physical_name’ | ‘cache_name’}
skip_alloc={true | false},
[vdevno = virtual_device_number,]
size = number_of_blocks
[, type = ‘inmemory’ ]
[, vstart = virtual_address
, cntrltype = controller_number]
[, dsync = {true | false}]
[, directio = {true | false}]
[, instance = “instance_name”]

Examples
Create a device for k2schools database

disk init
name=k2data,
physname=’/opt/sap/k2data1′,
size=’100M’
go

Note: We can get the list of devices information of specific device information using sp_helpdevice or sysdevices table.

To get information about device created above

sp_helpdevice k2data
go

or

select*from sysdevices where name=’k2data’
go

To get the lsit of available devices information

sp_helpdevice
go

or

select * from sysdevices
go

Dropping device:
Using sp-dropdevice, we can remove the device. This removes entry from the sysdevices table. But, not the physical file. We have to remove the phyical file manually.

sp_dropdevice logicalname

Powered by k2schools