Database Doctor

The ObjectDB Doctor tool provides two related services:

  • Diagnose and validate an ObjectDB database file: Checks a specified ObjectDB database file to verify its integrity. If the file is corrupted, the tool produces a detailed diagnostic report that lists all errors.
  • Repair a corrupted ObjectDB database file: Creates a new database file and copies all recoverable data from the corrupted file to the new file.

Corrupted database files

Database files can be damaged or corrupted for several reasons:

  • Hardware failure (for example, a physical hard drive failure or RAM error).
  • Software failure (for example, a bug in the operating system, Java, or ObjectDB).
  • Copying a database file while it is in use.
  • A network or I/O failure when copying, moving, or transferring a database file.
  • Transferring a database file over FTP in ASCII mode instead of the required BINARY mode.
  • Deleting a database's recovery file or recording directory.
  • Copying, moving, or transferring a database file without its corresponding recovery file or recording directory.
  • A power failure during a database update if the recovery file is disabled.
  • Using the database file with two simultaneous instances of the ObjectDB engine instead of a single server process, which bypasses the internal file-locking protection.
  • Modifying the database file externally instead of through ObjectDB (for example, with malicious software such as a computer virus).

For these reasons, you should back up database files regularly. We also recommend that you regularly validate production database files (or their backups) by running the ObjectDB Doctor diagnosis to identify potential problems early.

Running doctor diagnosis

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

You can run the tool from the command line:

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

If objectdb.jar is not in the current directory, you must specify the path to the file.

The tool's main class is com.objectdb.Doctor. The only command-line argument for a diagnosis is the path to the database file (for example, my.odb).

The diagnosis results are written to standard output.

Running doctor repair

To run the ObjectDB Doctor in repair mode, specify two command-line arguments:

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

The arguments are as follows:

  • The first argument (old.odb) is the path to the corrupted database file.
  • The second argument (new.odb) is the path for the new database file that the ObjectDB Doctor generates.