#47 Full Schema

options/variables
closed
nobody
None
5
2011-08-28
2011-08-19
No

Just because you have backups of some data doesn't mean you don't need to restore all the database schema.
Also a server will my run will without knowing the my.cnf configuration. We need to back this up too.

Add a variable to backup just the full schema as well. This would create two new config variables.

# Include a full schema backup
CONFIG_fullschema='yes'

# Include a copy of my.cnf
CONFIG_mycnf='yes'

Here is a DIFF that covers this.

337,361d336
< # Backup MySQL config file (my.cnf) if so directed.
< copymycnf() {
< if [ "${CONFIG_mycnf}" = "yes" ]; then
< if (( $CONFIG_dryrun )); then
< echo "DryRun"
< else
< echo "copying my.cnf"
< cp /etc/my.cnf "${1}";
< fi
< fi
< }
<
< # Backup full schema.
< fullschema() {
< if [ "${CONFIG_fullschema}" = "yes" ]; then
< if (( $CONFIG_dryrun )); then
< echo "DryRun"
< else
< echo "doing schema backup"
< mysqldump --user="${CONFIG_mysql_dump_username}" --password="${CONFIG_mysql_dump_password}" --host="${CONFIG_mysql_dump_host}" --all-databases --routines --no-data > "${1}";
< chmod 600 ${1};
< fi
< fi
< }
<
502,503d476
< CONFIG_fullschema=()
< CONFIG_mycnf=()
907,910d879
< copymycnf "${CONFIG_backup_dir}/monthly/my.cnf_${date_month}_${datetimestamp}"
< compression "${CONFIG_backup_dir}/monthly/my.cnf_${date_month}_${datetimestamp}"
< fullschema "${CONFIG_backup_dir}/monthly/fullschema_${date_month}_${datetimestamp}.sql"
< compression "${CONFIG_backup_dir}/monthly/fullschema_${date_month}_${datetimestamp}.sql"
921c890
<
---
>
946,949d914
< copymycnf "${CONFIG_backup_dir}/weekly/my.cnf_${date_month}_${datetimestamp}"
< compression "${CONFIG_backup_dir}/weekly/my.cnf_${date_month}_${datetimestamp}"
< fullschema "${CONFIG_backup_dir}/weekly/fullschema_${date_month}_${datetimestamp}.sql"
< compression "${CONFIG_backup_dir}/weekly/fullschema_${date_month}_${datetimestamp}.sql"
977,980d941
< copymycnf "${CONFIG_backup_dir}/daily/my.cnf_${date_month}_${datetimestamp}"
< compression "${CONFIG_backup_dir}/daily/my.cnf_${date_month}_${datetimestamp}"
< fullschema "${CONFIG_backup_dir}/daily/fullschema_${date_month}_${datetimestamp}.sql"
< compression "${CONFIG_backup_dir}/daily/fullschema_${date_month}_${datetimestamp}.sql"
1015,1018d975
< copymycnf "${CONFIG_backup_dir}/monthly/my.cnf_${date_month}_${datetimestamp}"
< compression "${CONFIG_backup_dir}/monthly/my.cnf_${date_month}_${datetimestamp}"
< fullschema "${CONFIG_backup_dir}/monthly/fullschema_${date_month}_${datetimestamp}.sql"
< compression "${CONFIG_backup_dir}/monthly/fullschema_${date_month}_${datetimestamp}.sql"
1042,1045d998
< copymycnf "${CONFIG_backup_dir}/weekly/my.cnf_${date_month}_${datetimestamp}"
< compression "${CONFIG_backup_dir}/weekly/my.cnf_${date_month}_${datetimestamp}"
< fullschema "${CONFIG_backup_dir}/weekly/fullschema_${date_month}_${datetimestamp}.sql"
< compression "${CONFIG_backup_dir}/weekly/fullschema_${date_month}_${datetimestamp}.sql"
1067,1070d1019
< copymycnf "${CONFIG_backup_dir}/daily/my.cnf_${date_month}_${datetimestamp}"
< compression "${CONFIG_backup_dir}/daily/my.cnf_${date_month}_${datetimestamp}"
< fullschema "${CONFIG_backup_dir}/daily/fullschema_${date_month}_${datetimestamp}.sql"
< compression "${CONFIG_backup_dir}/daily/fullschema_${date_month}_${datetimestamp}.sql"

Discussion

  • PittaGurneyi

    PittaGurneyi - 2011-08-28
    • status: open --> closed
     
  • PittaGurneyi

    PittaGurneyi - 2011-08-28

    In version 3.0_beta2. Will be released within a few days.

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks