Start and stop databases

Neo4j supports the management of multiple databases within the same DBMS. The metadata for these databases, including the associated security model, is maintained in a special database called the system database. All multi-database administrative commands must be run against the system database. These administrative commands are automatically routed to the system database when connected to the DBMS over Bolt.

Start databases

Databases can be started using the command START DATABASE.

Both standard databases and composite databases can be started using this command.

Syntax

Command Syntax

START DATABASE

START DATABASE name [WAIT [n [SEC[OND[S]]]]|NOWAIT]

Start a database

Starting a database is a straightforward operation. Suppose you have a database named customers. To start it, use the following command:

START DATABASE customers

You can see the status of the started database by running the command SHOW DATABASE name.

SHOW DATABASE customers YIELD name, requestedStatus, currentStatus
Result
+-----------------------------------------------+
| name        | requestedStatus | currentStatus |
+-----------------------------------------------+
| "customers" | "online"        | "online"      |
+-----------------------------------------------+

Start a database with WAIT

You can start your database using WAIT sub-clause to ensure that the command waits for a specified amount of time until the database is started.

START DATABASE customers WAIT 5 SECONDS

Stop databases

Databases can be stopped using the command STOP DATABASE.

Syntax

Command Syntax

STOP DATABASE

STOP DATABASE name [WAIT [n [SEC[OND[S]]]]|NOWAIT]

Stop a database

To stop a database, use the following command:

STOP DATABASE customers

Both standard databases and composite databases can be stopped using this command.

The status of the stopped database can be seen using the command SHOW DATABASE name:

SHOW DATABASE customers YIELD name, requestedStatus, currentStatus
Result
+-----------------------------------------------+
| name        | requestedStatus | currentStatus |
+-----------------------------------------------+
| "customers" | "offline"       | "offline"     |
+-----------------------------------------------+

Stop a database with WAIT

You can also stop your database using the WAIT sub-clause, which allows you to specify the amount of time that the system should wait for the database to stop.

STOP DATABASE customers WAIT 10 SECONDS

Databases that are stopped with the STOP command are completely shut down and may be started again through the START command. In a cluster, as long as a database is in a shutdown state, it can not be considered available to other members of the cluster. It is not possible to do online backups against shutdown databases and they need to be taken into special consideration during disaster recovery, as they do not have a running Raft machine while shutdown. Unlike stopped databases, dropped databases are completely removed and are not intended to be used again at all.