To mirror a device an option 'disable disk mirroring' must be set to off. Following command allows to verify this setting:
execute sp_configure 'disable disk mirroring'
In case the option would be set to true, you can change it's value starting:
sp_configure 'disable disk mirroring', 0
That option is static - this means server restart is required to make mirroring possible.
To start mirroring all you need is a source device to mirror and a file system or raw device big enough to accommodate the mirrored device. Following command will create a mirror for the device named MirrorDev1:
disk mirror name = MirrorDev1, mirror = '/opt/sap/databases/alfa/mirrordev2.dat', writes = serial
Parameters of this command are:
- name of source device, that should be mirrored. That device must exist in the moment of starting the command and may be used by databases.
- mirror file/device where the copy will reside. If this parameter point to file, it cannot exist. It will be created by disk mirror command
- writes parameter can have one of following values: "serial" - what means writes to both source and mirrored device must be completed to continue next operations by ASE server or noserial - what means operations are allowed after finishing write to source device. In this case write to mirrored device will be done asynchronously, what is a faster solution but in case of failure on first device, data stored in mirror may be corrupted.
- clear parameter with values true or false. True means that during creation of the mirror the destination file/device will be filled with zeros. This takes longer, but is more secure and wull reserve space on destination file system. The default value is however false.
If during IO operation an error would be recorded, the failing device will no more be used. Information in sysdevices table regarding mirroring will be set to DISABLED and an error will be recorded in errorlog. Sybase ASE will function using the mirrored device. In that moment also a mirrorexit signal will be released, allowing to prepare some scripts, that will be started in a case of mirror being disabled. To catch mirrorexit signal following script template could be used:
This code is not permanent, if you wish to have it enabled you need to start the script always after Sybase ASE starts.
To disable mirroring start:
Here is the meaning of the options:
waitfor mirrorexit begin --some logic here end
This code is not permanent, if you wish to have it enabled you need to start the script always after Sybase ASE starts.
To disable mirroring start:
disk unmirror name = 'MirrorDev1', side = 'secondary', mode = 'remove'
Here is the meaning of the options:
- name specifies the name of device being unmirrored
- side decides about this on which device Sybase will stop writing. The default is 'secondary'. The another value can be 'primary' (See Moving database device using mirroring for practical use of that option)
- mode can have value of 'retain' or 'remove'. Remove is simple, as information in sysdevices will be brought to previous state, before mirroring was enabled. Retain causes that device will no more be mirrored, but the entire configuration remains in disabled state. This can be handy if mirroring should be started in short time again. When this will happen server will need to copy all the data again from primary to secondary device, but command is much simpler:
disk remirror name = 'MirrorDev1'
No comments:
Post a Comment