disk mirror

Description

Creates a software mirror that immediately takes over when the primary device fails.

Syntax

disk mirror 
	name = "device_name", 
	mirror = "physicalname" 
	[, writes = {serial | noserial}]
	[clear = {TRUE | FALSE}]

Parameters

name

is the name of the database device to mirror. This is recorded in the name column of the sysdevices table. The name must be enclosed in single or double quotes.

mirror

is the full path name of the database mirror device that is to be your secondary device. It must be enclosed in single or double quotes. If the secondary device is a file, physicalname should be a path specification that clearly identifies the file, which Adaptive Server creates. The value of physicalname cannot be an existing file.

writes

allows you to choose whether to enforce serial writes to the devices. In the default case (serial), the write to the primary database device is guaranteed to finish before the write to the secondary device begins. If the primary and secondary devices are on different physical devices, serial writes can ensure that at least one of the disks is unaffected in the event of a power failure. serial writes are generally slower than noserial writes.

clear

initializes the mirror device with zeros to guarantee that the underlying filesystem has reserved space for the mirror device. The default value, FALSE, does not clear the mirror, and executing a write to the device might fail through lack of space on the file system. If you specify TRUE, the mirror is cleared, forcing the file system to reserve space for the device.

Examples

Example 1

tranlog is the logical device name for a raw device. The tranlog device was initialized with disk init and is being used as a transaction log device (as in create database...log on tranlog). The following command mirrors the transaction log device:

disk mirror 
  name = "tranlog", 
  mirror = "/dev/rxy1e"

Example 2

Creates a software mirror for the database device user_disk on the file mirror.dat:

disk mirror 
    name = "user_disk", 
    mirror = "/server/data/mirror.dat"

Usage

Standards

ANSI SQL – Compliance level: Transact-SQL extension.

Permissions

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

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 mirror permission is not transferable.

Auditing

Values in event and extrainfo columns of sysaudits are:

Event

Audit option

Command or access audited

Information in extrainfo

23

disk

disk mirror

  • Roles – current active roles

  • Keywords or optionsdisk mirror

  • 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, disk init, disk refit, disk reinit, disk remirror, disk unmirror, dump database, dump transaction, load database, load transaction

System procedures sp_diskdefault, sp_helpdevice, sp_logdevice

Utilities dataserver, startserver