One possible way is to spool the contents of bin-log into a file. mysqlbinlog oca-bin.000554 > binlog_sql.sql.
This will give you all the data present in oca-bin.000554. Then you can set the foreign key check to "0" at the session level and then apply the binlog_sql.sql. Comment our everything (all set command any other things) but not the sql's source binlog_sql.sql. set foreign key check back to "1". or from binlog_sql.sql, check the insert or update that is giving "foreign key fail" error, know the position just before this sql and recovery till that position and then recovery from position after this sql still till the end of file. regards anandkl On 6/20/07, Clyde Lewis - DBA <[EMAIL PROTECTED]> wrote:
Guys, I'm attempting to reapply a number of bin-log files in a effort to restore all changes that was made to a database. I'm performing the following command, but continue to get a foreign key constraint error message when doing so. Has anyone ever ran into this issue, and if so, what is a potential workaround? A possible solution is to set foreign key check to "0", but this from what I understand is done at the session level and cannot be applied in my situation. Any help would be greatly appreciated. mysqlbinlog oca-bin.000554 | mysql -h -u -p oca ERROR 1452 (23000) at line 125: Cannot add or update a child row: a foreign key constraint fails (`oca/invbodytax`, CONSTRAINT `invbodytax_ibfk_1` FOREIGN KEY (`inbtStore`, `inbtActNumber`, `inbtRef`, `inbtItem`) REFERENCES `invbody` (`inbStore`, `inbActNumber`, `inbRef`, `inbItem`) ON DEL) Thanks in advance, ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ Clyde Lewis Database Administrator