Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 9004533
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 16, 20262026-06-16T00:55:05+00:00 2026-06-16T00:55:05+00:00

I need to replicate a table from an external db to an internal db

  • 0

I need to replicate a table from an external db to an internal db for performance reasons. Several apps will use this local db to do joins and compare data. I only need to replicate every hour or so but if there is a performance solution, I would prefer to replicate every 5 to 10 minutes.

What would be the best way to replicate? The first thing that comes to mind is DROP and then CREATE:

DROP TABLE clonedTable;
CREATE TABLE clonedTable AS SELECT * from foo.extern@data.sourceTable;

There has to be a better way right? Hopefully an atomic solution to avoid the fraction of a second where the table doesn’t exist but someone might try to query it.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-16T00:55:06+00:00Added an answer on June 16, 2026 at 12:55 am

    The simplest possible solution would be a materialized view that is set to refresh every hour.

    CREATE MATERIALIZED VIEW mv_cloned_table
      REFRESH COMPLETE 
      START WITH sysdate + interval '1' minute
      NEXT sysdate + interval '1' hour
    AS
    SELECT *
      FROM foo.external_table@database_link;
    

    This will delete all the data currently in mv_cloned_table, insert all the data from the table in the external database, and then schedule itself to run again an hour after it finishes (so it will actually be 1 hour + however long it takes to refresh between refreshes).

    There are lots of ways to optimize this.

    • If the folks that own the source database are amenable to it, you can ask them to create a materialized view log on the source table. That would allow your materialized view to replicate just the changes which should be much more efficient and would allow you to schedule refreshes much more frequently.
    • If you have the cooperation of the folks that own the source database, you could also use Streams instead of materialized views which would let you replicate the changes in near real time (a lag of a few seconds would be common). That also tends to be more efficient on the source system than maintaining the materialized view logs would be. But it tends to take more admin time to get everything working properly– materialized views are much less flexible and less efficient but pretty easy to configure.
    • If you don’t mind the table being empty during a refresh (it would exist, it would just have no data), you can do a non-atomic refresh on the materialized view which would do a TRUNCATE followed by a direct-path INSERT rather than a DELETE and conventional path INSERT. The former will be much more efficient but will mean that the table appears empty when you’re doing joins and data comparisons on the local server which seems unlikely to be appropriate in this situation.

    If you want to go down the path of having the source side create a materialized view log so that you can do an incremental refresh, on the source side, assuming the source table has a primary key, you’d ask them to

    CREATE MATERIALIZED VIEW LOG ON foo.external_table
      WITH PRIMARY KEY
      INCLUDING NEW VALUES;
    

    The materialized view that you would create would then be

    CREATE MATERIALIZED VIEW mv_cloned_table
      REFRESH FAST
      START WITH sysdate + interval '1' minute
      NEXT sysdate + interval '1' hour
      WITH PRIMARY KEY
    AS
    SELECT *
      FROM foo.external_table@database_link;
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Hi guys i need to replicate this SQL query in Linq to Entity select
Using data organised as dtl <- replicate(10,data.table(id=sample(letters,10),val=sample(10)), simplify=F) lapply(dtl, function(x){setkey(x,'id')}) I need to extract
I've got a table from an existing LabView VI (ewww!) that I need to
I have a table of items which is retrieved from the internet. This table
I need to replicate memcached to another key value system (couchbase). How can I
I need help to embed a game into HTML, If I did replicate the
In a MongoDB replica set, Does master node need to be accessible from clients?
Need to apply a filter to a file like this: TUPAC_0006:1:1:2554:2356#0/1 0 * 0
Need a map reduce function by mongo in php This my mongo structure [_id]
Need just a push in the right direction with this. I'm building a multi-language

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.