Creating a NuoDB Database Backup using nuodb-migrator
In addition to migrating databases from other RDBMSs to NuoDB, nuodb-migrator
allows you to dump and load data from one NuoDB Database to another.
Dump/Load or Backup/Restore of a NuoDB database using nuodb-migrator
nuodb-migrator
can be used to copy a source NuoDB database to a target NuoDB database.
The only difference is that the source JDBC driver and URL reference a NuoDB database connection and not a third-party database connection.
To dump the source NuoDB database use the following nuodb-migrator dump
command:
nuodb-migrator dump \
--source.driver=com.nuodb.jdbc.Driver \
--source.url=jdbc:com.nuodb://host/database_name \
--source.schema=my_schema \
--source.username=userid \
--source.password=passwd \
--output.type=csv \
--output.path=path_for_dump_files
To load the target NuoDB database use the following nuodb-migrator load
command:
nuodb-migrator load \
--target.url=jdbc:com.nuodb://host/database_name \
--target.username=userid \
--target.password=passwd \
--input.path=path_for_dump_files
Configuring Classpath
To access data stored in NuoDB, nuodb-migrator
uses the NuoDB JDBC driver.
For advanced cases you can override the NUODB_HOME
environment variable with a valid NuoDB installation directory from a command line shell.
Alternatively, nuodb-migrator
can pick up a JDBC Driver from the system CLASSPATH
environment variable.
For more information on drivers, see NuoDB Drivers. |
Example
To configurate a connection to a NuoDB database you should provide the JDBC driver class name, the JDBC connection URL, schema name, username, and password for authentication.
nuodb-migrator schema
nuodb-migrator schema
captures the HOCKEY
schema and saves it to a file specified by the --output.path
parameter.
Suppose we had a NuoDB database installed on the machine myserver
loaded with the HOCKEY
schema and data from the QuickStart database and we want to dump that data and load it into a local NuoDB database we have just created.
$ nuodb-migrator schema \
--source.driver=com.nuodb.jdbc.Driver \
--source.url=jdbc:com.nuodb://myserver/test \
--source.schema=hockey \
--source.username=dba \
--source.password=goalie \
--output.path=/tmp/schema.sql
Run schema.sql
in nuosql
to load the schema into the NuoDB testdb
database and into the schema NEWHOCKEY
.
$ nuosql testdb@localhost --user cloud --password psswd --schema newhockey --file /tmp/schema.sql
nuodb-migrator dump
The following command creates a dump of all tables from the myserver
NuoDB database named test
, found in schema HOCKEY
in CSV format.
Dumped data files will be saved in /tmp/dump
directory.
$ nuodb-migrator dump \
--source.driver=com.nuodb.jdbc.Driver \
--source.url=jdbc:com.nuodb://myserver/test \
--source.schema=hockey \
--source.username=dba \
--source.password=goalie \
--output.type=csv \
--output.path=/temp/dump
nuodb-migrator load
Loading a previously generated dump from /tmp/dump
to a NuoDB database testdb
into the newhockey
schema is performed using nuodb-migrator load
.
$ nuodb-migrator load \
--target.url=jdbc:com.nuodb://localhost/testdb \
--target.schema=newhockey \
--target.username=cloud \
--target.password=passwd \
--input.path=/tmp/dump