2016-08-23

Default device and why you should change it?

Every one likes to work with intelligent programs: just put some specific information and the remaining part of parameters should be taken from a set of default parameters. Sybase ASE also works that way. When a new database will be created, one or more devices should be specified, but if this part of command will be omitted, than... a default device will be used. Initially master device is the default one. This is not the best situation, as if by a mistake no device will be specified during database creation it will be placed on master device. According to information in Administration guide it is not recommended situation:
Caution!
Do not store user databases on the master device; doing so makes it difficult to recover both the system databases and any user databases stored on the master device.


Generally after SAP Sybase ASE installation default device should be changed. First master device should be removed from the pool of default devices and next, after adding new devices new defaults should be defined.

Table sysdevices can be used to get information which devices are the default. Information is encapsulated in the status column:

SELECT name
 FROM sysdevices
 WHERE (status & 1) = 1
 ORDER BY name

Just after installation result should be:

name
------------------------------
master 

Information can be read also from output of stored procedure:

exec sp_helpdevice


Information is contained in the description column (mark the "default disk"):

device_name physical_name                description                                                                                                 status cntrltype vdevno vpn_low vpn_high 
----------- ---------------------------- ----------------------------------------------------------------------------------------------------------- ------ --------- ------ ------- -------- 
master      /opt/sap/data/master.dat     file system device, special, dsync on, directio off, default disk, physical disk, 100.00 MB, Free: 43.00 MB      3         0      0       0    51199 
sybmgmtdev  /opt/sap/data/sybmgmtdb.dat  file system device, special, dsync off, directio on, physical disk, 100.00 MB, Free: 24.00 MB                    2         0      4       0    51199 
sysprocsdev /opt/sap/data/sysprocs.dat   file system device, special, dsync off, directio on, physical disk, 196.00 MB, Free: 0.00 MB                     2         0      1       0   100351 
systemdbdev /opt/sap/data/sybsysdb.dat   file system device, special, dsync off, directio on, physical disk, 50.00 MB, Free: 20.00 MB                     2         0      2       0    25599 
tapedump1   /dev/nst0                    unknown device type, disk, dump device                                                                          16         2      0       0    20000 
tapedump2   /dev/nst1                    unknown device type, tape,        625 MB, dump device                                                           16         3      0       0    20000 
tempdbdev   /opt/sap/data/tempdbdev.dat  file system device, special, dsync off, directio on, physical disk, 100.00 MB, Free: 0.00 MB                     2         0      3       0    51199 

To un-check master device as default and define AlfaDataDev and AlfaLogDev as default run following commands:

exec sp_diskdefault 'master', 'defaultoff'
exec sp_diskdefault 'AlfaDataDev', 'defaulton'
exec sp_diskdefault 'AlfaDataDev', 'defaulton'

After this, when the device part of CREATE DATABASE statement will be executed, space from AlfaDataDev and AlfaLogDev will be taken. What interesting Sybase ASE will take devices in alphabetical order. If there is enough space on the first device, the database will be placed on only that one device. If however database size will be grater than free space on the first device, then additional space will be taken from the second device and so on. 

Of course, the best is to handle database placement manually, in planned and desired way. Leaving to ASE the decision where to place a database will make optimization much harder. 




No comments:

Post a Comment

SAP Adaprive Server Enterprise

SAP Adaprive Server Enterprise
SAP Adaprive Server Enterprise