Makes a physical device or file usable by Adaptive Server.
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"]
is the name of the database device or file. The name must conform to the rules for identifiers and must be enclosed in single or double quotes. This name is used in the create database and alter database commands.
is the full specification of the database device or cache. This name must be enclosed in single or double quotes. When the physical device path is relative, disk init returns a warning.
name of the cache on which you are creating the disk.
indicates you are creating an in-memory device.
is a boolean parameter for the disk init command. It is supported for devices created on non-Windows file systems and on Windows raw systems. When skip_alloc is set to be “true.” it allows user to avoid initialization of pages with zeros. The default of skip_alloc is false.
is the virtual device number, which must be unique among the database devices associated with Adaptive Server. The device number 0 is reserved for the master device. Otherwise, valid device numbers must be between 1 and 2,147,483,647.
To determine the virtual device number, look at the device_number column of the sp_helpdevice report, and use the next unused integer.
is the amount of space to allocate to the new device. The following are example unit specifiers, using uppercase, lowercase, single and double quotes interchangeably: ‘k’ or “K” (kilobytes), “m” or ‘M’ (megabytes), “g” or “G” (gigabytes), and ‘t’ or ‘T’ (terabytes). Sybase recommends that you always include a unit specifier. Quotes are optional if you do not include a unit specifier. However, you must use quotes if you include a unit specifier. Acceptable values are:
5120
= 10
MB
"5120"
= 10
MB
"10M"
= 10
MB
is the starting virtual address, or the offset, for Adaptive Server to begin using the database device. The following are example unit specifiers, using uppercase, lowecase, single and double quotes interchangeably: ‘k’ or “K” (kilobytes), “m” or ‘M’ (megabytes), “g” or “G” (gigabytes), and ‘t’ or ‘T’ (terabytes). Sybase recommends that you always include a unit specifier. Quotes are optional if you do not include a unit specifier. However, you must use quotes if you include a unit specifier.
The size of the offset depends on how you enter the value for vstart.
If you do not specify a unit size, vstart uses
2K pages for its starting address. For example, if you specify vstart = 13
,
Adaptive Server uses 13 * 2K pages as the offset for the
starting address.
If you specify a unit value, vstart uses
this as the starting address. For example, if you specify vstart = "13M"
,
Adaptive Server sets the starting address offset at 13 megabytes.
The default value (and usually the preferred value) of vstart is 0. If the specified device does not have the sum of vstart + size blocks available, the disk init command fails. If you are running the Logical Volume Manager on an AIX operating system, vstart should be 2. Specify vstart only if instructed to do so by Sybase Technical Support.
specifies the disk controller. Its default value is 0. Reset cntrltype only if instructed to do so by Sybase Technical Support.
specifies whether writes to the database device take place directly to the storage media, or are buffered when using operating system files. This option is meaningful only when you are initializing an operating system file; it has no effect when initializing devices on a raw partition. By default, all operating system files are initialized with dsync set to true.
allows you to configure Adaptive Server to transfer data directly to disk, bypassing the operating system buffer cache. directio is a static parameter that requires a restart of Adaptive Server to take effect.
By default, directio is set to false for nonclustered Adaptive Servers, and to true for clustered Adaptive Servers.
(clusters only) specifies the device as private and sets its owning instance to instance_name.
Does not initialize pages with zeroes:
disk init name="d2", physname="/usr/sybase/devices/d3.dat", skip_alloc="true", size="10G"
Adaptive Server does not allocate space during disk initialization if skip_alloc is set to true.
Initializes 10MB of a disk on a UNIX system:
disk init name = "user_disk", physname = "/dev/rxy1a", vdevno = 2, size = 5120
Initializes 10MB of a disk on a UNIX operating system file. Adaptive Server opens the device file with the dsync setting, and writes to the file are guaranteed to take place directly on the storage media:
disk init name = "user_file", physname = "/usr/u/sybase/data/userfile1.dat", vdevno = 2, size = 5120, dsync = true
Creates a device named “user_disk” that uses directio to write data directly to disk:
disk init name = "user_disk", physname = "/usr/u/sybase/data/userfile1.dat", size = 5120, directio= true
creates a device named inmemory_dev:
disk init name = inmemory_dev, physname = 'imdb_cache', size = '3G', type = 'inmemory'
disk init and disk reinit display a warning message if you attempt to create a block device on a platform that Sybase recommends that you not use block device.
Sybase recommends that you use block devices as a database device only on the HP-UX, Windows, and Linux platforms.
Use skip_alloc to expedite crash recovery on non-NT file systems and on NT raw systems. Also, using skip_alloc with the directio feature creates device faster and improves durability of updates. Regardless of space availability, skip_alloc always prints a warning message to users saying they need to make sure Adaptive Server has the required space for future use.
The master device is initialized by the installation program; you need not initialize this device with disk init.
To successfully complete disk initialization, the “sybase” user must have the appropriate operating system permissions on the device that is being initialized.
You can specify the size as a float, but the size is rounded down to the nearest multiple of 2K.
If you do not use a unit specifier for size, disk init uses the virtual page size of 2K.
The minimum size of a disk piece that you can initialize using disk init is the larger of:
One megabyte
One allocation unit of the server’s logical page size
directio and dsync are mutually exclusive. If a device has dsync set to “true,” you cannot set directio to “true” for this device. To enable directio for a device, you must first reset dsync to “false.”
directio is not available on
all platforms. If you issue disk init with the directio parameter
on a platform on which it is not supported, Adaptive Server issues
the message No such parameter: 'directio'
.
Use disk init for each new database device. Each time disk init is issued, a row is added to master..sysdevices. A new database device does not automatically become part of the pool of default database storage. Assign default status to a database device with sp_diskdefault.
Back up the master database with the dump database or dump transaction command after each use of disk init. This makes recovery easier and safer in case master is damaged. If you add a device with disk init and fail to back up master, you may be able to recover the changes by using disk reinit, then stopping and restarting Adaptive Server.
Assign user databases to database devices with the on clause of the create database or alter database command.
The preferred method for placing a database’s transaction log (the system table syslogs) on a different device than the one on which the rest of the database is stored, is to use the log on extension to create database. Alternatively, you can name at least two devices when you create the database, then execute sp_logdevice. You can also use alter database to extend the database onto a second device, then run sp_logdevice. The log on extension immediately moves the entire log to a separate device. The sp_logdevice method retains part of the system log on the original database device until transaction activity causes the migration to become complete.
For a report on all Adaptive Server devices on your system (both database and dump devices), execute sp_helpdevice.
Remove a database device with sp_dropdevice. You must first drop all existing databases on that device.
Do not set dsync to false for
any device that stores critical data. The only exception is tempdb,
which can safely be stored on devices for which dsync is set
to false.
When dsync is on, writes to the database device are guaranteed to take place on the physical storage media, and Adaptive Server can recover data on the device in the event of a system failure.
When dsync is off, writes to the database device may be buffered by the UNIX file system. The UNIX file system may mark an update as being completed, even though the physical media has not yet been modified. In the event of a system failure, there is no guarantee that data updates have ever taken place on the physical media, and Adaptive Server may be unable to recover the database.
dsync is always on for the master device file.
The dsync value should be turned off only when databases on the device need not be recovered after a system failure. For example, you may consider turning dsync off for a device that stores only the tempdb database.
Adaptive Server ignores the dsync setting for devices stored on raw partitions—writes to those device are guaranteed to take place on the physical storage media, regardless of the dsync setting.
disk reinit ensures that master..sysdevices is correct if the master database has been damaged or if devices have been added since the last dump of master.
The logical name of the in-memory device cannot be the same as the name of the cache on which a device is created.
In-memory devices are reserved for the first in-memory database you assign to it.
You must use the physical device name as the logical name of the in-memory device.
The logical name of the in-memory device must be unique across all devices.
You cannot:
Use these parameters when you create an in-memory device: vstart, cntrltype, dsync, directio, and skip_alloc.
Create an in-memory device that is larger than the cache on which it is created.
Create an in-memory device from a regular named cache, including the default data cache.
Increase the size of an in-memory device once it is created. However, you can use sp_cacheconfig to increase the size of the in-memory cache, and use disk init to create new in-memory devices.
Use these commands against in-memory devices: disk resize, disk mirror, disk remirror, disk unmirror, disk refit, and disk reinit.
Use the sp_deviceattr and sp_diskdefault system procedures on disk devices.
The directio parameter is ignored for raw devices.
ANSI SQL – Compliance level: Transact-SQL extension.
disk init permission defaults to System Administrators and is not transferable. You must be using the master database to use disk init.
Values in event and extrainfo columns of sysaudits are:
Event |
Audit option |
Command or access audited |
Information in extrainfo |
---|---|---|---|
20 |
disk |
disk init |
|
Commands alter database, create database, disk refit, disk reinit, dump database, dump transaction, load database, load transaction
System procedures sp_diskdefault, sp_dropdevice, sp_helpdevice, sp_logdevice