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.
|
Syntax
nuodump <database_name>@<host> --user <user_name> --password <password> [options]
Option | Description |
---|---|
|
Specifies the number of rows of data exported as a batch.
The default value is |
|
Specifies a list of connection properties. |
|
Specifies the name of a file containing the options for the |
|
Specifies the maximum number of rows to be included when exporting data from a table. Default is no limit. |
|
Prints the help text. |
|
Adds |
|
Includes DDL statements in the output. |
|
Includes DDL and DML statements in the output. |
|
Specifies the location of the output file. If not supplied, the output is sent to standard output. |
|
Specifies the new name for the schema in the output. |
|
Specifies the new name for the table in the output. |
|
Specifies the name of the schema from which the tables will be extracted.
Default value is |
|
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 fileCREATE 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');