sql - Strategy to alter database synonym during normal production operation -
currently have scenario involves switching synonym definition after completion of scheduled job. job create table identifier of even
or odd
correspond hour being or odd. doing this:
odd_job: create foo_odd ... replace foo_syn foo_odd
and
even_job: create foo_even ... replace foo_syn foo_even
what happening during normal production foo_syn
in locked state. looking production capable way of swapping synonym definitions.
the question how can swap synonym definition in production level system minimum user interruption in oracle 10g?
from comments
does foo_syn have dependent objects?
no foo_syn
nothing more pointer table generate. there no procedures need recompiled switch.
that sounds strange thing do. can explain bit switch for/how used?
sure. have application interfaces database, sql executed java (business logic queries) has reference foo_syn
. because of dynamic nature of data guarantee hourly swap give new results important try closer real time. prior once day , happy type scenario.
the reasoning swap not want dynamic sql (in terms of table names) part of application queries. therefore database switch on newer data set without changing name of synonym referenced part of application.
if using dynamic sql distasteful (and i'll point out in experience dynamic sql has never proved performance issue, ymmv) union query might you're looking - like
select * even_data_table to_number(to_char(sysdate, 'hh')) in (0, 2, 4, 6, 8, 10, 12) union select * odd_data_table to_number(to_char(sysdate, 'hh')) in (1, 3, 5, 7, 9, 11)
this eliminates need have periodic job change synonym it's driven off of sysdate.
this makes assumption columns in even_data_table , odd_data_table same.
share , enjoy.
Comments
Post a Comment