Restore a database dump

A database dump can be loaded to a Neo4j instance using the load command of neo4j-admin.

Command

The neo4j-admin database load command loads a database from an archive created with the neo4j-admin database dump command. Alternatively, neo4j-admin database load can accept a dump from standard input, enabling it to accept input from neo4j-admin database dump or another source.

The command can be run from an online or an offline Neo4j DBMS.

If you are replacing an existing database, you have to shut it down before running the command. If you are not replacing an existing database, you must create the database (using CREATE DATABASE against the system database) after the load operation finishes.

neo4j-admin database load must be invoked as the neo4j user to ensure the appropriate file permissions.

Syntax

neo4j-admin database load   [-h]
                            [--verbose]
                            [--expand-commands]
                            [--info]
                            [--overwrite-destination[=true|false]]
                            [--from-path=<path> | --from-stdin]
                            [--additional-config=<file>]
                            <database>

<database> — Name of the database to load. Can contain * and ? for globbing.

Options

Option Default Description

--verbose

Enable verbose output.

--expand-commands

Allow command expansion in config value evaluation.

--info

Print meta-data information about the archive file, such as file count, byte count, and format of the load file.

--overwrite-destination

false

If an existing database should be replaced.

--from-path

Path to the directory containing archive(s) created with the neo4j-admin database dump command.

--from-stdin

Read dump from standard input.

--additional-config

<file>

Configuration file with additional configuration.

Example

The following is an example of how to load the dump of the neo4j database created in the section Back up an offline database, using the neo4j-admin database load command. When replacing an existing database, you have to shut it down before running the command.

bin/neo4j-admin database load --from-path=/dumps/neo4j neo4j --overwrite-destination

Unless you are replacing an existing database, you must create the database (using CREATE DATABASE against the system database) after the load operation finishes.

When using the load command to seed a cluster, and a previous version of the database exists, you must delete it (using DROP DATABASE) first. Alternatively, you can stop the Neo4j instance and unbind it from the cluster using neo4j-admin server unbind to remove its cluster state data. If you fail to DROP or unbind before loading the dump, that database’s store files will be out of sync with its cluster state, potentially leading to logical corruptions. For more information, see Seed a cluster.

neo4j-admin database load cannot be applied to composite databases. It must be run directly on the databases that are part of a composite database.