disk mirror

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

Examples

Usage

  • Disk mirroring creates a software mirror of a user database device, the master database device, or a database device used for user database transaction logs. If a database device fails, its mirror immediately takes over.

    Disk mirroring does not interfere with ongoing activities in the database. You can mirror or unmirror database devices without shutting down the SAP ASE server.

  • Use dump database to back up the master database after each use of disk mirror. This makes recovery easier and safer in case master is damaged.

  • When a read or write to a mirrored device is unsuccessful, the SAP ASE server unmirrors the bad device and prints error messages. The SAP ASE server continues to run, unmirrored. The system administrator must use the disk remirror command to restart mirroring.

  • The clear option in this command has no effect when used on the NT platform.

  • You can mirror the master device, devices that store data, and devices that store transaction logs. However, you cannot mirror dump devices.

  • Devices are mirrored; databases are not.

  • A device and its mirror constitute one logical device. The SAP ASE server stores the physical name of the mirror device in the mirrorname column of the sysdevices table. It does not require a separate entry in sysdevices and should not be initialized with disk init.

  • To retain use of asynchronous I/O, always mirror devices that are capable of asynchronous I/O to other devices capable of asynchronous I/O. In most cases, this means mirroring raw devices to raw devices and operating system files to operating system files.

    If the operating system cannot perform asynchronous I/O on files, mirroring a raw device to a regular file produces an error message. Mirroring a regular file to a raw device works, but does not use asynchronous I/O.

  • On systems that support asynchronous I/O, the writes option allows you to specify whether writes to the first device must finish before writes to the second device begin (serial) or whether both I/O requests are to be queued immediately, one to each side of the mirror (noserial). In either case, if a write cannot be completed, the I/O error causes the bad device to become unmirrored

  • Mirror all default database devices so that you are still protected if a create database or alter database command affects a database device in the default list.

  • For greater protection, mirror the database device used for transaction logs.

  • Always put user database transaction logs on a separate database device. To put a database’s transaction log (that is, the system table syslogs) on a device other than the one on which the rest of the database is stored, name the database device and the log device when you create the database. Alternatively, use alter database to extend the database onto a second device, then run sp_logdevice.

  • If you mirror the database device for the master database, you can use the -r option and the name of the mirror for UNIX, when you restart the SAP ASE server with the dataserver utility program. Add this to the RUN_servername file for that server so that the startserver utility program knows about it. For example, to start a master device named master.dat and its mirror, mirror.dat enter:
    dataserver -dmaster.dat -rmirror.dat

    See dataserver and startserver in the Utility Guide.

  • If you mirror a database device that has unallocated space (room for additional create database and alter database statements to allocate part of the device), disk mirror begins mirroring these allocations when they are made, not when the disk mirror command is issued.

  • For a report on all SAP ASE devices on your system (user database devices and their mirrors, as well as dump devices), execute sp_helpdevice.

See also:
  • sp_diskdefault, sp_helpdevice, sp_logdevice in Reference Manual: Procedures

  • dataserver, startserver in the Utility Guide

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.

SettingDescription
Enabled

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

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:

InformationValues
Event

23

Audit option

disk

Command or access audited

disk mirror

Information in extrainfo
  • 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

Related reference
disk remirror
disk init
create database
alter database
disk refit
disk reinit
disk unmirror
dump database
dump transaction
load database
load transaction