How to backup multiple databases using percona

Hello all,

 

I checked over the internet and I couldn’t find a possible script to backup multiple databases using percona backup tool. Hence, I wrote it myself. The below script will help us to backup at most 3 databases by providing database names as command line argument the backups will be placed at /disk4(you can change to any folder name that you prefer).

 

Percona

#!/bin/bash
#!/bin/bash
echo $#
if [ $# -gt 0 ]
then
 echo "number of arguments given is $#"
 /usr/bin/innobackupex --include="^$1" /disk4
   if [ $# -gt 1 ]
   then
     echo "number of arguments given is $#"
     /usr/bin/innobackupex  --include="^$2" /disk4
      if [ $# -gt 2 ]
       then
        echo "number of arguments given is $#"
         /usr/bin/innobackupex --include="^$3" /disk4
      fi
   fi
fi

save the above script into a file and execute it using the following syntax.

[user@localhost] # sh perconabackupscript.sh database1 database2 database3

Leave a Reply

Protected by WP Anti Spam