'Unable to open (Local DynamoDB) database file after power outage

History: I was able to get read/write to my local DynamoDB environment. I followed the AWS Documents for Downloading and Running DynamoDB [http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html]

Issue: I had an accidental power outage to my computer. Now, I get the following error after I launch the DynamoDB process

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

Error Message:

Aug 23, 2017 3:52:42 PM com.almworks.sqlite4java.Internal log
WARNING: [sqlite] SQLiteQueue[shared-local-instance.db]: stopped abnormally, reincarnating in 3000ms
Aug 23, 2017 3:52:45 PM com.almworks.sqlite4java.Internal log
WARNING: [sqlite] cannot open DB[2]: com.almworks.sqlite4java.SQLiteException: [14] unable to open database file
Aug 23, 2017 3:52:45 PM com.almworks.sqlite4java.Internal log
SEVERE: [sqlite] SQLiteQueue[shared-local-instance.db]: error running job queue
com.almworks.sqlite4java.SQLiteException: [14] unable to open database file
    at com.almworks.sqlite4java.SQLiteConnection.open0(SQLiteConnection.java:1480)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:282)
    at com.almworks.sqlite4java.SQLiteConnection.open(SQLiteConnection.java:293)
    at com.almworks.sqlite4java.SQLiteQueue.openConnection(SQLiteQueue.java:464)
    at com.almworks.sqlite4java.SQLiteQueue.queueFunction(SQLiteQueue.java:641)
    at com.almworks.sqlite4java.SQLiteQueue.runQueue(SQLiteQueue.java:623)
    at com.almworks.sqlite4java.SQLiteQueue.access$000(SQLiteQueue.java:77)
    at com.almworks.sqlite4java.SQLiteQueue$1.run(SQLiteQueue.java:205)
    at java.lang.Thread.run(Thread.java:748)

Attempts: This post is the closest to my error but it involves not DynamoDB but some Cloud logs, etc. [https://forums.aws.amazon.com/thread.jspa?threadID=165134]

Any thoughts on how to rectify the database file?



Solution 1:[1]

It could be a permission issue. try updating permissions.

sudo chown user dynamodb -R
chmod 775 -R dynamodb

Solution 2:[2]

It is indeed a permission issue as suggested by Zudhin https://stackoverflow.com/a/53132375/239613

In my case, I'm running Ubuntu and the quick and dirty solution I found is just changing the permissions of the local folder for the volume:

sudo chmod 777 ./docker/dynamodb (provided that's your local folder after following https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html)

Solution 3:[3]

I had faced a similar error with Docker on Windows and the solution was to give 'System' all the permissions for the Docker Volume which persisted the DB Data

Solution 4:[4]

Quick solution was to reinstall everything.

rm -rf <unzipped DynamoDB Local folder>

Then, go back through the installation instructions. http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.html

I'm unfamiliar with jar files. Replacing them with new jar files is like reinstalling?

Solution 5:[5]

If you are on Windows, start the command prompt in administrator mode and then run your command again.

java -Djava.library.path=./DynamoDBLocal_lib -jar DynamoDBLocal.jar -sharedDb

It worked for me.

Solution 6:[6]

I got this error when I upgraded my MacOS to Catalina.

I installed DynamoDBLocal again via these instructions - https://docs.aws.amazon.com/amazondynamodb/latest/developerguide/DynamoDBLocal.DownloadingAndRunning.html

and it then worked.

If you need to have your old data replicated, just copy the existing "shared-local-instance.db" file into your new installation and it will work as before.

This is caused most likely to some permission changes to file access after Catalina was put in.

Solution 7:[7]

If you are on Windows, give writing rights to the DynamoDB folder in your Desktop.

Solution 8:[8]

In docker like environment . Same permission issue. sudo chmod 777 ./docker/dynamodb .This still works in 2022

Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source
Solution 1 Zudhin
Solution 2 gfournier
Solution 3 Rohan Sawant
Solution 4 Jordan Lee
Solution 5 Amede Angel Aulerien
Solution 6 newbreedofgeek
Solution 7 Gabriel
Solution 8 Safayet Jamil