NuoDB Dump

NuoDB Dump extracts schemas and their table data from a running NuoDB database and writes the output to the file specified using the --output-file option. If the output file is not specified, then the output is sent to standard output. The output contains SQL statements that will load the extracted tables and data into a target NuoDB database.

  • The nuodump command can be used only on a running database.

  • Login credentials with read permissions for the requested schemas or tables are required to execute the NuoDB dump operation.

Syntax

nuodump <database_name>@<host> --user <user_name> --password <password> [options]
Option Description

--batch-size

Specifies the number of rows of data exported as a batch. The default value is 500.

--connection-property <connection-property>

Specifies a list of connection properties.

--config

Specifies the name of a file containing the options for the nuodump command to skip supplying the options on the command line.

--export-limit

Specifies the maximum number of rows to be included when exporting data from a table. Default is no limit.

--help

Prints the help text.

--include-drop

Adds DROP TABLE <table_name> IF EXISTS statement before each CREATE TABLE statement.

--include-ddl

Includes DDL statements in the output.

--include-data

Includes DDL and DML statements in the output.

--output-file <path>

Specifies the location of the output file. If not supplied, the output is sent to standard output.

--output-schema <new_schema_name>

Specifies the new name for the schema in the output.

--output-table <new_table_name>

Specifies the new name for the table in the output.

--schema <schema_name>

Specifies the name of the schema from which the tables will be extracted. Default value is USER.

--table <table_name>

Specifies the name of the table that will be extracted. If not supplied, dumps the entire schema.

--include-data or --include-ddl is a required option.

If the --include-ddl flag is supplied, then the following will be included in the output:

  • CREATE TABLE statements with full column descriptions, for all tables

  • CREATE INDEX statements for all indexes on each table

  • ALTER TABLE …​ ADD CONSTRAINT statements for all UNIQUE constraints on each table

  • ALTER TABLE …​ ADD CONSTRAINT …​ FOREIGN KEY …​ REFERENCES statements for all foreign key references on each table

If the --include-data flag is supplied, then the following will be included in the output:

  • INSERT statements for all rows being exported

  • Special ALTER table statements to ensure GENERATED AN IDENTITY columns are properly handled

Examples

Create a table with table name details in the database dba with column names id, fname, and lname.

CREATE TABLE details(id INT PRIMARY KEY, fname VARCHAR(50), lname VARCHAR(50));
INSERT INTO DETAILS VALUES (1, 'Robert' , 'Dawn');
INSERT INTO DETAILS VALUES (2, 'Rob' , 'Daxson');
CREATE TRIGGER beforeCreateView ON DATABASE BEFORE CREATE VIEW AS VAR x = 1; END_TRIGGER;
CREATE PROCEDURE PRC_COPY_YEAR (IN F1T STRING) AS INSERT INTO DETAILS VALUES (2, 'NUODB', 'Test'); END_PROCEDURE;
CREATE TRIGGER TRG212 FOR details Before Delete After Update Before Insert POSITION 1 INACTIVE FOR EACH STATEMENT AS throw 'aaa';end_trigger;
Example 1: Extract table schemas, table data, and DDL statements to the specified output file.
nuodump test@localhost --user dba --password dba --output-file ./CSV/nuodump_output.sql --include-ddl
Contents of the nuodump_output.sql file
CREATE TABLE "USER"."DETAILS" (
ID integer NOT NULL,
FNAME varchar(50),
LNAME varchar(50));

ALTER TABLE "USER"."DETAILS" ADD PRIMARY KEY(ID);
CREATE TRIGGER TRG212 FOR USER.DETAILS Before Insert After Update Before Delete POSITION 1 INACTIVE FOR EACH STATEMENT AS throw 'aaa'; end_trigger;



CREATE PROCEDURE USER.PRC_COPY_YEAR (IN F1T STRING) AS INSERT INTO DETAILS VALUES (2, 'NUODB', 'Test'); END_PROCEDURE;

CREATE TRIGGER BEFORECREATEVIEW ON DATABASE Before Create View POSITION 0 ACTIVE AS VAR x = 1; END_TRIGGER;
Example 2: Extract table schemas, table data, DDL statements, and DML statements to stdout.
nuodump test@localhost --user dba --password dba --include-data
INSERT INTO "USER"."DETAILS" (ID, FNAME, LNAME) VALUES
(1,'Robert','Dawn'),
(2,'Rob','Daxson');