1

I had created a neo4j database, which was working perfectly.

But now, when i try to use the database created by me, using following command:

:USE foo;

it gives error:

Unable to get a routing table for database 'foo' because this database is unavailable

I tried checking the status of database using command :

SHOW DATABASE foo;

It shows the currentStatus of foo as "offline". I have tried starting the database using

START DATABASE foo;

but no luck!

Although, I can use default "neo4j" and "system" databases. Only the new database which I have created, dose not work now.

If someone knows the solution, please help.

Sharwan Kami
  • 155
  • 2
  • 7

3 Answers3

4

I have finally managed to solve the issue. It was because of file permission of a file /var/lib/neo4j/data/transactions/foo/neostore.transaction.db.26.

May be somehow the user neo4j lost access to this file. I looked into the debug log file, /var/log/neo4j/debug.log and found exception message java.nio.file.AccessDeniedException: /var/lib/neo4j/data/transactions/foo/neostore.transaction.db.26 then I changed the file permission for neo4j user using command:

chown neo4j /var/lib/neo4j/data/transactions/foo//neostore.transaction.db.26

After this, i started the database and it worked

Sharwan Kami
  • 155
  • 2
  • 7
  • 1
    if this answer is the correct one, please mark it as `Accepted Answer` – smbanaei Mar 05 '21 at 23:15
  • Correct in my case also. Additionally, the `/var/lib/neo4j/databases/foo` directory had become owned by root, and I had to `chown -R neo4j:neo4j` that as well. The cause of my situation was almost certainly that I ran `neo4j-admin database import full ...` as root. I thought that was how you were supposed to run it but maybe not? That's certainly what did it though, I had a stuck transaction and DB owned by root after that. – S'pht'Kr Jul 25 '23 at 11:18
0

Try

CREATE DATABASE foo

And then start it

Tomaž Bratanič
  • 6,319
  • 2
  • 18
  • 31
  • I have tried that, but it doesn't work. It gives error: Failed to create the specified database 'foo': Database already exists. – Sharwan Kami Oct 17 '20 at 04:37
0

Copy the neostore.transaction.db.0 file from the existing data/transactions/neo4j folder to your own db data/transactions/<your_db> folder.

Antonis
  • 1
  • 2