Hello Namxx,
Welcome to the forum. Let’s see if I can be of any assistance.
It sounds like you have a major problem with the database.
Based on that I’m going to predict that you have a ras-pi of one form or another using an SD card, further that the SD card has failed. All SD cards fail. Generally the cheaper they are the sooner they fail.
If this is the case, I would read this over and see if it helps you at all…
How to Troubleshoot Raspberry Pi Crashing.
If this is not the case, please share what your hardware is and what kind of install you are using.