|
|
|
|
|
Re: error remote table does not contain a primary key [message #535997 is a reply to message #535996] |
Sun, 18 December 2011 17:58 |
|
forsubhi
Messages: 5 Registered: December 2011
|
Junior Member |
|
|
I mean by the error that when I insert value to oracle db then capture process capture changes and apply process send changes through getway to Microsoft sql database the error tell me that I didn't add primary key but I add it because I use
CREATE TABLE regions (a INTEGER primary key)
to create the table in Microsoft sql
and these are the complete command that I use to make the replication
CREATE PUBLIC DATABASE LINK aaa.subhi.com CONNECT TO
"sa" IDENTIFIED BY "asd" USING 'dg4msql';
conn strmadmin/123;
EXEC DBMS_STREAMS_ADM.SET_UP_QUEUE();
DECLARE
ret INTEGER;
BEGIN
ret := DBMS_HS_PASSTHROUGH.EXECUTE_IMMEDIATE@aaa.subhi.com (
'drop TABLE "HR"."jobs1"');
END;
/
COMMIT;
conn strmadmin/123;
DECLARE
ret INTEGER;
BEGIN
ret := DBMS_HS_PASSTHROUGH.EXECUTE_IMMEDIATE@aaa.subhi.com (
'CREATE TABLE "HR"."jobs1" ( "JOB_ID" VARCHAR(10), "JOB_TITLE" VARCHAR(35) CONSTRAINT "JOB_TITLE_NN1" NOT NULL , "MIN_SALARY" integer, "MAX_SALARY" integer,CONSTRAINT "JOB_ID_PK1" PRIMARY KEY ("JOB_ID"))');
END;
/
COMMIT;
conn hr/hr
CREATE TABLE "HR"."jobs1" ( "JOB_ID" VARCHAR(10), "JOB_TITLE" VARCHAR(35) CONSTRAINT "JOB_TITLE_NN1" NOT NULL , "MIN_SALARY" integer, "MAX_SALARY" integer,CONSTRAINT "JOB_ID_PK1" PRIMARY KEY ("JOB_ID"))
conn strmadmin/123;
BEGIN
DBMS_CAPTURE_ADM.PREPARE_TABLE_INSTANTIATION(
table_name => 'hr.jobs1',
supplemental_logging => 'keys');
END;
/
DECLARE
iscn NUMBER;
BEGIN
iscn := DBMS_FLASHBACK.GET_SYSTEM_CHANGE_NUMBER();
DBMS_APPLY_ADM.SET_TABLE_INSTANTIATION_SCN(
source_object_name => 'hr.jobs1',
source_database_name => 'orcl3',
instantiation_scn => iscn,
apply_database_link => 'aaa.subhi.com');
END;
/
BEGIN
DBMS_STREAMS_ADM.ADD_SCHEMA_RULES(
schema_name => 'hr',
streams_type => 'capture',
streams_name => 'capture_sql',
queue_name => 'strmadmin.streams_queue',
include_dml => TRUE,
include_ddl => TRUE,
inclusion_rule => TRUE);
END;
/
BEGIN
DBMS_APPLY_ADM.CREATE_APPLY(
queue_name => 'strmadmin.streams_queue',
apply_name => 'apply_sql',
apply_database_link => 'aaa.subhi.com',
apply_captured => TRUE);
END;
/
BEGIN
DBMS_STREAMS_ADM.ADD_TABLE_RULES(
table_name => 'hr.jobs1',
streams_type => 'apply',
streams_name => 'apply_sql',
queue_name => 'strmadmin.streams_queue',
include_dml => TRUE,
include_ddl => FALSE,
source_database => 'orcl3',
inclusion_rule => TRUE);
END;
/
BEGIN
DBMS_APPLY_ADM.SET_PARAMETER(
apply_name => 'apply_sql',
parameter => 'disable_on_error',
value => 'N');
END;
/
BEGIN
DBMS_APPLY_ADM.START_APPLY(
apply_name => 'apply_sql');
END;
/
BEGIN
DBMS_CAPTURE_ADM.START_CAPTURE(
capture_name => 'capture_sql');
END;
|
|
|