Reconciling CDR and other changes from Backup

ardyhash

Member
Jan 7, 2021
81
9
8
44
Hello world!

I just rolled back to a snapshot from two days ago and am wondering if there are any tools/documentation out there on how to merge yesterday's CDR records and anything else necessary into the currently running instance (we didn't want to risk additional downtime by waiting to restore from last night's backup).

Thanks in advance for any and all inputs!
 

whut

Member
Dec 23, 2022
173
15
18
I am not thinking of a guide for how to copy all CDR table records from a cdr_copy version to existing v_xml_cdr table. Hopefully you have performed a "copy v_xml_cdr table to cdr_copy table" so you can import yesterday's CDR data.
 

ardyhash

Member
Jan 7, 2021
81
9
8
44
it was scary in the moment but after thinking of it as a data problem it ended up being an incredibly simple 3 step process:

1) make a csv of yesterday's cdr:
copy (select * from v_xml_cdr where date(start_stamp) = current_date - 1) to '/tmp/yesterdayscdr.csv' (FORMAT csv);

2) move that file over to the target system
scp /tmp/yesterdayscdr.csv TARGET:/tmp/yesterdayscdr.csv

3) load the csv into the table:
copy v_xml_cdr from '/tmp/yesterdayscdr.csv' with (FORMAT csv);

Twas an impromptu war game, need to move remediation time from minutes to seconds (then hopefully milliseconds... baby steps)!