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.
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
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.
> 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