Skip to content

Commit cc93083

Browse files
committed
Document the new clear data option for the recreate database procedure.
1 parent 6cd1313 commit cc93083

File tree

2 files changed

+26
-2
lines changed

2 files changed

+26
-2
lines changed

modules/ROOT/pages/clustering/databases.adoc

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,8 @@ The recreate procedure allows you to:
258258
* Make your database write-available again after it has been lost (for example, due to a disaster).
259259
See xref:clustering/disaster-recovery.adoc[Disaster recovery] for more information.
260260

261+
* Delete the data and schema for a database, while keeping all the associated privileges (from Neo4j 2025.04).
262+
261263
[CAUTION]
262264
====
263265
The recreate procedure works only for real user databases and not for composite databases, or the `system` database.
@@ -279,7 +281,7 @@ You need xref:authentication-authorization/dbms-administration.adoc#access-contr
279281
To check if the recreation is successful, use the `SHOW DATABASES` command and verify that all allocations have been started.
280282

281283
Additionally, you have the option to modify <<alter-topology-recreate, the topology>> during the recreation process.
282-
However, note that the store format, access, and enrichment cannot be altered during recreation.
284+
However, note that the access, and enrichment cannot be altered during recreation and store format can only be altered if the data is cleared.
283285

284286
[[recreate-seeding-options]]
285287
=== Seeding options
@@ -356,6 +358,28 @@ This means the store is replaced by the most up-to-date seeder if available; oth
356358
CALL dbms.recreateDatabase("neo4j", {seedingServers: [], seedURI: "s3://myBucket/myBackup.backup"});
357359
----
358360

361+
[[clear-data-recreate]]
362+
=== Clear data option
363+
In Neo4j 2025.04 an additional option was added to the recreate database procedure which clears the data (e.g. nodes and relationships) and the schema (e.g. constraints and indexes) for the database.
364+
This means you end up with an empty store, but as with the other recreate database options, all privileges associated with the database are kept.
365+
366+
When, and only when, the clear data option is used, the store format can also be changed for the recreated database.
367+
See xref:database-internals/store-formats.adoc[Store formats], for more details about available database store formats in Neo4j.
368+
If the store format option is not defined, the recreated database ends up with the same store format as before the recreation.
369+
370+
371+
[source, shell]
372+
----
373+
CALL dbms.recreateDatabase("neo4j", {clearData: true, storeFormat: "block"});
374+
----
375+
376+
[CAUTION]
377+
====
378+
Using the clear data option means the data and schema will be deleted *permanently*.
379+
If you want to have the option of getting them back later, make sure to take a backup before clearing the database.
380+
See xref:backup-restore/online-backup.adoc[Online backup] for more information.
381+
====
382+
359383
[[alter-topology-recreate]]
360384
=== Change the topology
361385

modules/ROOT/pages/procedures.adoc

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -717,7 +717,7 @@ The procedure initiates a process, which when complete, will have synchronized a
717717

718718
[NOTE]
719719
====
720-
It is mandatory to specify either `seedURI` or `seedingServers` as seeding options in the `options` field.
720+
It is mandatory to specify either `seedURI`, `seedingServers` or `clearData` in the `options` field, to define what store(s) the recreation should be based on.
721721
Further details on how to use the `dbms.recreateDatabase()` procedure are provided in the related section inside the xref:clustering/databases.adoc#recreate-databases[Managing databases in a cluster] page.
722722
If no topology option is defined, the database will be recreated with the previous topology.
723723
====

0 commit comments

Comments
 (0)