Use Scripts to Backup and Restore MySQL Database
The following scripts are available to perform backup of the MySQL database. When running the scripts, you do not have to stop your database to perform a backup.
- Arcserve_MySql_PreBackup_script.bat: This script closes all open tables, and it locks all the tables for all the databases with a global read lock.
- Arcserve_MySql_PostSnapshot_script.bat: This script releases all the locks.
- Arcserve-MySQl-pre-post-snapshot-conf.bat: This script helps to capture database details -hostname, DB username, DB password, Port.
To use the scripts, follow these steps:
- Extract UDP-MySQL-Windows-scripts.zip provides seven files.
- Place all the files in BIN folder of the agent installation folder. The default agent installation location is C:\Program Files\Arcserve\Unified Data Protection\Engine\.
- Provide MySQL database details (hostname, DB username, DB password, Port) under Arcserve-MySQl-pre-post-snapshot-conf.bat
- Configure agent-based plan from UDP Console and select the MySQL node as source.
-
- Check the Activity log for pre and post script execution status. The ArcserveMySQLPrepost.log and ArcserveMySQLReadLock.log files are available in C:\Program Files\Arcserve\Unified Data Protection\Engine\Logs.
Restore MySQL Database
- Stop MySQL Service.
- To restore to the original location, do the following:
- Delete files and directories from the current MySQL\data\ folder.
- Restore database folder from recovery point to MySQL\data\ folder.
- Start MySQL Service.
- Note: The steps provided here help to restore the entire MySQL server data, not just the single database.
Modify Arcserve-MySQl-pre-post-snapshot-conf.bat
Edit the following two configurable parameters, which are available in the Arcserve-MySQl-pre-post-snapshot-conf.bat file.
- set AMSQLREADLOCKTIMEOUT=25 // time-out parameter in minute for acquiring the read lock on MySQL database server
- set AMSQLREADLOCKRETRY=3 // Retry count to acquire Read Lock <in pre-script> and Remove the Read lock <in pos-script>
Note: If read-lock is not successful in “AMSQLREADLOCKTIMEOUT” minutes, the backup fails.