Backup Method

Collapse All Expand All Code: All Code: Multiple Code: C# Code: Visual Basic Code: Visual C++

C#
Visual Basic
Visual C++

Berkeley DB .NET API Documentation
DatabaseEnvironment..::.Backup Method
DatabaseEnvironment Class See Also Send Feedback

Perform a hot back up of the open environment.

All files used by the environment are backed up, so long as the normal rules for file placement are followed. For information on how files are normally placed relative to the environment directory, see the "Berkeley DB File Naming" section in the Berkeley DB Reference Guide.

By default, data directories and the log directory specified relative to the home directory are recreated relative to the target directory. If absolute path names are used, then use the SingleDir method.

This method provides the same functionality as the db_hotbackup utility. However, this method does not perform the housekeeping actions performed by that utility. In particular, you may want to run a checkpoint before calling this method. To run a checkpoint, use the Checkpoint()()() method. For more information on checkpoints, see the "Checkpoint" section in the Berkeley DB Reference Guide.

To back up a single database file within the environment, use the BackupDatabase(String, String, Boolean) method.

In addition to the configuration options available using the BackupOptions class, additional tuning modifications can be made using the BackupReadCount, BackupReadSleepDuration, BackupBufferSize, and BackupWriteDirect properties. Alternatively, you can write your own custom hot back up facility using the IBackup interface.

Namespace: BerkeleyDB
Assembly: libdb_dotnet181 (in libdb_dotnet181.dll) Version: 18.1.32.0

# Syntax

C#
    public void Backup(
    	string target,
    	BackupOptions opt
    )

Visual Basic (Declaration)
    Public Sub Backup ( _
    	target As String, _
    	opt As BackupOptions _
    )

Visual C++
    public:
    void Backup(
    	String^ target,
    	BackupOptions^ opt
    )

#### Parameters

target
  Type: System..::.String
  Identifies the directory in which the back up is placed. Any subdirectories required to contain the back up must be placed relative to this directory. If an IBackup is configured for the environment, then the value specified to this parameter is passed on to the Open(String, String) method. If this parameter is null, then the target must be specified to the Open(String, String) method.

  This directory, and any required subdirectories, are created for you if you specify IF_NEEDED or ALWAYS for the Creation property.

opt
  Type: BerkeleyDB..::.BackupOptions
  The BackupOptions instance used to configure the hot back up.

# See Also

DatabaseEnvironment Class
BerkeleyDB Namespace