End Of Media and Unexpected Filemarks

Microsoft SQL Server Virtual Backup

Microsoft SQL Server Virtual Backup Device Specification

End Of Media and Unexpected Filemarks

For nonremovable devices, there is no available response to an end-of-file or disk-full condition. Microsoft® SQL Server™ aborts the operation in this situation.

Proper handling of end of media, especially with overlapped, asynchronous I/O, for removable devices can be challenging.

In the case of RESTORE operations, SQL Server has one or more read operations issued to a device when one of the following errors is returned:

  • ERROR_NO_DATA_DETECTED

  • ERROR_HANDLE_EOF

  • ERROR_FILEMARK_DETECTED

SQL Server waits for any other outstanding I/O to complete. After determining that the backup set was properly terminated, SQL Server issues a VDC_Load command to begin processing the next media.

During RESTORE operations, SQL Server either terminates or continues depending on the operation being performed and the state of the medium. For example, RESTORE can be used to restore data to the database, to scan tapes, to verify media, and so on.

During BACKUP operations, removable devices respond with ERROR_END_OF_MEDIA when an end-of-medium warning zone is reached. SQL Server currently requires that all I/O pending at the time this warning occurs must be stored. If the bytesWritten does not equal the requested number of bytes, SQL Server reissues the write requests. If the device cannot store the queued data, SQL Server aborts the BACKUP. SQL Server attempts to avoid overrunning this warning zone by responding to the size of the zone reported in the device configuration.

Clients supporting removable media may hide the end-of-media conditions from SQL Server. When end-of-media conditions are hidden, the native SQL Server support of the backup set is prevented. SQL Server is not able to read the backup set directly from the media without the assistance of the client application. In such cases, the client should indicate, by configuration, that the media is not a removable device.