Error 21 message when trying to use a cloned database Error 21 message when trying to use a cloned database

Error 21 message when trying to use a cloned database

The ERROR 21 message is an issue where the CLONE database can no longer see the IMAGE on the network share. SQL Clone does have an inbuilt fail safe to try and minimize the impact of a network blip. The SQL Clone software will periodically monitor for when the image is no longer reachable from the clone machine and will try to take the clone database(s) offline. This process should be self-healing and the clone should be brought back online when the image is visible again. This process can result in the Clone databases being left in a recovery pending state before being brought back online.

Due to the architecture of SQL Clone, we are reliant on the Network link between the image and the clone being up 100% of the time and any outage will disrupt the usage of the clones.

If the image watcher code is unable to detach the Clone database before the network outage the clones will display the error below:

The operating system returned error 21(The device is not ready.) to SQL Server during a read at offset 0x000000000in file '<FILEPATH>'. Additional messages in the SQL Server error log and system event log may provide more detail. This is a severe system-level error condition that threatens database integrity and must be corrected immediately. Complete a full database consistency check (DBCC CHECKDB). This error can be caused by many factors; for more information, see SQL Server Books Online. ALTER DATABASE statement failed. (SqlException).

To fix this error you need to ensure the Image location is reachable from the machine hosting the Clone and restart the SQL Server Service on the Clone machine.