0

I'm doing db data migration in MySQL.

I have two tables - source (T1) & destination (T2).

I created one insert ignore script to migrate data from T1 to T2. during script run some record might have failed. So I want to capture these failed records in another table and publish the report out of it

Through a stored procedure I'm able to capture errors and inserted to error table.

But as I asked not use stored procedure so is there any alternative way to capture failure records and insert to error table

Thanks in advance

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Abhi
  • 1
  • 1
  • "But as I asked not use store procedure" ==> homework ? What have you tried to solve this? BTW: Why should any insert fail? Are those two tables not defined the same way ? – Luuk Nov 24 '21 at 12:30
  • There can be data issue correct ,some invalid character .just defining table exactly means we won't get errors ? – Abhi Nov 24 '21 at 12:33
  • You can always end up with errors like "disk full", so no one can guarantee that you will not get an error.... – Luuk Nov 24 '21 at 12:34
  • Exactly your correct, to capture such errors only need help. – Abhi Nov 24 '21 at 12:38
  • Can you share more info, like why is this question different from [Duplicating a MySQL table, indices, and data](https://stackoverflow.com/questions/3280006/duplicating-a-mysql-table-indices-and-data) ? – Luuk Nov 24 '21 at 12:42

1 Answers1

0

You can log in to MySQL and specify your error log file:

mysql -u user -p 2> errors.log

Once you are logged in, run the commands that you have and all errors will be written into the file.

Lajos Arpad
  • 64,414
  • 37
  • 100
  • 175