-
Notifications
You must be signed in to change notification settings - Fork 372
Description
Hello to you, wonderful people. I'm really hesitant whether we're using ora2pg right. We have a huge oracle database (1.5tb), and cannot allow for long downtime (full migration takes up to 3 days).
So we've added an UPDATED_AT column to each table, so we could do migration in two steps: first step while application is running (main.conf) and then while application is down (sync.conf). Out configurations look something like this:
main.conf
WHERE UPDATED_AT <= timestamp '2023-08-11 15:00:00'
sync.conf
WHERE UPDATED_AT > timestamp '2023-08-11 15:00:00'
Idea being, that after big chunk of database if transferred, we can put application down, and transfer the rest of it fairly quickly.
But the problem is that some of the data can be updated in between step 1 and step 2. So for example entry that satisfies condition
UPDATED_AT <= timestamp '2023-08-11 15:00:00'
can satisfy condition UPDATED_AT > timestamp '2023-08-11 15:00:00'
when step 2 is about to proceed. Therefore, we get unique constraint violation.
Could there be a way for ora2pg to do UPSERT on such entries, meaning instead of INSERT, do INSERT ... ON CONFLICT UPDATE?