Switch Synonyms between two tables- Help
800691Sep 26 2010 — edited Sep 27 2010I have two tables, METADATA_A and METADATA_B. I need to switch loading these tables. If we load METADATA_A today, the following
week we would have to load METADATA_B.
There is a public synonym "METADATA" that sits on top of these two tables.
1) Find out which table is in use right now..
Code:
SELECT *
FROM ALL_SYNONYMS
WHERE SYNONYM_NAME = "METADATA"
2) Truncate opposite table
3) Load opposite table
4) Validate by doing a count * on the table to check the rows loaded.
5) Finally, switch synonym
Can this be achieved using procedure. Please advice.
Thanks in advance,
Todd