Difference between revisions of "Retain Database Dump Tables Script"

From GWAVA Technologies Training
Jump to: navigation, search
(Editing dumpTables)
Line 11: Line 11:
 
*HOST="--host='''localhost'''" (the server the database is on)
 
*HOST="--host='''localhost'''" (the server the database is on)
 
*USER="--user='''root'''" (the root username)
 
*USER="--user='''root'''" (the root username)
*PASSWORD="--password='''k<l1nux'''" (the root user password)
+
*PASSWORD="--password='''[password]'''" (the root user password)
*BACKUP_DIR="'''/var/lib/mysql/dump'''" (the directory to save the table files to)
+
*BACKUP_DIR="'''[path to destination dump directory]'''" (the directory to save the table files to)
  
Save the script, give it execute permissions (chmod +x dumpTables.sh) and run it (./dumpTables.sh)
+
Save the script, give it execute permissions ('''chmod +x dumpTables.sh''') and run it ('''./dumpTables.sh''')
  
 
The tables will be saved to the file '''__restoreData.sql'''
 
The tables will be saved to the file '''__restoreData.sql'''

Revision as of 18:34, 7 September 2016

There are occasions that going a regular dump of the database isn't enough when there is an issue. You can do a dump by tables instead.

This script does this for you. It logs into the retain database and dumps each table into a file. The script dumpTables.sh can found in the /mysql directory of the Software Repository.

Editing dumpTables

You need to edit the script to make it work for your system. Edit these values in the script to match your system's values:

Change the values below where needed.....

  • DBNAMES="retain" (the database name)
  • HOST="--host=localhost" (the server the database is on)
  • USER="--user=root" (the root username)
  • PASSWORD="--password=[password]" (the root user password)
  • BACKUP_DIR="[path to destination dump directory]" (the directory to save the table files to)

Save the script, give it execute permissions (chmod +x dumpTables.sh) and run it (./dumpTables.sh)

The tables will be saved to the file __restoreData.sql

Restoring tables

To Restore a Database:

  1. gzip -d [gz dump file]
  2. tar -xf [tar dump file]
  3. mysql -uroot -p[root pwd] < __restoreData.sql


Personal tools
Namespaces

Variants
Actions
Home
Exchange
GroupWise
JAVA
Linux
MTK
Retain
GW Monitoring and Reporting (Redline)
GW Disaster Recovery (Reload)
GW Forensics (Reveal)
GWAVA
Secure Messaging Gateway
GW Mailbox Management (Vertigo)
Windows
Other
User Experience
Toolbox
Languages
Toolbox