Changes to triggers and procedures
This commit is contained in:
parent
8fa41ed193
commit
5776014ff9
|
@ -29,6 +29,7 @@
|
|||
# #
|
||||
##############################################################################################
|
||||
# #
|
||||
# 2021/11/16 1.12 Changes to triggers and procedures #
|
||||
# 2021/10/01 1.11 Show error message if mysql binaries are not found #
|
||||
# 2021/07/27 1.10 Added PATH to include /usr/local/sbin and /usr/local/bin #
|
||||
# 2021/07/26 1.9 Added MYSQL_BIN, MYSQLADMIN_BIN and MYSQLADMIN_BIN variables #
|
||||
|
@ -170,7 +171,7 @@ else
|
|||
[ ! -d ${DB_BKP_FLDR} ] && mkdir -p ${DB_BKP_FLDR} && chmod 700 ${DB_BKP_FLDR}
|
||||
# Get the schema of database with the stored procedures.
|
||||
# This will be the first file in the database backup folder
|
||||
${MYSQLDUMP_BIN} ${MYSQL_OPTS} -R -d --single-transaction ${DB} | gzip -c > ${DB_BKP_FLDR}/000-DB_SCHEMA.sql.gz
|
||||
${MYSQLDUMP_BIN} ${MYSQL_OPTS} -R -d --add-drop-trigger --single-transaction ${DB} | gzip -c > ${DB_BKP_FLDR}/000-DB_SCHEMA.sql.gz
|
||||
index=0
|
||||
#Get the tables and its type. Store it in an array.
|
||||
table_types=($(${MYSQL_BIN} ${MYSQL_OPTS} -e "show table status from \`${DB}\`" | awk '{ if ($2 == "MyISAM" || $2 == "InnoDB") print $1,$2}'))
|
||||
|
@ -184,9 +185,9 @@ else
|
|||
table=${table_types[${index}]}
|
||||
#echo -en "$(date) : backup ${DB} : ${table} : ${TYPE} "
|
||||
if [ "${TYPE}" = "MyISAM" ]; then
|
||||
DUMP_OPT="${DB} --no-create-info --tables --events --quote-names "
|
||||
DUMP_OPT="${DB} --skip-triggers --no-create-info --tables --events --quote-names "
|
||||
else
|
||||
DUMP_OPT="${DB} --no-create-info --single-transaction --tables --events --quote-names "
|
||||
DUMP_OPT="${DB} --skip-triggers --no-create-info --single-transaction --tables --events --quote-names "
|
||||
fi
|
||||
${MYSQLDUMP_BIN} ${MYSQL_OPTS} ${DUMP_OPT} ${table} |gzip -c > ${DB_BKP_FLDR}/${table}.sql.gz
|
||||
index=$((${index} + 2))
|
||||
|
|
Loading…
Reference in New Issue