.TH "wt" 3 "Tue Jun 16 2015" "Version 2.6.1" "WiredTiger" \" -*- nroff -*- .ad l .nh .SH NAME wtWiredTiger command line utility \- WiredTiger includes a command line utility, \fCwt\fP\&. .SH "SYNOPSIS" .PP \fCwt [-LRVv] [-C config] [-E secretkey ] [-h directory] command [command-specific arguments]\fP .SH "DESCRIPTION" .PP The \fCwt\fP tool is a command-line utility that provides access to various pieces of the WiredTiger functionality\&. .SH "OPTIONS" .PP There are several global options: .PP \fB-C config\fP .RS 4 Specify configuration strings for the \fBwiredtiger_open\fP function\&. .RE .PP \fB-E secretkey\fP .RS 4 Specify an encryption secret key for the \fBwiredtiger_open\fP function\&. .RE .PP \fB-h directory\fP .RS 4 Specify a database home directory\&. .RE .PP \fB-L\fP .RS 4 Forcibly turn off logging subsystem for debugging purposes\&. .RE .PP \fB-R\fP .RS 4 Run recovery if the underlying database is configured to do so\&. .RE .PP \fB-V\fP .RS 4 Display WiredTiger version and exit\&. .RE .PP \fB-v\fP .RS 4 Set verbose output\&. .RE .PP Unless otherwise described by a \fCwt\fP command, the \fCwt\fP tool exits zero on success and non-zero on error\&. .PP The \fCwt\fP tool supports several commands\&. If configured in the underlying database, some commands will run recovery when opening the database\&. If the user wants to force recovery on any command, use the \fC-r\fP option\&. In general, commands that modify the database or tables will run recovery by default and commands that only read data will not run recovery\&. .PP .PP .SH "wt backup" .PP Perform a backup of a database or set of data sources\&. .PP The \fCbackup\fP command performs a backup of the database, copying the database files to a \fCspecified\fP directory, which can be subsequently opened as a WiredTiger database\&. See \fBBackups\fP for more information, and \fBFile permissions\fP for specifics on the copied file permissions\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] backup [-t uri] directory\fP .SS "Options" The following are command-specific options for the \fCbackup\fP command: .PP \fB-t uri\fP .RS 4 By default, the \fCbackup\fP command does a backup of the entire database; the \fC-t\fP option changes the \fCbackup\fP command to do a backup of only the named data sources\&. .RE .PP .PP .SH "wt compact" .PP Compact a table or file\&. .PP The \fCcompact\fP command attempts to rewrite the specified table or file to consume less disk space\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] compact uri\fP .SS "Options" The \fCcompact\fP command has no command-specific options\&. .PP .PP .SH "wt create" .PP Create a table or file\&. .PP The \fCcreate\fP command creates the specified \fCuri\fP with the specified configuration\&. It is equivalent to a call to \fBWT_SESSION::create\fP with the specified string arguments\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] create [-c config] uri\fP .SS "Options" The following are command-specific options for the \fCcreate\fP command: .PP \fB-c\fP .RS 4 Include a configuration string to be passed to \fBWT_SESSION::create\fP\&. .RE .PP .PP .SH "wt drop" .PP Drop a table or file\&. .PP The \fCdrop\fP command drops the specified \fCuri\fP\&. It is equivalent to a call to \fBWT_SESSION::drop\fP with the 'force' configuration argument\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] drop uri\fP .SS "Options" The \fCdrop\fP command has no command-specific options\&. .PP .PP .SH "wt dump" .PP Export data in a text format\&. .PP The \fCdump\fP command outputs the specified table in a portable format which can be re-loaded into a new table using the \fCload\fP command\&. .PP See \fBDump Formats\fP for details of the dump file formats\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] dump [-jrx] [-c checkpoint] [-f output] uri\fP .SS "Options" The following are command-specific options for the \fCdump\fP command: .PP \fB-c\fP .RS 4 By default, the \fCdump\fP command opens the most recent version of the data source; the \fC-c\fP option changes the \fCdump\fP command to open the named checkpoint\&. .RE .PP \fB-f\fP .RS 4 By default, the \fCdump\fP command output is written to the standard output; the \fC-f\fP option re-directs the output to the specified file\&. .RE .PP \fB-j\fP .RS 4 Dump in JSON (\fCJavaScript Object Notation\fP) format\&. .RE .PP \fB-r\fP .RS 4 Dump in reverse order, from largest key to smallest\&. .RE .PP \fB-x\fP .RS 4 Dump all characters in a hexadecimal encoding (the default is to leave printable characters unencoded)\&. .RE .PP .PP .SH "wt list" .PP List the tables and files in the database\&. .PP By default, the \fClist\fP command prints out the tables and files stored in the database\&. If a URI is specified as an argument, only information about that data source is printed\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] list [-cv] [uri]\fP .SS "Options" The following are command-specific options for the \fClist\fP command: .PP \fB-c\fP .RS 4 If the \fC-c\fP option is specified, the data source's checkpoints are printed in a human-readable format\&. .RE .PP \fB-v\fP .RS 4 If the \fC-v\fP option is specified, the data source's complete schema table value is printed\&. .RE .PP .PP .SH "wt load" .PP Load a table or file from dump output\&. .PP The \fCload\fP 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 \fCdump\fP command; see \fBDump Formats\fP for details\&. .PP By default, if the table or file already exists, data in the file or table will be overwritten by the new data (use the \fC-n\fP option to make an attempt to overwrite existing data return an error)\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] load [-ajn] [-f input] [-r name] [uri configuration \&.\&.\&.]\fP .SS "Options" The following are command-specific options for the \fCload\fP command: .PP \fB-a\fP .RS 4 If the \fC-a\fP option is specified, record number keys in the input are ignored and the data is appended to the data source and assigned new record number keys\&. The \fC-a\fP option is only applicable when loading into a column store\&. .RE .PP \fB-f\fP .RS 4 By default, the \fCload\fP command reads from the standard input; the \fC-f\fP option reads the input from the specified file\&. .RE .PP \fB-j\fP .RS 4 Load input in the JSON (\fCJavaScript Object Notation\fP) format that was created by the \fCdump -j\fP command\&. .RE .PP \fB-n\fP .RS 4 By default, input data will overwrite existing data where the key/value pair already exists in the data source; the \fC-n\fP option causes the \fCload\fP command to fail if there's an attempt to overwrite already existing data\&. .RE .PP \fB-r\fP .RS 4 By default, the \fCload\fP command uses the table or file name taken from the input; the \fC-r\fP option renames the data source\&. .RE .PP Additionally, \fCuri\fP and \fCconfiguration\fP pairs may be specified to the \fCload\fP command\&. These configuration pairs can be used to modify the configuration values from the dump header passed to the \fBWT_SESSION::create\fP call\&. .PP The \fCuri\fP part of the configuration pair should match only one of the objects being loaded, but may be a prefix of the object being matched\&. For example, the following two sets of configuration pairs are equivalent in the case of loading a single table named \fCxxx\fP\&. .PP .PP .nf table block_allocation=first table:xxx block_allocation=first .fi .PP .PP It's an error, however, to specify a matching prefix that matches more than a single object being loaded\&. .PP Multiple \fCconfiguration\fP arguments may be specified\&. For example, the following two sets of configuration pairs are equivalent: .PP .PP .nf table:xxx block_allocation=first,prefix_compress=false table:xxx block_allocation=first table:xxx prefix_compress=false .fi .PP .PP .PP .SH "wt loadtext" .PP Load text into a table or file\&. .PP The \fCloadtext\fP 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\&. .PP The \fCloadtext\fP command does not create the file if it does not yet exist\&. .PP 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\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] loadtext [-f input]\fP .SS "Options" The following are command-specific options for the \fCloadtext\fP command: .PP \fB-f\fP .RS 4 By default, the \fCloadtext\fP command reads from the standard input; the \fC-f\fP option reads the input from the specified file\&. .RE .PP .PP .SH "wt printlog" .PP Display the database log\&. .PP The \fCprintlog\fP command outputs the database log\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] printlog [-p] [-f output]\fP .SS "Options" The following are command-specific options for the \fCprintlog\fP command: .PP \fB-f\fP .RS 4 By default, the \fCprintlog\fP command output is written to the standard output; the \fC-f\fP option re-directs the output to the specified file\&. .RE .PP \fB-p\fP .RS 4 Display the log in a printable format\&. .RE .PP .PP .SH "wt read" .PP Read records from a table or file\&. .PP The \fCread\fP command prints out the records associated with the specified keys from the specified data source\&. The data source must be configured with string or record number keys and string values\&. .PP The \fCread\fP command exits non-zero if a specified record is not found\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] read uri key \&.\&.\&.\fP .SS "Options" The \fCread\fP command has no command-specific options\&. .PP .PP .SH "wt rename" .PP Rename a table or file\&. .PP The \fCrename\fP command renames the specified table or file\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] rename uri name\fP .SS "Options" The \fCrename\fP command has no command-specific options\&. .PP .PP .SH "wt salvage" .PP Recover data from a corrupted file\&. .PP The \fCsalvage\fP command salvages the specified data source, discarding any data that cannot be recovered\&. Underlying files are re-written in place, overwriting the original file contents\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] salvage [-F force] uri\fP .SS "Options" The following are command-specific options for the \fCsalvage\fP command: .PP \fB-F\fP .RS 4 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 \fC-F\fP option forces the salvage of the file, regardless\&. .RE .PP .PP .SH "wt stat" .PP Display database or data source statistics\&. .PP The \fCstat\fP command outputs run-time statistics for the WiredTiger engine, or, if specified, for the URI on the command-line\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] stat [-f] [uri]\fP .SS "Options" The following are command-specific options for the \fCstat\fP command: .PP \fB-f\fP .RS 4 Include only 'fast' statistics in the output (equivalent to passing \fCstatistics=(fast)\fP) to \fBWT_SESSION::open_cursor\fP\&. .RE .PP .PP .SH "wt upgrade" .PP Upgrade a table or file\&. .PP The \fCupgrade\fP command upgrades the specified table or file, exiting success if the data source is up-to-date, and failure if the data source cannot be upgraded\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] upgrade uri\fP .SS "Options" The \fCupgrade\fP command has no command-specific options\&. .PP .PP .SH "wt verify" .PP Check the structural integrity of a table or file\&. .PP The \fCverify\fP command verifies the specified table or file, exiting success if the data source is correct, and failure if the data source is corrupted\&. .SS "Synopsis" \fCwt [-rVv] [-C config] [-E secretkey ] [-h directory] verify uri\fP .SS "Options" The \fCverify\fP command has no command-specific options\&. .PP .PP .SH "wt write" .PP Write records to a table or file\&. .PP The \fCwrite\fP command stores records into the specified data source\&. The data source must be configured with string or record number keys and string values\&. .PP If the \fCwrite\fP command is called with the \fC-a\fP option, each command-line argument is a single value to be appended to the specified column-store data source\&. If the \fCwrite\fP command is not called with the \fC-a\fP option, the command-line arguments are key/value pairs\&. .PP Attempting to overwrite an already existing record will fail\&. .SS "Synopsis" \fC wt [-rVv] [-C config] [-E secretkey ] [-h directory] write -a uri value \&.\&.\&. .br wt [-rVv] [-C config] [-E secretkey ] [-h directory] write [-o] uri key value \&.\&.\&. \fP .SS "Options" The following are command-specific options for the \fCwrite\fP command: .PP \fB-a\fP .RS 4 Append each value as a new record in the data source\&. .RE .PP \fB-o\fP .RS 4 By default, attempting to overwrite an already existing record will fail\&. The \fC-o\fP option changes \fCwrite\fP to overwrite previously existing records\&. .RE .PP