The ‘SQL error 3266’ occurs when the SQL Server detects filemark error on the backup device.
Here at Bobcares, we have seen several such SQL related issues as part of our Server Management Services for web hosts and online service providers.
Today we’ll take a look at the cause for this error and see how to fix it.
What does SQL error message 3266 mean
Normally, this error message occurs when the SQL Server detects filemark error on the backup device. The error appears as below.
The backup data in ‘\NetworkSharebackupfilename.bak’ is incorrectly formatted. Backups cannot be appended, but existing backup sets may still be usable. [SQLSTATE 42000] (Error 3266) BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
The filemark for a backup contains all the details of a backup device like the size of the block, the number of blocks in a device, etc.
In case, if a filemark error occurs then the SQL treats the entire backup media as corrupt. Then it won’t write any more data on the backup media.
Reasons for SQL error 3266 to occur
There are many reasons for this filemark error to occur. A few of them are as follows.
- A media failure on the device may occur where the backup is stored.
- If a write failure occurs during the creation of the backup.
- During the network backup procedure, if a connectivity loss occurs.
- Insufficient space. The database size is 2GB whereas a separate database is larger than 2 GB. So it is stored in an existing database.
- Even though the filemark is available, the database is unable to read it. Or inaccessibility of file mark itself.
How we resolve ‘SQL error 3266’
The solution to this error is quite easy.
- The first option is to delete the existing backup file.
- Another option is to use the ‘with format’ option in the backup script.
If you are going with the first option then run the below command to delete the old backup file.
xp_cmdshell ‘del \NetworkshareBackupFileName.bak’
The xp_cmdshell command executes under the credentials of the SQL Server service account. After the backup file gets deleted, next time onwards the database must be backed up to the network share successfully.
[Need any assistance in fixing SQL errors? – We’ll help you]
Conclusion
In short, this error occurs when the SQL Server detects filemark error on the backup device. Today, we saw the different reasons for this error to occur. Also, we saw the fix provided by our Support Engineers.
0 Comments