0

My client has two tables that are identical other then name, I'll call them T1 and T2.

One synonym, TN that points to T1, while some batch process works on T2.

When the batch is completed the synonym TN is replaced pointing to the T2 table. This switch takes place back and forth once a day.

My questions are:

1) When create or replace synonym t for t2; is done switching TN to point to t2 instead of t1 and concurrent queries to Oracle accessing TN keeps coming in either by using sql or storedproc , will there be a point where at the time of switching a query may fail.

1 Answer 1

0

Blockquote will there be a point where at the time of switching a query may fail. Blockquote

In general, no. Lookup of synonym object is done at parsing time. Queries done before the "replace" continue to go to T1, and queries after go to T2. Also, procedures using synonyms "should" compile automatically when if they were invalidated after the change

There are rules for "replacing" a synonym, just make sure you can replace the synonym

Also, there could be better designs to your requirement

2
  • Can you suggest an improved design which can solve this problem like what you suggested?
    – Maths
    Sep 18, 2017 at 9:34
  • Tell me more about what you do and what's taking place in the batch. Are T1 and T2 separate tables/materialized views/etc?
    – BA.
    Sep 18, 2017 at 10:01

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.