From 4e3d955d1c69c7084a940a966ad20b349a84138a Mon Sep 17 00:00:00 2001 From: NataliaIvakina <82437520+NataliaIvakina@users.noreply.github.com> Date: Tue, 20 Aug 2024 14:23:12 +0200 Subject: [PATCH] Update the page on how to delete db (#1777) (#1779) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Fix the following: - the config - `dbms.directories.dumps.root` → `server.directories.dumps.root` - `neo4j-admin dump` command → `neo4j-admin database dump` - `neo4j-admin load` command → `neo4j-admin database load` --- .../standard-databases/delete-databases.adoc | 54 +++++++++---------- 1 file changed, 25 insertions(+), 29 deletions(-) diff --git a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc index 2c37c4168..47667ff2f 100644 --- a/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc +++ b/modules/ROOT/pages/database-administration/standard-databases/delete-databases.adoc @@ -22,11 +22,13 @@ DROP [COMPOSITE] DATABASE name [IF EXISTS] [{DUMP\|DESTROY} [DATA]] [WAIT [n [SE |=== -== Usage examples +== Examples + +[[delete-database]] +=== Delete a database + +To delete the database `customers`, run the following command: -.Delete a database -====== -.Query [source, cypher] ---- DROP DATABASE customers @@ -38,9 +40,8 @@ Both standard databases and composite databases can be deleted using this comman ==== The `DROP DATABASE` command removes a database entirely. -Therefore, it no longer shows up in the listing provided by the command `SHOW DATABASES`. +Therefore, it no longer shows up in the listing provided by the command `SHOW DATABASES`: -.Query [source, cypher] ---- SHOW DATABASES YIELD name @@ -57,54 +58,49 @@ SHOW DATABASES YIELD name | "system" | +---------------------+ ---- -====== + [[delete-databases-existing]] -=== Use `IF EXISTS` when deleting databases +=== Delete a database with `IF{nbsp}EXISTS` The `DROP DATABASE` command is optionally idempotent, with the default behavior to fail with an error if the database does not exist. -Appending `IF EXISTS` to the command ensures that no error is returned and nothing happens should the database not exist. -It will always return an error if there is an existing alias that targets the database. + +Appending `IF EXISTS` to the command ensures that no error is returned and nothing happens if the database does not exist. + +It always returns an error if there is an existing alias that targets the database. In that case, the alias needs to be dropped before dropping the database. -.Query [source, cypher] ---- DROP DATABASE customers IF EXISTS ---- [[manage-databases-dump]] -=== Use `DUMP DATA` or `DESTROY DATA` when deleting databases - -You can request that a dump of the store files is produced first, and stored in the path configured using the `dbms.directories.dumps.root` setting (by default `/data/dumps`). -This can be achieved by appending `DUMP DATA` to the command (or `DESTROY DATA` to explicitly request the default behavior). -These dumps are equivalent to those produced by `neo4j-admin dump` and can be similarly restored using `neo4j-admin load`. +=== Delete a database with `DUMP DATA` or `DESTROY DATA` -//// -[source, cypher, role=test-setup] ----- -DROP ALIAS `films` FOR DATABASE; -DROP ALIAS `motion pictures` FOR DATABASE; ----- -//// +By appending `DUMP DATA` to the command `DROP DATABASE`, you can create a dump of the store files before deleting the database: -.Query [source, cypher] ---- DROP DATABASE movies DUMP DATA ---- +These dumps are equivalent to those produced by xref:backup-restore/offline-backup.adoc[`neo4j-admin database dump`] and can be similarly restored using the xref:backup-restore/restore-dump.adoc[`neo4j-admin database load`] command. + +In Neo4j, dumps can be stored in the directory specified by the xref:configuration/configuration-settings.adoc#config_server.directories.dumps.root[`server.directories.dumps.root`] setting (by default, the path for storing dumps is xref:configuration/file-locations.adoc#data[`/data/dumps`]). + +The option `DESTROY DATA` explicitly requests the default behavior of the command. + +[[delete-existing-db-with-dump]] +=== Delete a database with `IF{nbsp}EXISTS` and `DUMP DATA`/ `DESTROY DATA` + +The options `IF EXISTS` and `DUMP DATA`/ `DESTROY DATA` can also be combined. -.Combine `IF EXISTS` and `DUMP DATA`/ `DESTROY DATA` -====== -The options `IF EXISTS` and `DUMP DATA`/ `DESTROY DATA` can also be combined. An example could look like this: -.Query [source, cypher] ---- DROP DATABASE customers IF EXISTS DUMP DATA ---- -======