How to merge two databases?

Hi,

consider to use APOC. Here is how to use.

[on export side]

  1. enable APOC(Neo4j Desktop is easy to enable)
  2. set "apoc.export.file.enabled=true" into your database config
  3. (re)start database
  4. open Neo4j browser
  5. call "CALL apoc.export.cypherAll('/usr/tmp/test1.cypher', {format:'plain'})"

merge exported files like this

cat test1.cypher test2.cypher > target.cypher

[on import side]

  1. enable APOC
  2. set "apoc.import.file.enabled=true" into your database config
  3. start database
  4. open terminal
  5. run command
cat /usr/tmp/target.cypher | bin/cypher-shell -u yourusername -p yourpassword

This procedure doesn't care about duplicated nodes and relationships. I hope this may helps.

2 Likes