Problem with foreign and primary keys migration from SQL Server to Oracle
729362Oct 21 2009 — edited Oct 23 2009Hi folks, i'm using SQL Developer to migrate from a SQL Server database to Oracle and i'm stuck with a couple issues:
The worst of them so far is the fact that i can't migrate any of the PKs and FKs. After successfully capturing the SQL Server DB model and converting it to Oracle, when the tool generates the scripts, all ALTER TABLE queries that add the PKs and FKs have their target columns duplicated.
for example: when i'm trying to migrate a simple table that contains an Id (PK) and Name columns, the tool generates the following scripts:
PROMPT Creating Table TestTable...
CREATE TABLE TestTable (
Id NUMBER(10,0) NOT NULL,
Name VARCHAR2 NOT NULL
);
PROMPT Creating Primary Key Constraint PK_TestTable on table TestTable ...
ALTER TABLE TestTable
ADD CONSTRAINT PK_TestTable PRIMARY KEY
(
Id,
Id
)
ENABLE
As for the FKs, the tool duplicates the columns as well:
ALTER TABLE SomeTable
ADD CONSTRAINT FK_SomeTable_SomeTable2 FOREIGN KEY
(
SomeTable2Id,
SomeTable2Id
)
REFERENCES SomeTable2
(
Id,
Id
)
ENABLE
;
Does anyone have a clue on how to solve these issues? I'd be greatly thankful for any answers!