I need to pass the data from one database to another with the same structure, the problem is that both databases are in use, in both you can insert different records and they are in different places.
For example: in DB1 we enter an invoice from the client1, in the DB2 we enter the client's invoice2 and we need that in the DB2 this is the invoice of the client1 and client2.
The problem we have is given by the IDs, that when inserting without the ID the data of the header of the invoice (table: sales_bills) so that it does not show duplicate ID error then we can not insert the detail (table: invoices_sales_detail ) because we do not have the ID and we have to modify the query by hand.
I'm looking for a more practical way to pass the data than having to put together an ETL for each table that you insert without the ID, and then in each related table solve the new ID to be able to insert the data.
Is there any way to make it easy without having to create an ETL for each table in this way, with some tools or another way of doing it?