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.java: 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.java: Configure the file and backup file