Skip to content
tsolodov edited this page Dec 11, 2015 · 2 revisions

Welcome to the mysqltools wiki!

extractor.pl

extractor tool created for rapid extracting databases and/or tables from dump created by mysqldump utility. Main idea is to extract only needed data and stop working. Script reads STDIN and writes result to STDOUT, all debug information is written to STDERR. The script works even if the /backup/production/PARTITION_DB_XXXXX.sql.bz2 (see example) contains multiple DB.

Example of restoring tableA and tableB from PARTITION_DB_XXXXX Database:

bzcat /backup/production/PARTITION_DB_XXXXX.sql.bz2 | extractor.pl PARTITION_DB_XXXXX tableA tableB > result.sql
db=PARTITION_DB_XXXXX tables: tableA tableB

PARTITION_DB_XXXXX
    table: table1
    table: tableA
    table: tableB

All tables were restored. Exiting...

Example of restoring whole PARTITION_DB_XXXXX Database:

bzcat /backup/production/PARTITION_DB_XXXXX.sql.bz2 | extractor.pl PARTITION_DB_XXXXX > result.sql
db=PARTITION_DB_XXXXX
DB1
DB2
PARTITION_DB_XXXXX
Exiting...

Clone this wiki locally