Note:
A materialized view log sho
uld exist for each table you added to the hr_repg master group, unless you deleted these logs manually after you migrate
d the replication group to Streams. If these materialized view logs do not exist, then you must create them.
|
Example Advanced Replication to Streams Migration Script
The foll
owing is an example script generated for the environment:
----------------------------------
------------------------
-- Migration Script Generated on 15-OCT-03 by user STRMADMIN. --
-
---------------------------------------------------------
--------------------------------
--------------------------
-- ************** Notes and Assumptions ************** --
--
-- 1. The Streams Administrator is "strmadmin".
-- The user "strmadmin" must be created an
d granted the
-- required privileges before running the script.
--
-- 2. Names of queue tables, queues, capture processes
-- propagation jobs, and apply processes will be the
<
a name="694268">-- same at all sites. If the DBA wants different names,
-- he must edit the script man
ually before running it
-- at each master site.
--
-- 3. Archive lo
gging must be enabled at all sites before
-- running the script.
--
-- 4. Users must set up database links for queue to queue
-- propagation, if needed.
--
-- 5. Repgroups must be quiesced before running the script.
------------------------------
----------------------------
set pagesize 1000
set echo on
set serveroutput on
whenever sqlerror exit sql.sqlcode;
--
-- Raise error if Repgroups are not Quiesced.
--
declare
repgroup_status VARCHAR2(10);
begin
select status into repgroup_status
from dba_repcat
where gname = 'HR_REPG';
if (
repgroup_status != 'QUIESCED') THEN
raise_application_error(-20000,
'ORA-23310:
object group "HR_REPG" is not quiesced.');
end if;
exception when no_data_found then
null;
end;
/
--------------
-----------------
-- Queue Owner
-------------------------------
-- st
reams queue owner at ORC1.WORLD
define QUEUE_OWNER_ORC1 = strmadmin
-
- streams queue owner at ORC2.WORLD
define QUEUE_OWNER_ORC2 = strmadmin
<
/a>-- streams queue owner at ORC3.WORLD
define QUEUE_OWNER_ORC3 = strmadmin
-------------------------------
-- Queue Table
-------------------------------
-- streams queue table at ORC1.WORLD
define QUEUE_TABLE_ORC1 = streams_queue_table
-- streams queue table at ORC2.WORLD
define QUEUE_TABLE_ORC2 = streams_queue_table
-- streams queue table at ORC3.WORLD
define QUEUE_TABLE_ORC3 = strea
ms_queue_table
-------------------------------
-- Queue
-------------------------------
-- streams queue at ORC1.WORLD
define QUEUE_ORC1 =
streams_queue
-- streams queue at ORC2.WORLD
define QUEUE_ORC2 = stre
ams_queue
-- streams queue at ORC3.WORLD
define QUEUE_ORC3 = streams_
queue
-------------------------------
-- Propagation names
-------------------------------
-- propagation process to ORC1.WORLD
define PROP
_ORC1 = prop_to_ORC1
-- propagation process to ORC2.WORLD
define PROP
_ORC2 = prop_to_ORC2
-- propagation process to ORC3.WORLD
define PROP
_ORC3 = prop_to_ORC3
-------------------------------
-- Capture Proce
ss
-------------------------------
-- capture process to be used or created at the local si
te
define CAPTURE_NAME = streams_capture
----------------------------
---
-- Apply processes
-------------------------------
-- apply proces
s for applying LCRs from ORC1.WORLD
define APPLY_ORC1 = apply_from_ORC1
<
/a>-- apply process for applying LCRs from ORC2.WORLD
define APPLY_ORC2 = apply_from_ORC2
-- apply process for applying LCRs from ORC3.WORLD
define APPLY_ORC3 = apply_from_ORC3
--
-- ** WARNING ** --
-- Streams does not support t
he repobject
-- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG.
-- The user c
an add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNI
NG ** --
-- Streams does not support the repobject
-- EMP_DEPARTMENT_IX of type INDEX belon
ging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to su
pport creation or any future modifications
-- of this type of object.
--
<
/a>
--
-- ** WARNING ** --
-- Streams does not support the repobject
<
a name="694392">-- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to
the Streams environment
-- to support creation or any future modifications
-- of this type
of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REP
G.
-- The user can add DDL rules to the Streams environment
-- to support creation or any f
uture modifications
-- of this type of object.
--
a>--
-- ** WARNING ** --
-- Streams does not support the repobject
--
INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environm
ent
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams
does not support the repobject
-- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modificat
ions
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_EMPLOYEE_
IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not s
upport the repobject
-- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG.
-- The us
er can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** W
ARNING ** --
-- Streams does not support the repobject
-- LOC_COUNTRY_IX of type INDEX belo
nging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to s
upport creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL ru
les to the Streams environment
-- to support creation or any future modifications
-- of thi
s type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_DEPARTMENT_IX of type INDEX belonging to repgr
oup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creatio
n or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams e
nvironment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
--
Streams does not support the repobject
-- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modific
ations
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- INSERT_TIME o
f type TRIGGER belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
-
-
--
-- ** WARNING ** --
-- Streams does not sup
port the repobject
-- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- T
he user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
--
** WARNING ** --
-- Streams does not support the repobject
-- JHIST_EMPLOYEE_IX of type IN
DEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the re
pobject
-- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DD
L rules to the Streams environment
-- to support creation or any future modifications
-- of
this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- LOC_COUNTRY_IX of type INDEX belonging to repg
roup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creati
on or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- DEPT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the St
reams environment
-- to support creation or any future modifications
-- of this type of obj
ect.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any futu
re modifications
-- of this type of object.
--
-
-
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP
_JOB_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does
not support the repobject
-- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG.
--
The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- INSERT_TIME of type TRIGGE
R belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-
- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repo
bject
-- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can a
dd DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING *
* --
-- Streams does not support the repobject
-- JHIST_EMPLOYEE_IX of type INDEX belonging
to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to suppor
t creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to th
e Streams environment
-- to support creation or any future modifications
-- of this type of
object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any fut
ure modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- DE
PT_LOCATION_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environ
ment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Stream
s does not support the repobject
-- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modificati
ons
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_JOB_IX of ty
pe INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support t
he repobject
-- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can
add DDL rules to the Streams environment
-- to support creation or any future modifications
a>-- of this type of object.
--
--
-- ** WARNING
** --
-- Streams does not support the repobject
-- INSERT_TIME of type TRIGGER belonging t
o repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support
creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules
to the Streams environment
-- to support creation or any future modifications
-- of this ty
pe of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup
HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or
any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
<
/a>-- JHIST_JOB_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams env
ironment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- St
reams does not support the repobject
-- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modificat
ions
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- DEPT_LOCATION_I
X of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not su
pport the repobject
-- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- Th
e user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
--
** WARNING ** --
-- Streams does not support the repobject
-- EMP_JOB_IX of type INDEX belo
nging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to s
upport creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rule
s to the Streams environment
-- to support creation or any future modifications
-- of this
type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- INSERT_TIME of type TRIGGER belonging to repgroup HR
_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or a
ny future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Stream
s environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future m
odifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_J
OB_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does no
t support the repobject
-- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG.
-- T
he user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
--
** WARNING ** --
-- Streams does not support the repobject
-- DEPT_LOCATION_IX of type IND
EX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the rep
object
-- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can ad
d DDL rules to the Streams environment
-- to support creation or any future modifications
-
- of this type of object.
--
--
-- ** WARNING **
--
-- Streams does not support the repobject
-- EMP_JOB_IX of type INDEX belonging to repg
roup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creati
on or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_MANAGER_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Stre
ams environment
-- to support creation or any future modifications
-- of this type of objec
t.
--
--
-- ** WARNING ** --
a>-- Streams does not support the repobject
-- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future mod
ifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_DEP
ARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams do
es not support the repobject
-- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_JOB_IX of type
INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the
repobject
-- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can a
dd DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING *
* --
-- Streams does not support the repobject
-- DEPT_LOCATION_IX of type INDEX belonging
to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support
creation or any future modifications
-- of this type of object.
--
<
a name="694866">--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_DEPARTMENT_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules t
o the Streams environment
-- to support creation or any future modifications
-- of this typ
e of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EMP_JOB_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any fut
ure modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- EM
P_MANAGER_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environme
nt
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams
does not support the repobject
-- INSERT_TIME of type TRIGGER belonging to repgroup HR_REPG.
a>-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- JHIST_DEPARTMENT_IX of
type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
<
a name="694910">
--
-- ** WARNING ** --
-- Streams does not suppor
t the repobject
-- JHIST_EMPLOYEE_IX of type INDEX belonging to repgroup HR_REPG.
-- The us
er can add DDL rules to the Streams environment
-- to support creation or any future modifications
-- of this type of object.
--
--
-- ** W
ARNING ** --
-- Streams does not support the repobject
-- JHIST_JOB_IX of type INDEX belong
ing to repgroup HR_REPG.
-- The user can add DDL rules to the Streams environment
-- to sup
port creation or any future modifications
-- of this type of object.
--
a>
--
-- ** WARNING ** --
-- Streams does not support the repobject
-- LOC_COUNTRY_IX of type INDEX belonging to repgroup HR_REPG.
-- The user can add DDL rules
to the Streams environment
-- to support creation or any future modifications
-- of this ty
pe of object.
--
-------------------------------
-- Setup Queue
-------------------------------
variable local_db
varchar2(128);
variable local_queue_table varchar2(30);
variable local_queue va
rchar2(30);
variable local_queue_owner varchar2(30);
-- get the local
database name
declare
global_name varchar2(128);
begin
select global_name into :local_db from global_name;
dbms_output.put_line('The local database name i
s: ' || :local_db);
end;
/
-- get the local queu
e table and queue name
begin
if :local_db = 'ORC1.WORLD' then
:l
ocal_queue_table := '&QUEUE_TABLE_ORC1';
:local_queue := '&QUEUE_ORC1';
:lo
cal_queue_owner := '&QUEUE_OWNER_ORC1';
elsif :local_db = 'ORC2.WORLD' then
:local_queue_table := '&QUEUE_TABLE_ORC2';
:local_queue := '&QUEUE_ORC2';
:local_queue_owner := '&QUEUE_OWNER_ORC2';
elsif :local_db = 'ORC3.W
ORLD' then
:local_queue_table := '&QUEUE_TABLE_ORC3';
:local_queue := '&QUE
UE_ORC3';
:local_queue_owner := '&QUEUE_OWNER_ORC3';
end if
;
dbms_output.put_line('The local queue owner is: ' || :local_queue_owner);
dbms_output.put_line('The local queue table is: ' || :local_queue_table);
dbms_output.put_line('The
local queue name is: ' || :local_queue);
end;
/
a>begin
dbms_streams_adm.set_up_queue(
queue_table => :local_queue_table,
storage_clause => NULL,
queue_name => :local_queue,
queue_us
er => :local_queue_owner,
comment => 'streams_comment');
end;
a>/
-------------------------------
-- Set Instantiation SCN
-------------------------------
variable flashback_scn number;
begin
select dbms_flashback.get_system_change_number into :flashback_scn
from dual;
dbms_output.put_line('local flashback SCN is: ' || :flashback_scn);
end;
/
--
-- Setup instantiation SCN for
ORC1.WORLD
--
begin
--
-- HR_REPG : Set insta
ntiation SCN for "HR"."COUNTRIES" at
-- ORC1.WORLD
--
if (:local
_db != 'ORC1.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC1.WORLD(
source_object_name => '"HR"."COUNTRIES"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if
;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."DEPARTMENTS" at
-- ORC1.WORLD
a> --
if (:local_db != 'ORC1.WORLD') then
dbms_apply_adm.set_table_instantiation_scn
@ORC1.WORLD(
source_object_name => '"HR"."DEPARTMENTS"',
source_database_nam
e => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link
=> NULL);
end if;
end;
/
<
/a>begin
--
-- HR_REPG : Set instantiation SCN for "HR"."EMPLOYEES" at
-- ORC1.WORLD
--
if (:local_db != 'ORC1.WORLD') then
db
ms_apply_adm.set_table_instantiation_scn@ORC1.WORLD(
source_object_name => '"HR"."EMPLOYEES"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN fo
r "HR"."JOBS" at
-- ORC1.WORLD
--
if (:local_db != 'ORC1.WORLD')
then
dbms_apply_adm.set_table_instantiation_scn@ORC1.WORLD(
source_object_name =
> '"HR"."JOBS"',
source_database_name => :local_db,
instantiation_scn =&g
t; :flashback_scn,
apply_database_link => NULL);
end if;
en
d;
/
begin
--
-- HR_REP
G : Set instantiation SCN for "HR"."JOB_HISTORY" at
-- ORC1.WORLD
--
<
/a> if (:local_db != 'ORC1.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC1.WORLD(
source_object_name => '"HR"."JOB_HISTORY"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."LOCATIONS" at
-- ORC1.WORLD
--
if (:local_db != 'ORC1.WORLD') then
dbms_apply_adm.set_table_in
stantiation_scn@ORC1.WORLD(
source_object_name => '"HR"."LOCATIONS"',
source
_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_d
atabase_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."REGIONS" at
-- ORC1.WORLD
--
if (:local_db != 'ORC1.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC1.WORLD(
source_object_name => '"HR"."REGIONS"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
--
-- Setup instantiation SCN for ORC2.WORLD
--
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."COUNT
RIES" at
-- ORC2.WORLD
--
if (:local_db != 'ORC2.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC2.WORLD(
source_object_name => '"H
R"."COUNTRIES"',
source_database_name => :local_db,
instantiation_scn =>
:flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG :
Set instantiation SCN for "HR"."DEPARTMENTS" at
-- ORC2.WORLD
--
if (:local_db != 'ORC2.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC2.WORLD(
source_object_name => '"HR"."DEPARTMENTS"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
a> --
-- HR_REPG : Set instantiation SCN for "HR"."EMPLOYEES" at
-- ORC2.WORLD
--
if (:local_db != 'ORC2.WORLD') then
dbms_apply_adm.set_table_insta
ntiation_scn@ORC2.WORLD(
source_object_name => '"HR"."EMPLOYEES"',
source_da
tabase_name => :local_db,
instantiation_scn => :flashback_scn,
apply_data
base_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."JOBS" at
-- ORC2.WORLD
--
if (:local_db != 'ORC2.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC2.WORLD(
source_object_name => '"HR"."JOBS"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN fo
r "HR"."JOB_HISTORY" at
-- ORC2.WORLD
--
if (:local_db != 'ORC2.
WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC2.WORLD(
source_object
_name => '"HR"."JOB_HISTORY"',
source_database_name => :local_db,
instant
iation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
<
/a> -- HR_REPG : Set instantiation SCN for "HR"."LOCATIONS" at
-- ORC2.WORLD
--
if (:local_db != 'ORC2.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC2.WORLD(
source_object_name => '"HR"."LOCATIONS"',
source_database_name => :local_
db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."REGIONS" at
-- ORC2.WO
RLD
--
if (:local_db != 'ORC2.WORLD') then
dbms_apply_adm.set_
table_instantiation_scn@ORC2.WORLD(
source_object_name => '"HR"."REGIONS"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
a
pply_database_link => NULL);
end if;
end;
/
--
-- Setup instantiation SCN for ORC3.WORLD
--
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."COUNTRIES" at
a> -- ORC3.WORLD
--
if (:local_db != 'ORC3.WORLD') then
dbms_
apply_adm.set_table_instantiation_scn@ORC3.WORLD(
source_object_name => '"HR"."COUNTRIES"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "
HR"."DEPARTMENTS" at
-- ORC3.WORLD
--
if (:local_db != 'ORC3.WOR
LD') then
dbms_apply_adm.set_table_instantiation_scn@ORC3.WORLD(
source_object_na
me => '"HR"."DEPARTMENTS"',
source_database_name => :local_db,
instantiat
ion_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."EMPLOYEES" at
-- ORC3.WORLD
--
if (:local_db != 'ORC3.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC3.WORLD(
source_object_name => '"HR"."EMPLOYEES"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."JOBS" at
-- ORC3.WORLD
--
if (:local_db != 'ORC3.WORLD') then
dbms_apply_adm.set_table_
instantiation_scn@ORC3.WORLD(
source_object_name => '"HR"."JOBS"',
source_da
tabase_name => :local_db,
instantiation_scn => :flashback_scn,
apply_data
base_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."JOB_HISTORY" at
-- ORC3.WORLD
--
if (:local_db != 'ORC3.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC3.WORLD(
source_object_name => '"HR"."JOB_HISTO
RY"',
source_database_name => :local_db,
instantiation_scn => :flashback_
scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instan
tiation SCN for "HR"."LOCATIONS" at
-- ORC3.WORLD
--
if (:local_
db != 'ORC3.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC3.WORLD(
s
ource_object_name => '"HR"."LOCATIONS"',
source_database_name => :local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NULL);
end if;
end;
/
begin
--
-- HR_REPG : Set instantiation SCN for "HR"."REGIONS" at
-- ORC3.WORLD
-
-
if (:local_db != 'ORC3.WORLD') then
dbms_apply_adm.set_table_instantiation_scn@ORC3
.WORLD(
source_object_name => '"HR"."REGIONS"',
source_database_name => :
local_db,
instantiation_scn => :flashback_scn,
apply_database_link => NUL
L);
end if;
end;
/
------
-------------------------
-- Setup Propagation
-------------------------------
--
-- Propagation from local queue to ORC1.WORLD
--
begin
if :local_db != 'ORC1.WORLD' then
--
-- H
R_REPG: Propagate "COUNTRIES" from local queue to ORC1
--
dbms_streams_adm.add_tabl
e_propagation_rules(
table_name => '"HR"."COUNTRIES"',
streams_name => '&
amp;PROP_ORC1',
source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC1' ||
'.' || '&QUEUE_ORC1' ||
'@ORC1.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
a> if :local_db != 'ORC1.WORLD' then
--
-- HR_REPG: Propagate "DEPARTMENTS" from l
ocal queue to ORC1
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."DEPARTMENTS"',
streams_name => '&PROP_ORC1',
<
/a> source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '
&QUEUE_OWNER_ORC1' ||
'.' || '&QUEUE_ORC1' ||
'@ORC1.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_t
agged_lcr => FALSE,
source_database => :local_db);
end if;
<
/a>end;
/
begin
if :local_db != 'ORC1.WORLD' t
hen
--
-- HR_REPG: Propagate "EMPLOYEES" from local queue to ORC1
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."
EMPLOYEES"',
streams_name => '&PROP_ORC1',
source_queue_name => :loca
l_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC1' ||
'.' || '&QUEUE_ORC1' ||
'@ORC1.WORLD',
include_dml =>
TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC1.WORLD' then
--
-- HR_REPG: Propagate "JOBS" from local queue to ORC1
--
dbms_st
reams_adm.add_table_propagation_rules(
table_name => '"HR"."JOBS"',
streams_
name => '&PROP_ORC1',
source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC1' ||
'.' || '&QUEUE_ORC1' ||
'@ORC1.WORLD',
include_dml => TRUE,
include_ddl =&
gt; FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC1.WORLD' then
--
-- HR_REPG: Propagate "JOB_HI
STORY" from local queue to ORC1
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."JOB_HISTORY"',
streams_name => '&PROP_ORC1',
source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue
_name => '&QUEUE_OWNER_ORC1' ||
'.' || '&QUEUE_ORC1' ||
'@ORC1.W
ORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != '
ORC1.WORLD' then
--
-- HR_REPG: Propagate "LOCATIONS" from local queue to ORC1
--
dbms_streams_adm.add_table_propagation_rules(
table_name
=> '"HR"."LOCATIONS"',
streams_name => '&PROP_ORC1',
source_queue_nam
e => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC1' ||
'.' || '&QUEUE_ORC1' ||
'@ORC1.WORLD',
incl
ude_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC1.WORLD' then
--
-- HR_REPG: Propagate "REGIONS" from local queue to ORC1
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."REGIONS"',
streams_name => '&PROP_ORC1',
source_queue_name => :local_queue_owner || '.' || :loca
l_queue,
destination_queue_name => '&QUEUE_OWNER_ORC1' ||
'.' || '&
;QUEUE_ORC1' ||
'@ORC1.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database =
> :local_db);
end if;
end;
/
--
-- Propagation from local queue to ORC2.WORLD
--
begin
if :local_db != 'ORC2.WORLD' then
--
-- HR_REPG: Propagate "COUNT
RIES" from local queue to ORC2
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."COUNTRIES"',
streams_name => '&PROP_ORC2',
source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_na
me => '&QUEUE_OWNER_ORC2' ||
'.' || '&QUEUE_ORC2' ||
'@ORC2.WORL
D',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC
2.WORLD' then
--
-- HR_REPG: Propagate "DEPARTMENTS" from local queue to ORC2
--
dbms_streams_adm.add_table_propagation_rules(
table_name =
> '"HR"."DEPARTMENTS"',
streams_name => '&PROP_ORC2',
source_queue_na
me => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC2' |
|
'.' || '&QUEUE_ORC2' ||
'@ORC2.WORLD',
inc
lude_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
<
a name="695513"> source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC2.WORLD' then
--
-- HR_REPG: Propagate "EMPLOYEES" from local queue to ORC2
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."EMPLOYEES"',
streams_name => '&PROP_ORC2',
source_queue_name => :local_queue_owner || '.' ||
:local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC2' ||
'.' ||
'&QUEUE_ORC2' ||
'@ORC2.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_datab
ase => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC2.WORLD' then
--
-- HR
_REPG: Propagate "JOBS" from local queue to ORC2
--
dbms_streams_adm.add_table_prop
agation_rules(
table_name => '"HR"."JOBS"',
streams_name => '&PROP_OR
C2',
source_queue_name => :local_queue_owner || '.' || :local_queue,
destina
tion_queue_name => '&QUEUE_OWNER_ORC2' ||
'.' || '&QUEUE_ORC2' ||
'@ORC2.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end
if;
end;
/
begin
if :loc
al_db != 'ORC2.WORLD' then
--
-- HR_REPG: Propagate "JOB_HISTORY" from local queue
to ORC2
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."JOB_HISTORY"',
streams_name => '&PROP_ORC2',
so
urce_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_
OWNER_ORC2' ||
'.' || '&QUEUE_ORC2' ||
'@ORC2.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr =
> FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC2.WORLD' then
--
-- HR_REPG: Propagate "LOCATIONS" from local queue to ORC2
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."LOCATIONS"'
,
streams_name => '&PROP_ORC2',
source_queue_name => :local_queue_own
er || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC2' ||
'.' || '&QUEUE_ORC2' ||
'@ORC2.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
<
/a>
begin
if :local_db != 'ORC2.WORLD' then
--
-- HR_REPG: Propagate "REGIONS" from local queue to ORC2
--
dbms_streams_ad
m.add_table_propagation_rules(
table_name => '"HR"."REGIONS"',
streams_name
=> '&PROP_ORC2',
source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC2' ||
'.' || '&QUEUE_ORC2' ||
'@ORC2.WORLD',
include_dml => TRUE,
include_ddl => F
ALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
--
-- Propagation from local queue to ORC3.WORLD
--
begin
if :lo
cal_db != 'ORC3.WORLD' then
--
-- HR_REPG: Propagate "COUNTRIES" from local queue t
o ORC3
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."COUNTRIES"',
streams_name => '&PROP_ORC3',
sourc
e_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWN
ER_ORC3' ||
'.' || '&QUEUE_ORC3' ||
'@ORC3.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr =>
; FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC3.WORLD' then
--
-- HR_REPG: Propagate "DEPARTMENTS" from local queue to ORC3
--
<
a name="695646"> dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."DEPARTMENTS"
',
streams_name => '&PROP_ORC3',
source_queue_name => :local_queue_ow
ner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC3' ||
'.' || '&QUEUE_ORC3' ||
'@ORC3.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC3.WORLD' then
--
-- HR_REPG: Propagate "EMPLOYEES" from local queue to ORC3
--
dbms_streams
_adm.add_table_propagation_rules(
table_name => '"HR"."EMPLOYEES"',
streams_
name => '&PROP_ORC3',
source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC3' ||
'.' || '&QUEUE_ORC3' ||
'@ORC3.WORLD',
include_dml => TRUE,
include_ddl =&
gt; FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC3.WORLD' then
--
-- HR_REPG: Propagate "JOBS"
from local queue to ORC3
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."JOBS"',
streams_name => '&PROP_ORC3',
a> source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_queue_name => '&
amp;QUEUE_OWNER_ORC3' ||
'.' || '&QUEUE_ORC3' ||
'@ORC3.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
include_ta
gged_lcr => FALSE,
source_database => :local_db);
end if;
a>end;
/
begin
if :local_db != 'ORC3.WORLD' th
en
--
-- HR_REPG: Propagate "JOB_HISTORY" from local queue to ORC3
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR".
"JOB_HISTORY"',
streams_name => '&PROP_ORC3',
source_queue_name => :l
ocal_queue_owner || '.' || :local_queue,
destination_queue_name => '&QUEUE_OWNER_ORC3' ||
'.' || '&QUEUE_ORC3' ||
'@ORC3.WORLD',
include_dml =&
gt; TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
begin
if :local_db != 'ORC3.WORLD' then
--
-- HR_REPG: Propagate "LOCATIONS" from local queue to ORC3
--
dbms_streams_adm.add_table_propagation_rules(
table_name => '"HR"."LOCATIONS"',
streams_name => '&PROP_ORC3',
source_queue_name => :local_queue_owner || '.' || :local_queu
e,
destination_queue_name => '&QUEUE_OWNER_ORC3' ||
'.' || '&QUEUE
_ORC3' ||
'@ORC3.WORLD',
include_dml => TRUE,
i
nclude_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :
local_db);
end if;
end;
/
begin
if :local_db != 'ORC3.WORLD' then
--
-- HR_REPG: Prop
agate "REGIONS" from local queue to ORC3
--
dbms_streams_adm.add_table_propagation_
rules(
table_name => '"HR"."REGIONS"',
streams_name => '&PROP_ORC3',
source_queue_name => :local_queue_owner || '.' || :local_queue,
destination_
queue_name => '&QUEUE_OWNER_ORC3' ||
'.' || '&QUEUE_ORC3' ||
'@O
RC3.WORLD',
include_dml => TRUE,
include_ddl => FALSE,
<
/a> include_tagged_lcr => FALSE,
source_database => :local_db);
end if;
end;
/
-------------------------------
-- Setup Capture
-------------------------------
begin
-
-
-- HR_REPG : Add "COUNTRIES"
--
dbms_streams_adm.add_table_rul
es(
table_name => '"HR"."COUNTRIES"',
streams_type => 'CAPTURE',
streams_name => '&CAPTURE_NAME',
queue_name => :local_queue_owner || '.' || :local_qu
eue,
include_dml => TRUE,
include_ddl => FALSE,
incl
ude_tagged_lcr => FALSE,
source_database => :local_db);
end;
/
begin
--
-- HR_REPG : Add "DEPARTMENTS"
<
a name="695783"> --
dbms_streams_adm.add_table_rules(
table_name => '"HR"."DE
PARTMENTS"',
streams_type => 'CAPTURE',
streams_name => '&CAPTURE_NAME',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end;
/
begin
<
a name="695797"> --
-- HR_REPG : Add "EMPLOYEES"
--
dbms_st
reams_adm.add_table_rules(
table_name => '"HR"."EMPLOYEES"',
streams_type =>
'CAPTURE',
streams_name => '&CAPTURE_NAME',
queue_name => :local_queue_ow
ner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
en
d;
/
begin
--
-- HR_REP
G : Add "JOBS"
--
dbms_streams_adm.add_table_rules(
table_name
=> '"HR"."JOBS"',
streams_type => 'CAPTURE',
streams_name => '&CAPTUR
E_NAME',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml =&
gt; TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end;
/
a>begin
--
-- HR_REPG : Add "JOB_HISTORY"
--
a> dbms_streams_adm.add_table_rules(
table_name => '"HR"."JOB_HISTORY"',
stream
s_type => 'CAPTURE',
streams_name => '&CAPTURE_NAME',
queue_name => :l
ocal_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl =>
FALSE,
include_tagged_lcr => FALSE,
source_database => :local_db);
end;
/
begin
--
a> -- HR_REPG : Add "LOCATIONS"
--
dbms_streams_adm.add_table_rules(
table_name => '"HR"."LOCATIONS"',
streams_type => 'CAPTURE',
streams_
name => '&CAPTURE_NAME',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr =>
FALSE,
source_database => :local_db);
end;
/
<
/a>
begin
--
-- HR_REPG : Add "REGIONS"
--
dbms_streams_adm.add_table_rules(
table_name => '"HR"."REGIONS"',
streams_type => 'CAPTURE',
streams_name => '&CAPTURE_NAME',
queu
e_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
inc
lude_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => :local_
db);
end;
/
-------------------------------
-- Setup Apply
-------------------------------
--
--
Setup Apply from ORC1.WORLD
--
begin
--
-- HR_REPG : Add "COUNTRIES" to apply rules for apply from
-- ORC1.WORLD
--
if(:local_db != 'ORC1.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."COUNTRIES"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC1',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_
tagged_lcr => FALSE,
source_database => 'ORC1.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "DEPARTMENTS" to apply rules for apply from
-- ORC1.WORLD
--
if(:local_db != 'ORC1.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."DEPARTMENTS"',
streams_type => 'APPLY',
streams_na
me => '&APPLY_ORC1',
queue_name => :local_queue_owner || '.' || :local_queue,
<
/a> include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr =&
gt; FALSE,
source_database => 'ORC1.WORLD');
end if;
end;
<
a name="695919">/
begin
--
-- HR_REPG :
Add "EMPLOYEES" to apply rules for apply from
-- ORC1.WORLD
--
i
f(:local_db != 'ORC1.WORLD') then
dbms_streams_adm.add_table_rules(
table_name =&
gt; '"HR"."EMPLOYEES"',
streams_type => 'APPLY',
streams_name => '&AP
PLY_ORC1',
queue_name => :local_queue_owner || '.' || :local_queue,
include_
dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => 'ORC1.WORLD');
end if;
end;
<
/a>/
begin
--
-- HR_REPG : Add "JOBS" to app
ly rules for apply from
-- ORC1.WORLD
--
if(:local_db != 'ORC1.W
ORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."JOBS"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC1',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source
_database => 'ORC1.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "JOB_HISTORY" to apply rules for apply f
rom
-- ORC1.WORLD
--
if(:local_db != 'ORC1.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."JOB_HISTORY"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC1',
qu
eue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database =&g
t; 'ORC1.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "LOCATIONS" to apply rules for apply from
-- ORC1.WORLD
--
if(:local_db != 'ORC1.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."LOCATIONS"',
stream
s_type => 'APPLY',
streams_name => '&APPLY_ORC1',
queue_name => :l
ocal_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl =&
gt; FALSE,
include_tagged_lcr => FALSE,
source_database => 'ORC1.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "REGIONS" to apply rules for apply from
-- ORC1
.WORLD
--
if(:local_db != 'ORC1.WORLD') then
dbms_streams_adm.
add_table_rules(
table_name => '"HR"."REGIONS"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC1',
queue_name => :local_queue_owner || '
.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => 'ORC1.WORLD');
end if;
end;
/
--
-- Set
up Apply from ORC2.WORLD
--
begin
--
-- HR_REPG : Add "COUNTRIES" to apply rules for apply from
-- ORC2.WORLD
--
if(:local_db != 'ORC2.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."COUNTRIES"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC2',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tag
ged_lcr => FALSE,
source_database => 'ORC2.WORLD');
end if;
end;
/
begin
--
--
HR_REPG : Add "DEPARTMENTS" to apply rules for apply from
-- ORC2.WORLD
--
if(:local_db != 'ORC2.WORLD') then
dbms_streams_adm.add_table_rules(
t
able_name => '"HR"."DEPARTMENTS"',
streams_type => 'APPLY',
streams_name
=> '&APPLY_ORC2',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr =>
FALSE,
source_database => 'ORC2.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add
"EMPLOYEES" to apply rules for apply from
-- ORC2.WORLD
--
if(:
local_db != 'ORC2.WORLD') then
dbms_streams_adm.add_table_rules(
table_name =>
'"HR"."EMPLOYEES"',
streams_type => 'APPLY',
streams_name => '&APPLY
_ORC2',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml
=> TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => 'ORC2.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "JOBS" to apply
rules for apply from
-- ORC2.WORLD
--
if(:local_db != 'ORC2.WORL
D') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."JOBS"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC2',
a> queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_da
tabase => 'ORC2.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "JOB_HISTORY" to apply rules for apply from
-- ORC2.WORLD
--
if(:local_db != 'ORC2.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."JOB_HISTORY"',
a> streams_type => 'APPLY',
streams_name => '&APPLY_ORC2',
queue
_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database =>
'ORC2.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "LOCATIONS" to apply rules for apply from
-- ORC2.WORLD
--
if(:local_db != 'ORC2.WORLD') then
d
bms_streams_adm.add_table_rules(
table_name => '"HR"."LOCATIONS"',
streams_t
ype => 'APPLY',
streams_name => '&APPLY_ORC2',
queue_name => :loca
l_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl =>
FALSE,
include_tagged_lcr => FALSE,
source_database => 'ORC2.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "REGIONS" to apply rules for apply from
-- ORC2.WO
RLD
--
if(:local_db != 'ORC2.WORLD') then
dbms_streams_adm.add
_table_rules(
table_name => '"HR"."REGIONS"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC2',
queue_name => :local_queue_owner || '.'
|| :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => 'ORC2.WORLD');
end if;
end;
/
--
-- Setup
Apply from ORC3.WORLD
--
begin
--
-- HR_REPG : Add "COUNTRIES" to apply rules for apply from
-- ORC3.WORLD
--
if(:local_db != 'ORC3.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."COUNTRIES"',
streams_type => 'APPLY',
str
eams_name => '&APPLY_ORC3',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged
_lcr => FALSE,
source_database => 'ORC3.WORLD');
end if;
end;
/
begin
--
-- HR_
REPG : Add "DEPARTMENTS" to apply rules for apply from
-- ORC3.WORLD
--
if(:local_db != 'ORC3.WORLD') then
dbms_streams_adm.add_table_rules(
tabl
e_name => '"HR"."DEPARTMENTS"',
streams_type => 'APPLY',
streams_name =&g
t; '&APPLY_ORC3',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FA
LSE,
source_database => 'ORC3.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "E
MPLOYEES" to apply rules for apply from
-- ORC3.WORLD
--
if(:loc
al_db != 'ORC3.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"
HR"."EMPLOYEES"',
streams_type => 'APPLY',
streams_name => '&APPLY_OR
C3',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml =&
gt; TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => 'ORC3.WORLD');
end if;
end;
/
<
a name="696213">
begin
--
-- HR_REPG : Add "JOBS" to apply rul
es for apply from
-- ORC3.WORLD
--
if(:local_db != 'ORC3.WORLD')
then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."JOBS"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC3',
queue_name => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_datab
ase => 'ORC3.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "JOB_HISTORY" to apply rules for apply from
-- ORC3.WORLD
--
if(:local_db != 'ORC3.WORLD') then
dbms_streams_adm.add_table_rules(
table_name => '"HR"."JOB_HISTORY"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC3',
queue_na
me => :local_queue_owner || '.' || :local_queue,
include_dml => TRUE,
inc
lude_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => 'OR
C3.WORLD');
end if;
end;
/
a>begin
--
-- HR_REPG : Add "LOCATIONS" to apply rules for apply from
-- ORC3.WORLD
--
if(:local_db != 'ORC3.WORLD') then
dbms
_streams_adm.add_table_rules(
table_name => '"HR"."LOCATIONS"',
streams_type
=> 'APPLY',
streams_name => '&APPLY_ORC3',
queue_name => :local_q
ueue_owner || '.' || :local_queue,
include_dml => TRUE,
include_ddl => FA
LSE,
include_tagged_lcr => FALSE,
source_database => 'ORC3.WORLD');
end if;
end;
/
begin
--
-- HR_REPG : Add "REGIONS" to apply rules for apply from
-- ORC3.WORLD
--
if(:local_db != 'ORC3.WORLD') then
dbms_streams_adm.add_ta
ble_rules(
table_name => '"HR"."REGIONS"',
streams_type => 'APPLY',
streams_name => '&APPLY_ORC3',
queue_name => :local_queue_owner || '.' ||
:local_queue,
include_dml => TRUE,
include_ddl => FALSE,
include_tagged_lcr => FALSE,
source_database => 'ORC3.WORLD');
end
if;
end;
/
-------------------------------
-- Add Supplemental Log Groups
-------------------------------
--
-- ** NOTE ** --
-- The primary key columns must be supplementally logged.
--
alter database add supplemental log data (primary key) columns;
--
-- ** NOTE ** --
-- The unique key columns must be supplementally logged.
a>--
alter database add supplemental log data (unique index) columns;
--
-- ** NOTE ** --
-- All the columns in a column group that is assigned a Streams
-- supported update conflict handler must be supplementally logged.
--
-- Supplementally log columns in column group 'COUNTRIES_TIMESTAMP_CG'
-- that is assigned the
LATEST TIMESTAMP update conflict resolution method.
alter table "HR"."COUNTRIES" add supplemental log group COUN
TRIES_LogGrp1 (
"COUNTRY_NAME"
,"REGION_ID"
,"TIMESTAMP"
);
-------------------------------
-- Setup Conflict Resoluti
on
-------------------------------
--
-- ** WARNING ** --
-- Streams does not support LATEST TIMESTAMP
-- conflict resolution method.
-- Cha
nging LATEST TIMESTAMP to MAXIMUM as
-- they handle the conflicts in a similar manner.
--
<
a name="696329">declare
cols dbms_utility.name_array;
begin
co
ls(1) := 'COUNTRY_NAME';
cols(2) := 'REGION_ID';
cols(3) := 'TIMESTAMP';
dbms_apply_adm.set_update_conflict_handler(
object_name => 'HR.COUNTRIES',
method_name => 'MAXIMUM',
resolution_column => 'TIMESTAMP',
column_list =
> cols);
end;
/
-----------------------------
--
-- Verify Streams Setup
-------------------------------
-- Verify creation of queues
select * from dba_queues
where name = upper(:local
_queue)
and owner = upper(:local_queue_owner)
and queue_table = upper(:local_queue_ta
ble)
order by name;
-- Verify creation of capture_process
select * from dba_capture
where capture_name = upper('&CAPTURE_NAME');
-- Verify creation of apply processes
select * from dba_apply
where appl
y_name IN (
upper('&APPLY_ORC1'),
upper('&APPLY_ORC2'),
upper('&APPLY_ORC3') )
order by apply_name;
-- Ve
rify propagation processes
select * from dba_propagation
where propagation_name IN (
upper('&PROP_ORC1'),
upper('&PROP_ORC2'),
uppe
r('&PROP_ORC3') )
order by propagation_name;
-- Verify Streams r
ules
select * from dba_streams_table_rules
where streams_name = upper('&CAPTURE_NAME')
;
select * from dba_streams_table_rules
where streams_name IN (
upper('&APPLY_ORC1'),
upper('&APPLY_ORC2'),
u
pper('&APPLY_ORC3') )
order by source_database;
select * from db
a_streams_table_rules
where streams_name IN (
upper('&PROP_ORC1'),
upper('&PROP_ORC2'),
upper('&PROP_ORC3') )
order by source_
database;
-- Do not resume Repcat activity once Streams is set up.
--
Drop all the repgroups that have been migrated to Streams.
-- Start apply and capture processes at all sites.
<
a name="696395">