disk reinit

Description

Rebuilds the master database’s sysdevices system table. Use disk reinit as part of the procedure to restore the master database.

Syntax

disk reinit 
	name = "device_name", 
	physname = "physicalname" , 
	[vdevno = virtual_device_number ,]
	size = number_of_blocks 
	[, vstart = virtual_address 
		, cntrltype = controller_number]
		[, dsync = {true | false}]
	[, directio = {true | false}]
	[, instance = "instance_name"]

Parameters

name

is the name of the database device, which 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.

physname

is the name of the database device. The physical name must be enclosed in single or double quotes.

vdevno

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 are 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.

size

is the current size of the device being reinitialized. The following are example unit specifiers, using uppercase, lowercase, and 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.

vstart

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, lowercase, and 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. If you do not provide a unit specifier, the value provided is presumed to be in megabytes. 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 it as the starting address. For example, if you specify vstart = "13M", Adaptive Server sets the starting address offset at 13MB.

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, disk reinit fails.

NoteIf 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.

cntrltype

specifies the disk controller. Its default value is 0. Reset it only if instructed to do so by Sybase Technical Support.

dsync

specifies whether writes to the database device are flushed to the storage media, or are buffered only 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.

directio

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.

The directio parameter is ignored for raw devices.

instance = "instance_name"

(clusters only) specifies the device as private and sets its owning instance to instance_name.

Examples

Example 1

Adds a new row to the sysdevices table. This new row contains the characteristics of the existing device currently being reinitialized:

disk reinit 
name = "user_file", 
physname = "/usr/u/sybase/data/userfile1.dat", 
vdevno = 2, size = 5120, dsync = true

Example 2

Adds a new row to the sysdevices table, with the data transferred directly to disk. This new row contains the characteristics of the existing device currently being reinitialized:

disk reinit 
name = "user_disk", 
physname = "/usr/u/sybase/data/userfile1.dat", 
size = 5120, directio= true

Usage


Using dsync

Note 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.

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

The permission checks for disk reinit differ based on your granular permissions settings. You must be using the master database to use disk reinit.

Granular permissions enabled

With granular permissions enabled, you must be a user with manage disk privilege.

Granular permissions disabled

With granular permissions disabled, you must be a user with sa_role.

disk reinit permission is not transferable.

Auditing

Values in event and extrainfo columns of sysaudits are:

Event

Audit option

Command or access audited

Information in extrainfo

22

disk

disk reinit

  • Roles – current active roles

  • Keywords or optionsdisk reinit

  • Previous value – NULL

  • Current value – NULL

  • Other information – name of the disk

  • Proxy information – original login name, if set proxy is in effect

See also

Commands alter database, create database, dbcc, disk init, disk refit

System procedures sp_addumpdevice, sp_helpdevice