Database Doctor

The ObjectDB Doctor tool provides two related services:

  • Diagnosis and validation of an ObjectDB database file
    Checks a given ObjectDB database file, verifies that it is healthy and valid, and if the file is not valid (it is corrupted), produces a detailed diagnosis report of all the errors.
  • Repair of a corrupted ObjectDB database file
    Repairs a corrupted ObjectDB database file by creating a new fresh database file and then copying all the recoverable data in the corrupted database file to the new database file.

Corrupted Database Files

Database files may be damaged and become corrupted due to various reasons:

  • Hardware failure (e.g. a physical disk failure).
  • Software failure (e.g. a bug of the Operating System, Java or ObjectDB).
  • Copying a database file while it is open and in use.
  • Network or I/O failure when copying, moving or transferring a database file.
  • Transferring a database file over FTP in ASCII mode (BINARY mode should be used).
  • Deleting an ObjectDB database recovery file or recording directory if it exists, or copying, moving or transferring an ObjectDB database file without its recovery file or recording directory.
  • Power failure when the database is being updated - if the recovery file is disabled.
  • Using the database file simultaneously by two instances of the ObjectDB engine (not using one server process), thus bypassing ObjectDB internal file lock protection.
  • Modifying the database file externally not through ObjectDB (e.g. by malicious software such as a computer virus).

Given all these causes it is clear that database files should be backed up regularly and often.
It is also recommended to validate production database files (or their backups) often by running ObjectDB Doctor's diagnosis regularly in order to identify potential problems early on.

Running ObjectDB Doctor Diagnosis

The ObjectDB Doctor tool is bundled in the objectdb.jar file.

It can be run from the command line:

> java -cp objectdb.jar com.objectdb.Doctor my.odb

If objectdb.jar is not in the current directory a path to it has to be specified.

The tool main class is com.objectdb.Doctor and the only command line argument for running a database diagnosis is the path to the database file (e.g. my.odb as shown above).

Diagnosis results are printed to the standard output.

Running ObjectDB Doctor Repair

Running the ObjectDB Doctor in repair mode requires specifying two command line arguments:

> java -cp objectdb.jar com.objectdb.Doctor old.odb new.odb

The first argument (old.odb above) is the path to the original (corrupted) database file.
The second argument (new.odb above) is the path to the new database file to be generated by the ObjectDB Doctor.