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 about backups, 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 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 wrote in this entrance (in spanish how to do backups using 7-zip), this is the procedure I use for my daily backups. 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. I really think it’s a problem not to have this tool. So I had found a method 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 a programmed tasks for the execution of .bat scripts (which are the ones I use). Or you can 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 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 your database is corrupted, or because of the ramsonware, your invest in time (and money) will be very profitable.

As you can imagine, I have seen more than one annoyance 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!