Lessons I’ve learnt for not having backups

Posted by in Databases

After “all problems” I had with the database of my thesis (how to recover a database with no ibdata1 file), and get it back, I can teach you in more detail several things I learned, and since the previous entry was very long, I preferred to write an spacific new one.

The problem: a corrupted database

Well, basically, the database is corrupted and you are unable to access it, when last time it was perfectly possible for you to do it. The reason: as it says, unexpected closure of the database.

The truth is that it would have been less of a problem if I had had a fairly recent backup, but that wasn’t the case. Maybe, let’s say, this shouldn’t have happened to me.

A backup maniac

As the time goes by, some el paso del tiempo, some colleagues in the office with whom I workwith, they know my mania for backing up the living projects I work with, and if possible, automating them.

As I already told you in this entrance (in spanish how to do backups using 7-zip), this is the procedure I normally use for my daily backup in all projects I am working. But also, it is very important to have a good organisation.

In my case, I have a subdirectory for web developments, and depending on whether they are completed I move to another folder of finished. In this way, I can make copies with longer cadences of certain projects that are modified less, and almost daily of those I have active.

This configuration has allowed me to get rid of more than one disasterI have skipped some disasters more than one:

  • how have I lost this file?
  • Anyway, I can retrieve the file that I had two days ago

Unfortunately, my company’s IT managers don’t see the point of using GitHub for software version management, and I really think it’s a problem not to have this tool. So I had to find my life to have a system that allows me to do it, and on top of that, without depending on it.

The ideal situation is to have an external hard disk dedicated exclusively to this purpose.

You can make use of the programmed tasks for the execution of .bat scripts (which are the ones I use), or put a link to your script in the startup file of your Windows profile (if it’s the Operating System you use), and that way, you’ll have the process automated (that’s what I use).

Test your backups!!!!

But if it is important to make backups, it is even more important to prove that the backups work when you recover. In the case of files, it’s simple, but in the case of databases, it’s very possible that some view has been left with a deleted table and an error has been made.

In the specific case of MySQL or MariaDB databases, testing the backups will allow you to make the necessary modifications to have your databases in perfect condition, avoiding future problems.

Invest some time in learning about backups, because in case you lost some files or you have your database (or file) corrupted, or because of the ramsonware, your invest in time (and money) will be very profitable.

More than one annoyance I have seen in my office for not having something as simple as a .bat copying files from one drive to another, losing months of work!

Thanks for your reading, and I encaurage you to contribute to maintain this blog! Happy coding!