]]>
]]>

Importing Data Into the Database

To complete the data recovery, you can load the output of the constraints_parser tool into the database with LOAD DATA INFILE. At this point we are done using the tools; the process from here on is all performed with the database, or with other tools such as Unix command-line utilities.

To import the file with LOAD DATA INFILE, you can use the following rules:

  • The file is tab delimited. Use FIELDS TERMINATED BY '\t'.
  • Comumns are quoted. Use OPTIONALLY ENCLOSED BY '"'.
  • Each line starts with the table name and a tab. Use LINES STARTING BY '<table_name>\t'.
  • TIMESTAMP values are stored as integer values. Use FROM_UNIXTIME(@var).
  • Use REPLACE INTO when you have old row versions that you want to ignore and overwrite with the latest version.

To complete our running example, we can execute the following SQL:

LOAD DATA INFILE '/tmp/customer_data.tsv'
REPLACE INTO TABLE customer
FIELDS TERMINATED BY '\t'
OPTIONALLY ENCLOSED BY '"'
LINES STARTING BY 'customer\t'
(customer_id, store_id, first_name, last_name, email,
   address_id, active, create_date, @last_update)
SET last_update = FROM_UNIXTIME(@last_update);
 
innodb-data-recovery-tool/mysql-data-recovery/importing_data.txt · Last modified: 2011/08/05 17:59 by rodrigo.gadea
Except where otherwise noted, content on this wiki is licensed under the following license:CC Attribution-Noncommercial-Share Alike 3.0 Unported
Contact Us 24 Hours A Day
SupportContact us 24×7
Emergency? Contact us for help now!
Sales North America(888) 316-9775 or
(208) 473-2904
Sales
Europe
+44-208-133-0309 (UK)
0-800-051-8984 (UK)
0-800-181-0665 (GER)
Training(855) 55TRAIN or
(925) 271-5054

 

Share This
]]> ]]>