You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

NAME
sqldump - dump a database

SYNOPSIS
sqldump [OPTION...] [-o FILE]

DESCRIPTION
sqldump dumps the current database and writes the result to FILE, the dump contains the Data Definition Language (DDL) statements for all of defined objects. The database, schema, and server on which dump to
be performed can be customized via options -d, -s and -k respectively. By default, CREATE DDL statements as well as INSERT statements for data stored in TABLE objects are generated but not DROP DDL statements.
The generation of DROP, CREATE and INSERT statements can be turned on or off by options -D, -C and -I respectively. If FILE is not supplied, sqldump writes its output to standard output.

OPTIONS
If both short form and long form are specified on the command line, the long form will take precedence.

-C, --ddl-create BOOLEAN
Generate the CREATE DDL statements, default to 'true'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-c, --charset CHARSET
The character set to be used for encoding output; supported values are: 'UTF-8' and 'platform-default', default to 'UTF-8'.

-D, --ddl-drop BOOLEAN
Generate the DROP DDL statements, default to 'false'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-d, --database DATABASE
The name of the database on which dump to be performed, default to the connected database.

-I, --dml-insert BOOLEAN
Generate the INSERT SQL statements, default to 'true'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-i, --interactive
Prompt before overwriting FILE if it exists.

-k, --session-id SESSION_ID
Use the server connection associated with the session identified by SESSION_ID.

-l, --line-separator LINE_SEPARATOR
The line separ

-o, --output-file FILE
The name of the file where the dump result to be written.

-S, --all-schemas
Perform dump on all of defined schemas.

-s, --schema SCHEMA
Perform dump on the specified SCHEMA only, default to the currently connected schema.

-BL, --blank-line BOOLEAN
Include blank line between statements, default to 'false'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-DH, --descriptive-header BOOLEAN
Include descriptive header, default to 'true'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-II, --identity-insert BOOLEAN
Enable identity insert, default to 'false'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-OC, --object-comments BOOLEAN
Include object comments as script comments, default to 'false'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-OP, --object-permissions BOOLEAN
Include object permissions, default to 'false'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-OQ, --object-quote IDENTIFIER
Object quoted identifier; supported values are: 'double-quote', 'single-quote', 'square-bracket', 'back-quote', 'none', default to 'none'.

-QO, --qualify-objects BOOLEAN
Qualify objects, default to 'true'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-SD, --sort-by-dependencies BOOLEAN
Sort by dependencies, default to 'false'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-SS, --statement-separator SEPARATOR
SQL statement separator; supported values are: 'GO', 'slash', 'semicolon', 'at-sign', default to 'GO'.

-TC, --table-use-conditional-drop BOOLEAN
Use conditional drop on TABLEs, default to 'false'. See BOOLEAN VALUES section below for supported BOOLEAN values.

-TS, --table-storage BOOLEAN
Include TABLE storage, default to 'false'. See BOOLEAN VALUES section below for supported BOOLEAN values.

BOOLEAN VALUES:
The followings are supported BOOLEAN values: 'true', 'false', 'yes', 'no', 'y', 'n', 'on', 'off', '1', '0'.

EXAMPLES
Perform a complete dump on the currently connected database to standard output:
sqldump


      Perform a complete dump on the database identified by a session to standard output:
sqldump -k session_id


      Perform a complete dump, including all schemas, on the currently connected database to a file:
sqldump -S -o filename.dump
      or
sqldump -S > filename.dump


      Generate only CREATE DDL statements:
sqldump -I off

Generate only INSERT statements:
sqldump -C off

Generate all of DROP, CREATE and INSERT statements:
sqldump -D on

NOTES
If both -s and -S are specified, -S is ignored.

-II|--identity-insert option is only supported by the following servers: DB2, SQL Server, Sybase ASE

-OP|--object-permissions option is not supported by the following servers: Apache Derby, DB2 iSeries

-SD|--sort-by-dependencies option is only supported by the following servers: DB2, Oracle, SQL Server, Sybase ASE

-TS|--table-storage option is not supported by the following servers: Apache Derby, DB2 iSeries, PostgreSQL, Teradata, Teradata Aster

-d: does not work on SQLite

-s: does not work on SQLite  


SEE ALSO
sqlexport
sqlimport

  • No labels