Refreshing (non-partitioned, partitioned) production tables
945708Jun 25 2012 — edited Jun 28 2012We have staging and production environments and are looking for a way to refresh read-only tables (non-partitioned, partitioned) from staging to production w/o creating downtime. This is a fairly common task in DW. Our idea so far is to use a combination of Datapump w/ REMAP_TABLE option and SYNONYM's to accomplish this.
Staging:
- MYSCHEMA
- * TEST
Production:
- MYSCHEMA
- * TEST_A
Assuming a table TEST needs to be refreshed, we would run a Datapump job, using REMAP_TABLE option to rename TEST to TEST_B. After, we update the SYNONYM "TEST" to point to TEST_B, then truncate TEST_A. The next time we run the job, we rename TEST to TEST_A, update the SYNONYM "TEST" to point to TEST_A, then truncate TEST_B. Users querying "TEST" on production should have uninterrupted, albeit potentially inconsistent, read-only access.
This works great... but only for non-partitioned tables. Because the table is being renamed, Datapump skips partitions.
ORA-31693: Table data object "MYSCHEMA"."TEST":"TEST_P0"."TEST_P0_S10" failed to load/unload and is being skipped due to error:
ORA-31603: object "TEST" of type TABLE not found in schema "MYSCHEMA"
Is there any way around this issue? What is the best way to refresh read-only tables (non-partitioned, partitioned) w/o creating downtime?