Hello everyone,

I am having a hard time finding the information I need and am hoping you all can help.

I am using sql developer and I have a database named us that holds 5 tables and a database named uk that holds the same 5 tables.

It is a demo online store with an item, client, order, orderdetails, and staff tables.

I want to set up replication so that at 11:59pm every night, anything added on the uk database is replicated to the us database.

Can someone please help me with the code to do this? I have everything else working great but replication information is fuzzy to say the least.

Thank you in advance

Member Avatar for LastMitch

I am having a hard time finding the information I need and am hoping you all can help.

I don't feel you have a hard time. It's just that you are not familiar with replication.

You can read this just to give you an idea how the query works and looks like:

http://www.akadia.com/services/ora_replication_guide.html

I want to set up replication so that at 11:59pm every night, anything added on the uk database is replicated to the us database.

You can read this too depending which version you are using:

http://www.oracle.com/technetwork/database/focus-areas/data-integration/index.html

Thanks for the reply. After hours of trial and error, the below code is what did the trick

[code]Create_replication_US.sql
PROMPT Creating database lint to uk (UK)

DROP DATABASE LINK UK_LINK
/CREATE DATABASE LINK UK_LINK
CONNECT TO *** IDENTIFIED BY ******
USING ‘UK’
/

DROP SNAPSHOT CLIENTS_TABLES_SNAP
PROMPT Creating database replication schedule for clients table
CREATE SNAPSHOT CLIENTS_TABLE_SNAP
REFRESH COMPLETE
START WITH TO_DATE(to_char(sysdate, ‘DD-MON-YYYY’) || ‘-11:59’, ‘DD-MON-YYYY-
HH-MI’)
NEXT TO_DATE(to_char(sysdate, ‘DD-MON-YYYY’) || ‘-11:50, ‘DD-MON-YYYY-HH-
MI’) + 1
AS SELECT * FROM clients@UK_LINK[/code]

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.