# Creating a database and then renaming it or copying it to another within the same instance

**URL:** <https://community.neo4j.com/t/creating-a-database-and-then-renaming-it-or-copying-it-to-another-within-the-same-instance/36374>\
**Category:** Cypher\
**Tags:** cypher, knowledge-base, neo4j-desktop\
**Created:** [April 5, 2021, 3:24pm UTC](https://community.neo4j.com/t/creating-a-database-and-then-renaming-it-or-copying-it-to-another-within-the-same-instance/36374 "2021-04-05T15:24:48Z")\
**Posts on this page:** 6\
**Page:** 1

<div class="post-metadata">

**Author:** ![matthew.cash](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/matthew.cash/32/3913_2.png) [@matthew.cash](https://community.neo4j.com/u/matthew.cash)\
**Post date:** [April 5, 2021, 3:24pm UTC](https://community.neo4j.com/t/creating-a-database-and-then-renaming-it-or-copying-it-to-another-within-the-same-instance/36374/1 "2021-04-05T15:24:48Z")

</div>

Neo4j 4.3  
Desktop 1.2.7

I want to be able to create a database, and then either drop an already existing database and rename the new database that of the recently dropped database, or create a duplicate of the newly created database and give it the name of the recently dropped database.  
Ideally I would like to, in some form, save an instance or the database that is to be dropped/replaced, in case of any issues during the process, the procedure can then revert back to the original database.

---

<div class="post-metadata">

**Author:** ![ameyasoft](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/ameyasoft/32/32639_2.png) [@ameyasoft](https://community.neo4j.com/u/ameyasoft)\
**Post date:** [April 5, 2021, 6:33pm UTC](https://community.neo4j.com/t/creating-a-database-and-then-renaming-it-or-copying-it-to-another-within-the-same-instance/36374/2 "2021-04-05T18:33:17Z")

</div>

```auto
Backup the existing database into data/dumps folder by running this command in the terminal window:

bin/neo4j-admin backup --backup-dir=data/dumps --database=xyz

Restore this backup as a different database:

bin/neo4j-admin restore --from=data/dumps/xyz --database=xyzz --force

```

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [April 5, 2021, 8:13pm UTC](https://community.neo4j.com/t/creating-a-database-and-then-renaming-it-or-copying-it-to-another-within-the-same-instance/36374/3 "2021-04-05T20:13:01Z")

</div>

or if this is a single instance you might want to consider using

> **[Copy a database store - Operations Manual](https://neo4j.com/docs/operations-manual/current/backup-restore/copy-database/)**
>
> This section describes how to copy the data store of an existing offline database to a new database.

---

<div class="post-metadata">

**Author:** ![matthew.cash](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/matthew.cash/32/3913_2.png) [@matthew.cash](https://community.neo4j.com/u/matthew.cash)\
**Post date:** [April 15, 2021, 5:19pm UTC](https://community.neo4j.com/t/creating-a-database-and-then-renaming-it-or-copying-it-to-another-within-the-same-instance/36374/4 "2021-04-15T17:19:15Z")

</div>

i have tried using these listed above but when creating the database i get an error:

 ![errorwing](https://us1.discourse-cdn.com/flex021/uploads/neo4jcommunity/original/3X/6/9/696793df309f698c9e80f90ae4b351e70390ca8d.png)  
I tried to do a copy, create a back up and force restore from it to a newly named DB, and nothing seems to work. I noticed when I created the backup or copy that the directory would be owened by root. so I ran **chown -R neo4j:neo4j** against the directory to make sure it that was not the issue before i created the database in the browser, but still get the same error.

---

<div class="post-metadata">

**Author:** ![dana\_canzano](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/dana_canzano/32/27392_2.png) [@dana\_canzano](https://community.neo4j.com/u/dana_canzano)\
**Post date:** [April 15, 2021, 7:04pm UTC](https://community.neo4j.com/t/creating-a-database-and-then-renaming-it-or-copying-it-to-another-within-the-same-instance/36374/5 "2021-04-15T19:04:12Z")

</div>

@matthew.cash  
What version of Neo4j?

Does the logs/debug.log provide any detail as to why it doesnt come up?

---

<div class="post-metadata">

**Author:** ![matthew.cash](https://sea1.discourse-cdn.com/flex021/user_avatar/community.neo4j.com/matthew.cash/32/3913_2.png) [@matthew.cash](https://community.neo4j.com/u/matthew.cash)\
**Post date:** [April 19, 2021, 4:59pm UTC](https://community.neo4j.com/t/creating-a-database-and-then-renaming-it-or-copying-it-to-another-within-the-same-instance/36374/6 "2021-04-19T16:59:09Z")

</div>

This is what I am seeing in the logs:

```auto
> 2021-04-19 16:57:30.996+0000 INFO [c.n.d.DbmsReconciler] Database allnew is requested to transition from EnterpriseDatabaseState{databaseId=DatabaseId{2cedd4d8[allnew] }, operatorState=STOPPED, failed=true} to EnterpriseDatabaseState{databaseId=DatabaseId{2cedd4d8[allnew] }, operatorState=STARTED, failed=false}
> 2021-04-19 16:57:30.996+0000 WARN [c.n.d.DbmsReconciler] Attempting to reconcile database allnew to state 'online' but has previously failed. Manual force is required to retry.
> 2021-04-19 16:57:30.996+0000 ERROR [c.n.d.DbmsReconciler] Encountered error when attempting to reconcile database allnew from state 'EnterpriseDatabaseState{databaseId=DatabaseId{2cedd4d8[allnew] }, operatorState=STOPPED, failed=true}' to state 'online' An error occurred! Unable to start database with name `allnew`.
> org.neo4j.dbms.api.DatabaseManagementException: An error occurred! Unable to start database with name `allnew`.
> Caused by: java.lang.RuntimeException: java.nio.file.AccessDeniedException: /data/databases/allnew/neostore
> Caused by: java.nio.file.AccessDeniedException: /data/databases/allnew/neostore

```
