public class DbDump extends Object
java { com.sleepycat.je.util.DbDump | -jar je-<version>.jar DbDump } -h <dir> # environment home directory [-f <fileName>] # output file, for non -rR dumps [-l] # list databases in the environment [-p] # output printable characters [-r] # salvage mode [-R] # aggressive salvage mode [-d] <directory> # directory for *.dump files (salvage mode) [-s <databaseName>] # database to dump [-v] # verbose in salvage mode [-V] # print JE version numberSee
main(java.lang.String[])
for a full description of the
command line arguments. To dump a database to a stream from code:
DbDump dump = new DbDump(env, databaseName, outputStream, boolean); dump.dump();
Because a DATA=END
marker is used to terminate the dump of
each database, multiple databases can be dumped and loaded using a single
stream. The dump()
method leaves the stream positioned after
the last line written and the DbLoad.load()
method leaves the stream
positioned after the last line read.
Modifier and Type | Field and Description |
---|---|
protected String |
dbName |
protected boolean |
doAggressiveScavengerRun |
protected boolean |
doScavengerRun |
protected Environment |
env |
protected File |
envHome |
protected boolean |
formatUsingPrintable |
protected String |
outputDirectory |
protected PrintStream |
outputFile |
protected boolean |
verbose |
Constructor and Description |
---|
DbDump(Environment env,
String dbName,
PrintStream outputFile,
boolean formatUsingPrintable)
Create a DbDump object for a specific environment and database.
|
DbDump(Environment env,
String dbName,
PrintStream outputFile,
String outputDirectory,
boolean formatUsingPrintable)
Deprecated.
Please use the 4-arg ctor without outputDirectory instead.
|
Modifier and Type | Method and Description |
---|---|
void |
dump()
Perform the dump.
|
protected void |
dumpOne(PrintStream o,
byte[] ba,
boolean formatUsingPrintable) |
static void |
main(String[] argv)
The main used by the DbDump utility.
|
protected void |
openEnv(boolean doRecovery) |
protected boolean |
parseArgs(String[] argv) |
protected void |
printHeader(PrintStream o,
boolean dupSort,
boolean formatUsingPrintable) |
protected void |
printUsage(String msg) |
protected File envHome
protected Environment env
protected String dbName
protected boolean formatUsingPrintable
protected String outputDirectory
protected PrintStream outputFile
protected boolean doScavengerRun
protected boolean doAggressiveScavengerRun
protected boolean verbose
@Deprecated public DbDump(Environment env, String dbName, PrintStream outputFile, String outputDirectory, boolean formatUsingPrintable)
public DbDump(Environment env, String dbName, PrintStream outputFile, boolean formatUsingPrintable)
env
- The Environment containing the database to dump.dbName
- The name of the database to dump.outputFile
- The output stream to dump the database to.formatUsingPrintable
- true if the dump should use printable
characters.public static void main(String[] argv) throws Exception
argv
- The arguments accepted by the DbDump utility.
usage: java { com.sleepycat.je.util.DbDump | -jar je-<version>.jar DbDump } [-f output-file] [-l] [-p] [-V] [-s database] -h dbEnvHome [-rR] [-v] [-d directory]
-f - the file to dump to.
-l - list the databases in the environment.
-p - If characters in either the key or data items
are printing characters (as defined by isprint(3)), use printing
characters in file to represent them. This option permits users to use
standard text editors and tools to modify the contents of
databases.
-V - display the version of the JE library.
-s database - the database to dump.
-h dbEnvHome - the directory containing the database environment.
-r - Salvage data from a possibly corrupt file. When used on a
uncorrupted database, this option should return equivalent data to a
normal dump, but most likely in a different order. The data for each
database is saved into <databaseName>.dump files in the current
directory.
-d directory - the output directory for *.dump files (salvage mode)
-R - Aggressively salvage data from a possibly corrupt file. The -R flag
differs from the -r option in that it will return all possible data
from the file at the risk of also returning already deleted or
otherwise nonsensical items. Data dumped in this fashion will almost
certainly have to be edited by hand or other means before the data is
ready for reload into another database. The data for each database is
saved into <databaseName>.dump files in the current directory.
-v - print progress information to stdout for -r or -R mode.
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.Exception
protected void printUsage(String msg)
protected boolean parseArgs(String[] argv) throws IOException
IOException
protected void openEnv(boolean doRecovery) throws EnvironmentNotFoundException, EnvironmentLockedException
public void dump() throws EnvironmentNotFoundException, EnvironmentLockedException, DatabaseNotFoundException, IOException
EnvironmentFailureException
- if an unexpected, internal or
environment-wide failure occurs.IOException
- in subclasses.EnvironmentNotFoundException
EnvironmentLockedException
DatabaseNotFoundException
protected void printHeader(PrintStream o, boolean dupSort, boolean formatUsingPrintable)
protected void dumpOne(PrintStream o, byte[] ba, boolean formatUsingPrintable)
Copyright (c) 2004, 2014 Oracle and/or its affiliates. All rights reserved.