Delen via


How to: Back Up a Transaction Log (SQL Server Management Studio)

For databases that are using either the full or bulk-logged recovery model, you should back up the transaction log.

Note

For information about how to use transaction log backups, see Working with Transaction Log Backups.

To back up a transaction log

  1. After connecting to the appropriate instance of the Microsoft SQL Server Database Engine, in Object Explorer, click the server name to expand the server tree.

  2. Expand Databases, and, depending on the database, either select a user database or expand System Databases and select a system database.

  3. Right-click the database, point to Tasks, and then click Back Up. The Back Up Database dialog box appears.

  4. In the Database list box, verify the database name. You can optionally select a different database from the list.

  5. Verify that the recovery model is either FULL or BULK_LOGGED.

  6. In the Backup type list box, select Transaction Log.

  7. Either accept the default backup set name suggested in the Name text box, or enter a different name for the backup set.

  8. Optionally, in the Description text box, enter a description of the backup set.

  9. Specify when the backup set will expire:

    • To have the backup set expire after a specific number of days, click After (the default option), and enter the number of days after set creation that the set will expire. This value can be from 0 to 99999 days; a value of 0 days means that the backup set will never expire.
      The default value is set in the Default backup media retention (in days) option of the Server Properties dialog box (Database Settings page). To access this dialog box, right-click the server name in Object Explorer and select properties; then select the Database Settings page.
    • To have the backup set expire on a specific date, click On, and enter the date on which the set will expire.
  10. Choose the type of backup destination by clicking Disk or Tape. To select the paths of up to 64 disk or tape drives containing a single media set, click Add. The selected paths are displayed in the Backup to list box.

    To remove a backup destination, select it and click Remove. To view the contents of a backup destination, select it and click Contents.

  11. To view or select the advanced options, click Options in the Select a page pane.

  12. Select an Overwrite Media option, by clicking one of the following:

    • Back up to the existing media set
      For this option, click either Append to the existing backup set or Overwrite all existing backup sets. For more information, see Appending to Existing Backup Sets and Overwriting Backup Sets.
      Optionally, select Check media set name and backup set expiration to cause the backup operation to verify the date and time at which the media set and backup set expire.
      Optionally, enter a name in the Media set name text box. If no name is specified, a media set with a blank name is created. If you specify a media set name, the media (tape or disk) is checked to see whether the actual name matches the name you enter here.
      If you leave the media name blank and check the box to check it against the media, success will equal the media name on the media also being blank.
    • Back up to a new media set, and erase all existing backup sets
      For this option, enter a name in the New media set name text box, and, optionally, describe the media set in the New media set description text box. For more information, see Creating a New Media Set.
  13. In the Reliability section, optionally, check:

    • Verify backup when finished.
    • Perform checksum before writing to media, and, optionally, Continue on checksum error. For information on checksums, see Detecting and Coping with Media Errors.
  14. In the Transaction log section:

    • For routine log backups, keep the default selection, Truncate the transaction log by removing inactive entries.
    • To back up the tail of the log (that is, the active log), check Back up the tail of the log, and leave database in the restoring state.
      A tail-log backup is taken after a failure to back up the tail of the log in order to prevent work loss. Back up the active log (a tail-log backup) both after a failure, before beginning to restore the database, or when failing over to a secondary database. Selecting this option is equivalent to specifying the NORECOVERY option in the BACKUP LOG statement of Transact-SQL. For more information about tail-log backups, see Tail-Log Backups.
  15. If you are backing up to a tape drive (as specified in the Destination section of the General page), the Unload the tape after backup option is active. Clicking this option activates the Rewind the tape before unloading option.

    Note

    Alternatively, you can use the Maintenance Plan Wizard to create transaction-log backups.

See Also

Tasks

How to: Create a Transaction Log Backup (Transact-SQL)
How to: Restore a Transaction Log Backup (SQL Server Management Studio)
How to: Restore to a Point in Time (SQL Server Management Studio)
How to: Start the Maintenance Plan Wizard (SQL Server Management Studio)

Concepts

Working with Transaction Log Backups
Maintenance Plan Wizard

Other Resources

Back Up Database (Options Page)
Back Up Database (General Page)
SQL Server Management Studio Tutorial

Help and Information

Getting SQL Server 2005 Assistance