06.08.2015 Views

IBM XIV Storage System Copy Services and Migration

IBM XIV Storage System: Copy Services and Migration - Common ...

IBM XIV Storage System: Copy Services and Migration - Common ...

SHOW MORE
SHOW LESS
  • No tags were found...

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

The backup script is simple, <strong>and</strong> depending on the implementation of your database, thefollowing script might be too simple. However, the following script (Example 1-16) does forcean incremental backup <strong>and</strong> copies the data to the second <strong>XIV</strong> volume. Then the script locksthe tables so that no more data can be modified. When the tables are locked, the scriptinitiates a snapshot, which saves everything for later use. Finally, the tables are unlocked.Example 1-16 Script to perform backup# Report the time of backing update# First flush the tables this can be done while running <strong>and</strong># creates an incremental backup of the DB at a set point in time./usr/local/mysql/bin/mysql -h localhost -u root -p password < ~/SQL_BACKUP# Since the mysql daemon was run specifying the binary log name# of backup the files can be copied to the backup directory on another diskcp /usr/local/mysql/data/backup* /xiv_pfe_2# Secondly lock the tables so a Snapshot can be performed./usr/local/mysql/bin/mysql -h localhost -u root -p password < ~/SQL_LOCK# XCLI comm<strong>and</strong> to perform the backup# ****** NOTE User ID <strong>and</strong> Password are set in the user profile *****/root/<strong>XIV</strong>GUI/xcli -c xiv_pfe cg_Snapshots_create cg="MySQL Group"# Unlock the tables so that the database can continue in operation./usr/local/mysql/bin/mysql -h localhost -u root -p password < ~/SQL_UNLOCKWhen issuing comm<strong>and</strong>s to the MySQL database, the password for the root user is stored inan environment variable (not in the script, as was done in Example 1-16 for simplicity).Storing the password in an environment variable allows the script to perform the actionwithout requiring user intervention. For the script to invoke the MySQL database, the SQLstatements are stored in separate files <strong>and</strong> piped into the MySQL application. Example 1-17provides the three SQL statements that are issued to perform the backup operation.Example 1-17 SQL comm<strong>and</strong>s to perform backup operationSQL_BACKUPFLUSH TABLESSQL_LOCKFLUSH TABLES WITH READ LOCKSQL_UNLOCKUNLOCK TABLESChapter 1. Snapshots 35

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!