I need to load a table with ~18M records in a daily basis, and in order to minimize the down time on the client side, we have the approach of loading a temp then swap the table names after. see process below
Table A is the orginal table, Table TMP is the temporary table
- load Table TMP
- rename Table A to Table A_V1
- rename Table TMP to Table A
- rename Table A_V1 to Table TMP
- truncate Table TMP in preparation for next load
Is there any other way of swapping the table names? or any other way to achieve this?
Thanks a lot.
Use a synonym.
Firstly load into
TABLEA_YYYYMMDD, recreate constraints etc.Then,
Lastly, if you want to, drop the previous
tablea_yyyymmdd.