Version 1.3.0
WiredTiger command line utility

WiredTiger includes a command line utility, wt.

Synopsis

wt [-Vv] [-C config] [-h directory] command [command-specific arguments]

Description

The wt tool is a command-line utility that provides access to various pieces of the WiredTiger functionality.

Options

There are three global options:

-C config
Specify configuration strings for the wiredtiger_open function.
-h directory
Specify a database home directory.
-V
Display WiredTiger version and exit.
-v
Set verbose output.

Unless otherwise described by a wt command, the wt tool exits zero on success and non-zero on error.

The wt tool supports several commands.


wt backup

Perform a hot backup of a database or set of database objects.

The backup command performs a hot backup of the database, copying the database files to a specified directory, which can be subsequently opened as a WiredTiger database. See Hot backup for more information, and File permissions for specifics on the copied file permissions.

Synopsis

wt [-Vv] [-C config] [-h directory] backup [-t uri] directory

Options

The following are command-specific options for the backup command:

-t uri
By default, the backup command does a hot backup of the entire database; the -t option changes the backup command to do a hot backup of only the named objects.

wt create

Create a table or file.

The create command creates the specified uri with the specified configuration. It is equivalent to a call to WT_SESSION::create with the specified string arguments.

Synopsis

wt [-Vv] [-C config] [-h directory] create [-c config] uri

Options

The following are command-specific options for the create command:

-c
Include a configuration string to be passed to WT_SESSION::create.

wt drop

Drop a table or file.

The drop command drops the specified uri. It is equivalent to a call to WT_SESSION::drop with the "force" configuration argument.

Synopsis

wt [-Vv] [-C config] [-h directory] drop uri

Options

The drop command has no command-specific options.


wt dump

Export data in a text format.

The dump command outputs the specified table in a portable format which can be re-loaded into a new table using the load command.

See Dump Formats for details of the dump file formats.

Synopsis

wt [-Vv] [-C config] [-h directory] dump [-rx] [-c checkpoint] [-f output] uri

Options

The following are command-specific options for the dump command:

-c
By default, the dump command opens the most recent version of the object; the -c option changes the dump command to open the named checkpoint.
-f
By default, the dump command output is written to the standard output; the -f option re-directs the output to the specified file.
-r
Dump in reverse order, from largest key to smallest.
-x
Dump all characters in a hexadecimal encoding (the default is to leave printable characters unencoded).

wt dumpfile

Dump a file in a debugging format.

The dumpfile command dumps the specified physical file in a non-portable, debugging format, exiting success if the file is correct, and failure if the file is corrupted.

Synopsis

wt [-Vv] [-C config] [-h directory] dumpfile [-f output] file

Options

The following are command-specific options for the dumpfile command:

-f
By default, the dumpfile command output is written to the standard output; the -f option re-directs the output to the specified file.

wt list

List the tables and files in the database.

By default, the list command prints out the tables and files stored in the database. If an object name is specified as an argument, only information about that object is printed.

Synopsis

wt [-Vv] [-C config] [-h directory] list [-cv] [uri]

Options

The following are command-specific options for the list command:

-c
If the -c option is specified, the object's checkpoints are printed in a human-readable format.
-v
If the -v option is specified, the object's complete schema table value is printed.

wt load

Load a table or file from dump output.

The load command reads the standard input for data and loads it into a table or file, creating the table or file if it does not yet exist. The data should be the format produced by the dump command; see Dump Formats for details.

By default, if the table or file already exists, data in the file or table cannot be overwritten by the new data (use the -o option to overwrite existing data).

Synopsis

wt [-Vv] [-C config] [-h directory] load [-ao] [-f input] [-r name] [uri configuration ...]

Options

The following are command-specific options for the load command:

-a
If the -a option is specified, record number keys in the input are ignored and the data is appended to the object and assigned new record number keys. The -a option is only applicable when loading an object where the primary key is a record number.
-f
By default, the load command reads from the standard input; the -f option reads the input from the specified file.
-r
By default, the load command uses the table or file name taken from the input; the -r option renames the object.
-o
By default, input data will not overwrite existing data where the key/value pair already exists in the object, and the attempt will fail; the -o option causes the load command to overwrite already existing data.

Additionally, uri and configuration pairs may be specified to the load command. Each of these pairs may be used to modify the configuration of an object in the table or file. For each of the pairs, the configuration string will be appended to the WT_SESSION::create call for the object matching the uri.


wt loadtext

Load text into a table or file.

The loadtext command reads the standard input for text and loads it into a table or file. The input data should be printable characters, with newline delimiters for each key or value.

The loadtext command does not create the file if it does not yet exist.

In the case of inserting values into a column-store table or file, each value is appended to the table or file; in the case of inserting values into a row-store table or file, lines are handled in pairs, where the first line is the key and the second line is the value. If the row-store table or file already exists, data in the table or file will be overwritten by the new data.

Synopsis

wt [-Vv] [-C config] [-h directory] loadtext [-f input]

Options

The following are command-specific options for the loadtext command:

-f
By default, the loadtext command reads from the standard input; the -f option reads the input from the specified file.

wt printlog

Display the database log.

The printlog command outputs the database log.

Synopsis

wt [-Vv] [-C config] [-h directory] printlog [-p] [-f output]

Options

The following are command-specific options for the printlog command:

-f
By default, the printlog command output is written to the standard output; the -f option re-directs the output to the specified file.
-p
Display the log in a printable format.

wt read

Read records from a table or file.

The read command prints out the records associated with the specified keys from the specified object.

The object must be configured with string or record number keys and string values.

The read command exits non-zero if a specified record is not found.

Synopsis

wt [-Vv] [-C config] [-h directory] read uri key ...

Options

The read command has no command-specific options.


wt rename

Rename a table or file.

The rename command renames the specified table or file.

Synopsis

wt [-Vv] [-C config] [-h directory] rename uri name

Options

The rename command has no command-specific options.


wt salvage

Recover data from a corrupted file.

The salvage command salvages the specified object, discarding any data that cannot be recovered. Underlying files are re-written in place, overwriting the original file contents.

Synopsis

wt [-Vv] [-C config] [-h directory] salvage [-F force] uri

Options

The following are command-specific options for the salvage command:

-F
By default, salvage will refuse to salvage files that fail basic tests (for example, files that don't appear to be in a WiredTiger format). The -F option forces the salvage of the file, regardless.

wt stat

Display database or object statistics.

The stat command outputs run-time statistics for the WiredTiger engine, or, if specified, for the command-line object.

Synopsis

wt [-Vv] [-C config] [-h directory] stat [uri]

Options

The stat command has no command-specific options.


wt upgrade

Upgrade a table or file.

The upgrade command upgrades the specified table or file, exiting success if the object up-to-date, and failure if the object cannot be upgraded.

Synopsis

wt [-Vv] [-C config] [-h directory] upgrade uri

Options

The upgrade command has no command-specific options.


wt verify

Check the structural integrity of a table or file.

The verify command verifies the specified table or file, exiting success if the object is correct, and failure if the object is corrupted.

Synopsis

wt [-Vv] [-C config] [-h directory] verify uri

Options

The verify command has no command-specific options.


wt write

Write records to a table or file.

The write command stores records into the specified object.

The object must be configured with string or record number keys and string values.

If the write command is called with the -a option, each command-line argument is a single value to be appended to the specified column-store object. If the write command is not called with the -a option, the command-line arguments are key/value pairs.

Attempting to overwrite an already existing record will fail.

Synopsis

wt [-Vv] [-C config] [-h directory] write -a uri value ...
wt [-Vv] [-C config] [-h directory] write [-o] uri key value ...

Options

The following are command-specific options for the write command:

-a
Append each value as a new record in the object.
-o
By default, attempting to overwrite an already existing record will fail. The -o option changes write to overwrite previously existing records.