Restore a database dump

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

Change Data Capture does not capture any data changes resulting from the use of neo4j-admin database load. See Change Data Capture → Key considerations for more information.

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] [--expand-commands] [--info] [--verbose] [--overwrite-destination[=true|false]]
                          [--additional-config=<file>] [--from-path=<path> | --from-stdin] <database>

Description

Load a database from an archive. <archive-path> must be a directory containing an archive(s) created with the dump command. If neither --from-path or --from-stdin is supplied server.directories.dumps.root setting will be searched for the archive. Existing databases can be replaced by specifying --overwrite-destination. It is not possible to replace a database that is mounted in a running Neo4j server. If --info is specified, then the database is not loaded, but information (i.e. file count, byte count, and format of load file) about the archive is printed instead.

Parameters

Table 1. neo4j-admin database load parameters
Parameter Description Default

<database>

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

neo4j

Options

Table 2. neo4j-admin database load options
Option Description Default

--additional-config=<file>

Configuration file with additional configuration.

--expand-commands

Allow command expansion in config value evaluation.

--from-path=<path>

Path to a directory containing archive(s) created with the dump command.

--from-stdin

Read dump from standard input.

-h, --help

Show this help message and exit.

--info

Print meta-data information about the archive file, instead of loading the contained database.

--overwrite-destination[=true|false]

If an existing database should be replaced.

false

As of Neo4j 5.19, the --from-path=<path> option can also load databases from AWS S3 URIs. Neo4j uses default AWS credentials to access AWS S3 URIs.

Example

The following is an example of how to load the dump of the neo4j database (neo4j.dump) 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. The --overwrite-destination option is required because you are replacing an existing database.

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.

bin/neo4j-admin database load --from-path=/full-path/data/dumps <database> --overwrite-destination=true

The following is an example of how to load the dump from an AWS S3 URI, as of Neo4j 5.19.

./neo4j-admin database load --from-path=s3://full/path/to/aws-s3-dumps/ <database> --overwrite-destination=true

The command looks for a file called <database>.dump where <database> is the database specified in the command.

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 associated with that Composite database.