--------------------- pol_mysql_restore.bat --------------------- (c) 2010 Pictometry International Provided for use by Pictometry staff only ------------------- General Information ------------------- This script is provided for the purpose of restoring a customer's SH-POL MySQL database from backups. It WILL erase any selected MySQL schemas and overwrite them with the data stored in the backup file. Therefore, before using it, you should always make certain that there is no data in the existing database that needs to be recovered first, that you have the correct backup files for the date you want to restore from, that you are on the correct server, etc. Before running the script, place the backup files to be restored in a directory whose path you know (and, preferably, is easy to type). You may wish to temporarily create a "C:\mysqlrestore" directory and place the backup files there. The backup files are named: gis_layer.sql pol_user.sql state_tables.sql You do not need to restore all three. For example, if the customer's gis_layer schema needs to be restored, but their pol_user and state_tables schemas are unaffected, you only need the gis_layer.sql file. ------------------ Running the Script ------------------ The script can be run by typing its name at the Windows command line. It is an interactive script and will ask several questions as it runs. First, it asks for the password for the MySQL root user so that it can connect to the database. Next, it asks for the directory where the backup files are located. Next, for each backup file it finds in that directory, it asks whether to restore that schema. (If it cannot find the backup file corresponding to a particular schema, it will alert you to this fact.) NOTE: you must type the full word "yes" or "no" for each schema. Finally, it will show you a summary of actions to be performed, and ask you to confirm one last time that you wish to perform these actions. Again, type the full word "yes" or "no" to proceed or cancel. ------- Example ------- Here is an example of what a typical execution of the script would look like (* indicates lines where input is entered by the person running the script): C:\>pol_mysql_restore.bat Enter MySQL root password: Pa55w0rD * Enter complete path to backup files, including drive letter. Example: C:\mysql_backup\20100128-141719 Path: c:\mysqlrestore * Restore pol_user schema? (yes/no): yes * Backup file state_tables.sql not found for state_tables schema. Restore gis_layer schema? (yes/no): no * Actions to be performed: ------------------------ pol_user schema WILL be restored state_tables schema WILL NOT be restored [backup file not found] gis_layer schema WILL NOT be restored -- WARNING -- THIS WILL DELETE ALL DATA CURRENTLY IN THE FOLLOWING SCHEMA(S) IN THE MYSQL DATABASE AND REPLACE IT WITH DATA FROM THE BACKUP FILES. pol_user Are you CERTAIN you want to proceed? (yes/no): yes * Restoring pol_user schema ... Restore complete.