waitfor mirrorexit

Since disk failure can impair system security, you can include the waitfor mirrorexit command in an application to perform specific tasks when a disk becomes unmirrored:

begin 
    waitfor mirrorexit 
    commands to be executed 
end 

The commands depend on your applications. You may want to add certain warnings in applications that perform updates or use sp_dboption to make certain databases read-only if the disk becomes unmirrored.

NoteAdaptive Server knows that a device has become unmirrored only when it attempts I/O to the mirror device. On mirrored databases, this occurs at a checkpoint or when the Adaptive Server buffer must be written to disk. On mirrored logs, I/O occurs when a process writes to the log, including any committed transaction that performs data modification, a checkpoint, or a database dump.

waitfor mirrorexit and the error messages that are printed to the console and error log on mirror failure are activated only by these events.