Skip to Main Content
  • Questions
  • How to use synonym to repoint the table

Breadcrumb

Question and Answer

Connor McDonald

Thanks for the question, Leeanne.

Asked: April 04, 2017 - 1:09 pm UTC

Last updated: April 05, 2017 - 3:37 am UTC

Version: 10g

Viewed 1000+ times

You Asked

Hi,

I am using 10g, other than renaming of table to swap the latest result from the data loading. Instead, this is not created as table, but Materialized view. How do we swap the latest result from materialized view but not interrupting the existing MV records as these records are being used as reporting purposes. In 10g, there is no such features like out of place.

My report is pointing to MV1 and this MV1 cannot be with atomic_refresh = false, since this truncation may cause the user not able to see the data.
Please advise.

Thanks.


and Connor said...

I'm inferring from your question text that

a) you cannot do atomic refresh (ie, delete-insert) because its too expensive/slow, AND

b) you cannot do non-atomic refresh (ie, truncate-insert) because it might break the report

In that case, perhaps you need TWO mviews. The usage would then be:

Initial build
=============
- create mview MV_COPY1
- create mview MV_COPY2
- create or replace synonym MV1 for MV_COPY1

Refesh 1
========
- non-atomic refresh of MV_COPY2
- create or replace synonym MV1 for MV_COPY2

Refesh 2
========
- non-atomic refresh of MV_COPY1
- create or replace synonym MV1 for MV_COPY1

Refesh 3
========
- non-atomic refresh of MV_COPY2
- create or replace synonym MV1 for MV_COPY2


and so on



Is this answer out of date? If it is, please let us know via a Comment

More to Explore

PL/SQL demos

Check out more PL/SQL tutorials on our LiveSQL tool.

PL/SQL docs

PL/SQL reference manual from the Oracle documentation library