MySQL Forums
Forum List  »  Data Recovery

Table import errors
Posted by: Dean Karengin
Date: March 03, 2020 06:37PM

I AM NOT A DBA. However, as I am the Linux guy, and MySql lives on Linux, I got stuck with this.

So, DB1 has good, current data in some tables, and a known set of corrupted tables. The corruption was due to (my ignorance) importing utf8 data to a latin1 db.

DB2 has good, older data in some tables, and the known corrupted tables have been repaired.

I want to put the repaired tables from DB2 with the current data in DB1. I have been trying varying types of INSERT INTO. My best result to date was deleting the corrupt table, then:

CREATE TABLE db1.table_name LIKE db2.same_table_name;
INSERT INTO db1.table_name
SELECT * FROM db2.same_table_name

This got me foreign key constraint errors.

SET FOREIGN_KEY_CHECKs=0

and try again, got

Cannot add foreign key constraint.

So I tried to truncate the table, but you "Cannot truncate a table referenced in a foreign key constraint".

INSERT INTO db1.table_name
SELECT * FROM db2.table_name

Incorrect string value: bunch of stuff for column TITLE at row 5.

I am in a position where management insists on the "current" data with the "repaired" tables, as "No data loss is acceptable".

Any advice or help is REALLY REALLY appreciated. As I said, I'm not a DBA, and an only learning this thanks to Google, a SYSADMIN's best friend.

TIA.

Options: ReplyQuote


Subject
Views
Written By
Posted
Table import errors
243
March 03, 2020 06:37PM
98
March 03, 2020 10:13PM
105
March 04, 2020 10:00AM
102
March 04, 2020 11:15AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.