This content has been marked as final. Show 2 replies
You may try to write a stored procedure instead of a script. In the procedure, do the following
1. Write a dynamic SQL 'Create temp table as select * from remote_table@remote_link' and then execute it.
2. Write a dynamic SQL 'Truncate local_table' and execute it.
3. Write a dynamic SQL 'INSERT INTO local_table select * from temp_table' and execute it.
Then create a scheduler job using DBMS_SCHEDUER.create_job to run the stored procedure at your preferred interval.
job_type => 'stored_procedure',
repeat_interval => 'FREQ=HOURLY; INTERVAL=2',
enabled => true,
To simplify and optimize the procedure, you can create materialized views and then just refresh them when you need.