Unable to use created neo4j database

I had created a 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.Please keep the following things in mind:

Hi @sharwan

It works with the command ":USE foo".
No semicolon is required.

By the way, is it Neo4j Desktop or Neo4j Enterprise that you're testing?
"Installations of Community Edition can have exactly one user database"

Post the Neo4j version you are using now. Did you upgrade Neo4j version? if so what was your older version and new version? Also, did you seen ant error message in SHOW DATABASES?

Thanks for the response.
I was writing commands in cypher-shell, which requires semicolon at the end.
I am using Enterprise version, which allows multiple databases. It was working before, but stopped working now.

Hi @ameyasoft,
Thanks for the response.

I am using neo4j enterprise 4.1.3. This is the only version I am using.

neo4j@neo4j> call dbms.components();
+-------------------------------------------+
| name           | versions  | edition      |
+-------------------------------------------+
| "Neo4j Kernel" | ["4.1.3"] | "enterprise" |
+-------------------------------------------+

SHOW DATABASES shows all the databases, but one database as offline, which I am trying to use.

neo4j@neo4j> show databases;
+-------------------------------------------------------------------------------------------------------+
| name       | address               | role         | requestedStatus | currentStatus | error | default |
+-------------------------------------------------------------------------------------------------------+
| "neo4j"    | "127.0.0.1:7687" | "standalone" | "online"        | "online"      | ""    | TRUE    |
| "foo" | "127.0.0.1:7687" | "standalone" | "online"        | "offline"     | ""    | FALSE   |
| "system"   | "127.0.0.1:7687" | "standalone" | "online"        | "online"      | ""    | FALSE   |
+-------------------------------------------------------------------------------------------------------+

Hi @sharwan

I tried running it in bin/cypher-shell.
I have stopped foo and then started it.
There is no problem in my environment.
My environment is Neo4j 4.1.3 Enterprise, MacOS 10.15.7
I haven't changed anything in conf.

neo4j@neo4j> call dbms.components();
+-------------------------------------------+
| name           | versions  | edition      |
+-------------------------------------------+
| "Neo4j Kernel" | ["4.1.3"] | "enterprise" |
+-------------------------------------------+

1 row available after 27 ms, consumed after another 2 ms
neo4j@neo4j> show databases;
+------------------------------------------------------------------------------------------------+
| name     | address          | role         | requestedStatus | currentStatus | error | default |
+------------------------------------------------------------------------------------------------+
| "foo"    | "localhost:7687" | "standalone" | "online"        | "online"      | ""    | FALSE   |
| "neo4j"  | "localhost:7687" | "standalone" | "online"        | "online"      | ""    | TRUE    |
| "system" | "localhost:7687" | "standalone" | "online"        | "online"      | ""    | FALSE   |
+------------------------------------------------------------------------------------------------+

3 rows available after 243 ms, consumed after another 23 ms

neo4j@neo4j> :USE foo;
neo4j@foo> SHOW DATABASE foo;
+---------------------------------------------------------------------------------------------+
| name  | address          | role         | requestedStatus | currentStatus | error | default |
+---------------------------------------------------------------------------------------------+
| "foo" | "localhost:7687" | "standalone" | "online"        | "online"      | ""    | FALSE   |
+---------------------------------------------------------------------------------------------+

1 row available after 96 ms, consumed after another 6 ms
neo4j@foo> STOP DATABASE foo;
0 rows available after 397 ms, consumed after another 0 ms
neo4j@foo> SHOW DATABASE foo;
Database 'foo' is unavailable.
neo4j@foo> :USE SYSTEM
neo4j@system> SHOW DATABASE foo;
+---------------------------------------------------------------------------------------------+
| name  | address          | role         | requestedStatus | currentStatus | error | default |
+---------------------------------------------------------------------------------------------+
| "foo" | "localhost:7687" | "standalone" | "offline"       | "offline"     | ""    | FALSE   |
+---------------------------------------------------------------------------------------------+

1 row available after 5 ms, consumed after another 2 ms
neo4j@system> START DATABASE foo;
0 rows available after 99 ms, consumed after another 0 ms
neo4j@system> SHOW DATABASE foo;
+---------------------------------------------------------------------------------------------+
| name  | address          | role         | requestedStatus | currentStatus | error | default |
+---------------------------------------------------------------------------------------------+
| "foo" | "localhost:7687" | "standalone" | "online"        | "online"      | ""    | FALSE   |
+---------------------------------------------------------------------------------------------+

1 row available after 14 ms, consumed after another 2 ms
1 Like

Hi @koji

Thanks for helping!

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 :slight_smile:

1 Like