I have two database say like backenddb and livedb (~10 gb in size having more than 50 tables).
I am updating livedb with backenddb so as to update it with the new data using mysqldump and then expanding it.This process first deletes all the table row,tables and then reinsert backenddb sql-dump into livedb during expansion.
So is there any otherway by which i can insert only the updated data rows from backenddb to livedb without deleting the entire livedb data?
Through some more research i have finalized this methodology:
Create a backenddb dump using :
mysqldump –no-create-db –no-create-info -uroot -hxx.xx.xx.xxx Db_dump > dump_name
This will create a dump with row data excluding table deletion commands.
Then in the dump file replace INSERT INTO with INSERT IGNORE Into:
replace ‘INSERT INTO’ ‘INSERT IGNORE INTO’ — dump_name
Then expand the dump normally to the livedb this will insert only the updated data ignoring already existing data.
Note:-Any text occurrence of INSERT INTO will be replaced by INSERT IGNORE Into in the sql dump by replace command.