You are here: Advanced Features > Defragment > Defragmentation Configuration > Original Database And Backup

Original Database And Backup

The database-file which needs to be defragmented is specified in the configuration. The first constructor parameter is the database file.

DefragmentConfig config = new DefragmentConfig("database.db4o");

Defragment.Defrag(config);
DefragmentationConfigurationExamples.cs: Configure the file
Dim config As New DefragmentConfig("database.db4o")

Defragment.Defrag(config)
DefragmentationConfigurationExamples.vb: Configure the file

The defragmentation process creates a backup of the old database. By default the back-up file has the name of the original database-file with an additional '.backup'-suffix. You can explicitly specify the backup file name with the second constructor parameter.

DefragmentConfig config = new DefragmentConfig("database.db4o", "database.db4o.back");

Defragment.Defrag(config);
DefragmentationConfigurationExamples.cs: Configure the file and backup file
Dim config As New DefragmentConfig("database.db4o", "database.db4o.back")

Defragment.Defrag(config)
DefragmentationConfigurationExamples.vb: Configure the file and backup file