Skip to Main Content

SQL & PL/SQL

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Swapping synonyms between tow tables every week

CrackerJackAug 4 2008 — edited Aug 5 2008
Hi AIl,

I have two tables, A and B. I need to switch loading these tables. If we load A today, the following
week we would have to load B.

There is a public synonym "C" that sits on top of these two tables.

1) To Find out which table is in use right now..

SELECT *
FROM ALL_SYNONYMS
WHERE SYNONYM_NAME = "C"

2) Truncate opposite table/Drop opposite table

3) Load data into 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 shell script or PL/SQL?

Please advice.A little eheadstart would be great.

Message was edited by:
CrackerJack
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Sep 2 2008
Added on Aug 4 2008
11 comments
2,246 views