SQL server throws an error today while making a database file backup:
Executed as User:nt service\sqlserveragent. The backup data at the end of "Xxxx.bak" is incorrectly formatted.
Backup sets on the media might is damaged and unusable.
To determine the backup sets on the media, use the RESTORE headeronly.
To determine the usability of the backup sets, run RESTORE verifyonly. If all of the backup sets is incomplete, reformat the media using Backup with FORMAT, which destroys all the backup sets. [SQLSTATE 42000] (Error 3266) BACKUP DATABASE is terminating abnormally. [SQLSTATE 42000] (Error 3013). The step failed.
Media Set needs to be formatted, INIT does not initialize the media header, and format is formatting the entire media, and these two option will make the database file backup unusable and must be cautious.
{ Noinit | INIT}
Controls whether the backup operation appends to or overwrites the existing backup sets on the backup media. The default is to append to the most recent backup set on the media (NOINIT).
-
- Noinit
-
-
Indicates that the backup set are appended to the specified media set, preserving existing backup sets. If a media password is defined for the media set, the password must be supplied. Noinit is the default.
-
- Init
-
-
Specifies that all backup sets should is overwritten, but preserves the media header. If INIT is specified, any existing backup set on this device is overwritten, if conditions permit. By default, backup checks for the following conditions and does not overwrite the BACKUP media if either condition exists:
Any backup set have not yet expired. For more information, see the ExpireDate and Retaindays options.
The backup set name given in the backup statement, if provided, does not match the name on the backup media. For more information, see the NAME option, earlier.
To override these checks, use the SKIP option.
{ Noformat | FORMAT}
Specifies whether the media header should be written on the volumes used for this backup operation, overwriting any Existi NG Media Header and backup sets.
-
- Noformat
-
-
Specifies that the backup operation preserves the existing media header and backup sets on the media volumes used for this Backup operation. This is the default behavior.
-
- FORMAT
-
-
Specifies that a new media set is created. FORMAT causes the backup operation to write a new media header on all media volumes used for the backup operation . The existing contents of the volume become invalid, because any existing media header and backup sets is overwritten.
specifying FORMAT implies SKIP; SKIP does not need to be explicitly stated.
Use FORMAT carefully. Formatting any volume of a media set renders the entire media set unusable. For example, if you initialize a single tape belonging to an existing striped media set, the entire media set is rendered Useless
Reference doc:
BACKUP (Transact-SQL)
Media sets, media families, and Backup sets (SQL Server)
Format the backup storage media