Database Administrators Stack Exchange is a question and answer site for database professionals who wish to improve their database skills and learn from others in the community. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have mysql production databases running in main server(Linux) and from this server every night the backup is taken into local server. Now i want to find a shell script to check if all the databases backup is up to date or not(for an example: i have twenty database in the main server so i want to know all of them have been backed up completely or not) and compare the each database's current size with their previous size, in a sense i want to make sure with through this script that my backup is perfect and if not i will have a track of that occurrence.

Please help me to get a solution of this problem.

share|improve this question

This would indeed be nice to be able to do it in an automatic way. Unfortunately, to be 100% sure your backups are fine, you need human intervention. After taking the backup, you must be able to check if you can import it safely. Of course, you can not always do it. You can check your backups for example every 2-4 days.

On the other hand, you can always check if the size of the new backup is significantly smaller than the previous one (considering that the database always increases in size). This could be an indication that your backup might not have been taken correctly or is corrupted.

share|improve this answer
Why would you say that performing an automated restore with sanity checks require human intervention? This can be scripted. – Aaron Brown Jun 4 '12 at 2:07
I was looking for the script to check the backup automatically. So if i am unable to check the backup for few day's their will be history or alert log that will inform me that, from all of my databases individual or total servers backup was interrupted. – shafiur.rahman Jun 4 '12 at 3:20
@Aaron Brown Yes please! I'm a MS SQL Server DBA and figuring out automation on Postgres/MySQL has been a challenge. If you could provide a framework to start that would be great. – Ali Razeghi Dec 1 '12 at 4:20

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.