DbScavenger (Oracle - Berkeley DB Java Edition API)
Date: 2014-12-16

com.sleepycat.je.util

## Class DbScavenger

- java.lang.Object
- - com.sleepycat.je.util.DbDump
  - - com.sleepycat.je.util.DbScavenger

-     public class DbScavenger
      extends DbDump

  Used to retrieve as much data as possible from a corrupted environment. This utility is meant to be used programmatically, and is the equivalent to the -R or -r options for `DbDump`.

  To scavenge a database:

        DbScavenger scavenger =
            new DbScavenger(env, outputDirectory, , , );
        scavenger.dump();

  The recovered databases will put placed in the outputDirectory with ".dump" file suffixes. The format of the .dump files will be suitable for use with DbLoad.

- - ### Field Summary

    - ### Fields inherited from class com.sleepycat.je.util.DbDump

      `dbName, doAggressiveScavengerRun, doScavengerRun, env, envHome, formatUsingPrintable, outputDirectory, outputFile, verbose`

  - ### Constructor Summary

    Constructors
    Constructor and Description
    `DbScavenger(Environment env, String outputDirectory, boolean formatUsingPrintable, boolean doAggressiveScavengerRun, boolean verbose)` Create a DbScavenger object for a specific environment.

  - ### Method Summary

    Methods
    Modifier and Type | Method and Description
    --- | ---
    `void` | `dump()` Start the scavenger run.
    `void` | `setDumpCorruptedBounds(boolean dumpCorruptedBounds)` Set to true if corrupted boundaries should be dumped out.

    - ### Methods inherited from class com.sleepycat.je.util.DbDump

      `dumpOne, main, openEnv, parseArgs, printHeader, printUsage`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

- - ### Constructor Detail

    - #### DbScavenger

          public DbScavenger(Environment env,
                     String outputDirectory,
                     boolean formatUsingPrintable,
                     boolean doAggressiveScavengerRun,
                     boolean verbose)

      Create a DbScavenger object for a specific environment.

      Parameters:
        `env` - The Environment containing the database to dump.
        `outputDirectory` - The directory to create the .dump files in.
        `formatUsingPrintable` - true if the dump should use printable characters.
        `doAggressiveScavengerRun` - true if true, then all data records are dumped, regardless of whether they are the latest version or not.
        `verbose` - true if status output should be written to System.out during scavenging.

  - ### Method Detail

    - #### setDumpCorruptedBounds

          public void setDumpCorruptedBounds(boolean dumpCorruptedBounds)

      Set to true if corrupted boundaries should be dumped out.

    - #### dump

          public void dump()
                    throws EnvironmentNotFoundException,
                           EnvironmentLockedException,
                           IOException

      Start the scavenger run.
      Overrides:
        `dump` in class `DbDump`
      Throws:
        `IOException` - in subclasses.
        `EnvironmentNotFoundException`
        `EnvironmentLockedException`

Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved.