Maintaining System Security in Case of Disk Failure

Since disk failure can impair system security, the WAITFOR statement can perform certain tasks when a disk becomes unmirrored. This is syntax for the WAITFOR statement:

BEGIN
WAITFOR MIRROREXIT
<commands to be executed>
END

The commands to be executed depend on the application. Some possibilities include adding warning messages in applications that perform updates and using sp_dboption to make certain databases read-only.

Note SQL Server can detect that a disk has become unmirrored only when it attempts to write to the mirror device. On mirrored databases, this occurs at a checkpoint or whenever the SQL Server buffer must be written to disk. On mirrored logs, a write occurs whenever a row is changed with UPDATE, INSERT, or DELETE. The WAITFOR MIRROREXIT statement is activated only by these events.