Skip to content

Commit 328eca5

Browse files
Document the new clear data option for the recreate database procedur… (neo4j#2283)
…e. (neo4j#2258) Co-authored-by: Anna Sjerling <[email protected]>
1 parent 9547ee2 commit 328eca5

File tree

2 files changed

+39
-2
lines changed

2 files changed

+39
-2
lines changed

modules/ROOT/pages/clustering/databases.adoc

Lines changed: 38 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -258,6 +258,10 @@ 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+
* label:new[Introduced in 2025.02] Delete the data and schema for a database, while keeping the database privileges assigned to each role.
262+
263+
* label:new[Introduced in 2025.04] Alter the database store format when clearing the data and schema.
264+
261265
[CAUTION]
262266
====
263267
The recreate procedure works only for real user databases and not for composite databases, or the `system` database.
@@ -279,7 +283,8 @@ You need xref:authentication-authorization/dbms-administration.adoc#access-contr
279283
To check if the recreation is successful, use the `SHOW DATABASES` command and verify that all allocations have been started.
280284

281285
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.
286+
However, note that up to Neo4j 2025.04, the store format, access, and enrichment cannot be altered during recreation.
287+
Starting with 2025.04, the store format can only be altered if the `clearData` option is used.
283288

284289
[[recreate-seeding-options]]
285290
=== Seeding options
@@ -356,6 +361,7 @@ This means the store is replaced by the most up-to-date seeder if available; oth
356361
CALL dbms.recreateDatabase("neo4j", {seedingServers: [], seedURI: "s3://myBucket/myBackup.backup"});
357362
----
358363

364+
359365
[[alter-topology-recreate]]
360366
=== Change the topology
361367

@@ -370,6 +376,37 @@ If there are more available servers in the cluster hosting the database than the
370376
CALL dbms.recreateDatabase("neo4j", {seedingServers: [], primaries: 3, secondaries: 0});
371377
----
372378

379+
380+
[role=label--new-2025.02]
381+
[[clear-data-recreate]]
382+
=== Clear data option
383+
384+
In Neo4j 2025.02, the `clearData` option was added to the recreate procedure.
385+
This option allows you to delete the data (e.g., nodes and relationships) and the schema (e.g., constraints and indexes) for the database.
386+
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.
387+
388+
[CAUTION]
389+
====
390+
Using the clear data option means the data and schema will be deleted *permanently*.
391+
If you want to have the option of getting them back later, make sure to take a backup before clearing the database.
392+
See xref:backup-restore/online-backup.adoc[Online backup] for more information.
393+
====
394+
395+
[role=label--new-2025.04]
396+
[[alter-store-format]]
397+
==== Alter the database store format
398+
399+
In Neo4j 2025.04, the database store format can also be altered during recreation, but only when the `clearData` option is specified.
400+
401+
See xref:database-internals/store-formats.adoc[Store formats], for more details about available database store formats in Neo4j.
402+
If the store format option is not defined, the recreated database ends up with the same store format as before the recreation.
403+
404+
[source, shell]
405+
----
406+
CALL dbms.recreateDatabase("neo4j", {clearData: true, storeFormat: "block"});
407+
----
408+
409+
373410
[[cluster-seed]]
374411
== Seed a cluster
375412

modules/ROOT/pages/procedures.adoc

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

736736
[NOTE]
737737
====
738-
It is mandatory to specify either `seedURI` or `seedingServers` as seeding options in the `options` field.
738+
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.
739739
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.
740740
If no topology option is defined, the database will be recreated with the previous topology.
741741
====

0 commit comments

Comments
 (0)