📄 457.html
字号:
<br>--------------------------------------------------------------------------------<br><br>For tape media, BLOCKSIZE only applies if the tape is being overwritten by using FORMAT. When using tape <br>media, the backup operation selects an appropriate block size. Explicitly stating a block size overrides <br>the backup operation’s selection of a block size. <br><br>For PIPE, the backup operation uses 65,536 unless BLOCKSIZE is specified. <br><br>DESCRIPTION = {text | @text_variable} <br>Specifies the free-form text describing the backup set. Can be a maximum of 255 characters. <br>DIFFERENTIAL <br>Specifies the database backup should consist only of the portions of the database that have changed since <br>the last full backup. A differential database backup usually takes up less space than a full database. Use <br>this option so that all individual log backups since the last full database backup do not need to be <br>applied. For more information, see Differential Database Backups. <br>The DIFFERENTIAL option is specified for full database backups only. <br><br><br>--------------------------------------------------------------------------------<br><br>Note During a full database or differential backup, SQL Server backs up enough of the transaction log to <br>produce a consistent database when the database is restored. <br><br><br>--------------------------------------------------------------------------------<br><br>EXPIREDATE = {date | @date_var} <br>Specifies the date when the backup set expires and can be overwritten. If supplied as a variable <br>(@date_var), this date can be specified as either a string constant (@date_var = date), as a variable of <br>character string data type (except for the ntext or text data types), a smalldatetime, or datetime <br>variable, and it must follow the configured datetime format for the system. This option is used for disk <br>and tape devices only and is effective only when specified with all backup sets on the media. <br>RETAINDAYS = {days | @days_var} <br>Specifies the number of days that must elapse before this backup media set can be overwritten. If supplied <br>as a variable (@days_var), it must be specified as an integer. This option is used for disk and tape <br>devices only and is effective only when specified with INIT. Specifying SKIP overrides this option. <br>--------------------------------------------------------------------------------<br><br>Important If EXPIREDATE or RETAINDAYS is not specified, expiration is determined by the media retention <br>configuration setting of sp_configure. These options only prevent SQL Server from overwriting a file. <br>Tapes can still be erased using other methods, and disk files can still be deleted through the operating <br>system. <br><br><br>--------------------------------------------------------------------------------<br><br>FORMAT <br>Specifies that the media header should be written on all volumes used for this backup operation and <br>rewrites the backup device. Any existing media header is overwritten. The FORMAT option also invalidates <br>the entire media contents, ignoring any existing password. <br>--------------------------------------------------------------------------------<br><br>Important Use FORMAT carefully. Initializing one backup device or medium renders the entire backup set it <br>contains unusable. For example, if a single tape belonging to an existing striped backup set is <br>initialized, the entire backup set is rendered useless. <br><br><br>--------------------------------------------------------------------------------<br><br>By specifying FORMAT, the backup operation implies SKIP and INIT; these do not need to be explicitly <br>stated. <br><br>NOFORMAT <br>Specifies the media header should not be written on all volumes used for this backup operation and does <br>not rewrite the backup device unless INIT is specified. <br>INIT <br>Specifies the backup set should be the first file on the disk or tape device and preserves the media <br>header. If INIT is specified, any existing data on that device is overwritten. <br>The backup media is not overwritten if either of the following conditions is met: <br><br>All backup sets on the media have not yet expired. For more information, see the EXPIREDATE and RETAINDAYS <br>options. <br>The backup set name given in the BACKUP statement, if provided, does not match the name on the backup <br>media. For more information, see the NAME clause. <br>Use the SKIP clause to override these checks. For more information about interactions when using SKIP, <br>NOSKIP, INIT, and NOINIT, see the Remarks section. <br><br><br>--------------------------------------------------------------------------------<br><br>Note If the backup media is password-protected or encrypted, SQL Server does not write to the media. To <br>overwrite media that is either password-protected or encrypted, specify the WITH FORMAT option. <br><br><br>--------------------------------------------------------------------------------<br><br>NOINIT <br>Specifies the backup set is appended to the current disk or tape device. NOINIT is the default. <br>MEDIADESCRIPTION = {text | @text_variable} <br>Specifies the free-form text description, maximum of 255 characters, of the media set. <br>MEDIANAME = {media_name | @media_name_variable} <br>Specifies the media name, a maximum of 128 characters, for the entire backup media set. If MEDIANAME is <br>specified, it must match the previously specified media name already existing on the backup volume(s). If <br>not specified or if the SKIP option is specified, there is no verification check of the media name. <br>--------------------------------------------------------------------------------<br><br>Note If FORMAT is specified, MEDIANAME specifies the media name that is written. In addition, tapes shared <br>between SQL Server database backups and Microsoft Windows NT&reg; backups must have a nonnull MEDIANAME. <br><br><br>--------------------------------------------------------------------------------<br><br>NAME = {backup_set_name | @backup_set_var} <br>Specifies the name of the backup set. Names are limited to 128 characters. If NAME is not specified, it is <br>blank. <br>NOSKIP <br>Instructs the BACKUP statement to check the expiration date and name of all backup sets on the media <br>before allowing them to be overwritten. <br>SKIP <br>Disables the backup set expiration and name checking, which is usually performed by the BACKUP statement <br>to prevent overwrites of backup sets. For more information, see the Remarks section. <br>NOUNLOAD <br>Specifies the tape is not unloaded automatically from the tape drive after a backup. NOUNLOAD remains set <br>until UNLOAD is specified. This option is used only for tape devices. <br>UNLOAD <br>Specifies that the tape is automatically rewound and unloaded when the backup is finished. UNLOAD is set <br>by default when a new user session is started. It remains set until that user specifies NOUNLOAD. This <br>option is used only for tape devices. <br>RESTART <br>Specifies that SQL Server restarts the backup operation that was interrupted. The RESTART option saves <br>time because it restarts the backup operation at the point it was interrupted. To RESTART a specific <br>backup operation that was interrupted, repeat the entire BACKUP statement and add the RESTART option. <br>Using the RESTART option is not required, but can save time. <br>--------------------------------------------------------------------------------<br><br>Important This option can only be used for backups directed to tape media and for backups that span <br>multiple tape volumes. A restart operation never occurs on the first volume of the backup. <br><br><br>--------------------------------------------------------------------------------<br><br>STATS [ = percentage] <br>Displays a message every time another percentage completes, and is used to gauge progress. If percentage <br>is omitted, SQL Server displays a message after every 10 percent completed. <br><file_or_filegroup> <br>Specifies the logical names of the files or filegroups to include in the database backup. Multiple files <br>or filegroups may be specified. <br>FILE = {logical_file_name | @logical_file_name_var} <br>Names one or more files to include in the database backup. <br>FILEGROUP = {logical_filegroup_name | @logical_filegroup_name_var} <br>Names one or more filegroups to include in the database backup. <br>--------------------------------------------------------------------------------<br><br>Note Back up a file when the database size and performance requirements make a full database backup <br>impractical. To back up the transaction log separately, use BACKUP LOG. <br><br><br>--------------------------------------------------------------------------------<br><br>--------------------------------------------------------------------------------<br><br>Important To recover a database using file and filegroup backups, a separate backup of the transaction log <br>must be provided by using BACKUP LOG. For more information about file backups, see Creating File or <br>Filegroup Backups. <br><br><br>--------------------------------------------------------------------------------<br><br>File and filegroup backups are disallowed if trunc. log on chkpt. is enabled for the database. If trunc. <br>log on chkpt. is enabled, the log has been truncated and the log backups required to restore individual <br>files and filegroups are not available. <br><br>The BACKUP statement requires that entire filegroups affected by a CREATE INDEX statement since the last <br>filegroup backup be backed up as a unit: <br><br>If an index is created on a filegroup, that entire filegroup must be backed up in a single backup <br>operation. Backups of individual files that are part of the affected filegroup are not allowed. <br>If an index is created on a filegroup different from the one that the table resides in, then both <br>filegroups (the filegroup containing the table and the filegroup containing the newly created index) must <br>be backed up. If more than one index is created on a filegroup different from the filegroup in which the <br>table resides, all filegroups must immediately be backed up to accommodate these differing filegroups. <br>The BACKUP statement detects all of these filegroup situations and communicates to the backup user the <br>minimum filegroups that must be backed up. <br><br>n <br>Is a placeholder indicating that multiple files and filegroups may be specified. There is no maximum <br>number of files or filegroups. <br>LOG <br>Specifies a backup of the transaction log only. The log is backed up from the last successfully executed <br>LOG backup to the current end of the log. By default, SQL Server truncates the log up to the beginning of <br>the active portion of the log, which contains the oldest open transaction. <br>--------------------------------------------------------------------------------<br><br>Note If backing up the log does not appear to truncate most of the log, you may have a very old open <br>transaction in the log. Log space can be monitored with DBCC SQLPERF (LOGSPACE). <br><br><br>--------------------------------------------------------------------------------<br><br>NO_LOG | TRUNCATE_ONLY <br>Removes the inactive part of the log without making a backup copy of it and truncates the log. This option <br>frees space. Specifying a backup device is unnecessary because the log backup is not saved. NO_LOG and <br>TRUNCATE_ONLY are synonyms. <br>After backing up the log using either NO_LOG or TRUNCATE_ONLY, the changes recorded in the log are not <br>recoverable. For recovery purposes, immediately execute BACKUP DATABASE. <br><br>If the log of a published (replicated) database becomes full and absolutely must be truncated, unsubscribe <br>all subscriptions to the publications of that database. This allows you to truncate all distributed <br>transactions. <br><br>NO_TRUNCATE <br>Backs up the log without truncating it. This option also backs up the log if the database becomes damaged <br>or if the database is marked suspect or has not been recovered. <br>Remarks<br>Database or log backups can be appended to any disk or tape device, allowing you to keep a database and <br>its transaction logs all within one physical location. <br><br>SQL Server uses online backup to allow a database backup while the database is still in use. However, here <br>are some operations that are not allowed during a database or transaction log backup: <br><br>File management operations such as the ALTER DATABASE statement with either the ADD FILE or REMOVE FILE <br>options; INSERT, UPDATE, or DELETE statements are allowed during a backup operation. <br>Shrink database or shrink file. This includes autoshrink operations. <br>CREATE INDEX. This restriction applies to database backup, not log backup. <br>Nonlogged operations such as bulk load, SELECT INTO, WRITETEXT, and UPDATETEXT. The database option select <br>into/bulkcopy must be enabled for these operations to be nonlogged. <br>If a backup is started when one of these operations is in progress, the backup ends. If a backup is <br>running and one of these operations is attempted, the operation fails.<br><br>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -