码迷,mamicode.com
首页 > 其他好文 > 详细

对备份存储媒介进行格式化

时间:2016-07-10 23:02:05      阅读:179      评论:0      收藏:0      [点我收藏+]

标签:

今天在进行数据库文件备份时,SQL Server抛出错误:

Executed as user: NT SERVICE\SQLSERVERAGENT. The backup data at the end of "xxxx.bak" is incorrectly formatted.

Backup sets on the media might be damaged and unusable.

To determine the backup sets on the media, use RESTORE HEADERONLY.

To determine the usability of the backup sets, run RESTORE VERIFYONLY. If all of the backup sets are 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 进行格式,Init 不会对media header进行初始化,而format是格式化整个media,这两个Option都会使数据库文件backup不可用,必须慎重。

{ 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 is 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 be overwritten, but preserves the media header. If INIT is specified, any existing backup set on that 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 has 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 in this section.

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 existing 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 be 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 are 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

 

参考doc:

BACKUP (Transact-SQL)

Media Sets, Media Families, and Backup Sets (SQL Server)

对备份存储媒介进行格式化

标签:

原文地址:http://www.cnblogs.com/ljhdo/p/4986419.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!