An item with the same key has already been added

Hi

I have version 4.0.7.207 instaled

However error persists (An item with the same key has already been added) in objects type INDEX and TABLE, problem is that Schema Oracle Compare didn´t show us wich object has generates the reference problem, how i find out which object is causing the error above, the tool should show the filename, it´s possible developing in tool to show the filename after the message " An item with the same key has already been added " + filename ?

thanks
Tagged:

Answers

  • Eddie DEddie D Posts: 1,780 Rose Gold 5
    Hi,

    Thank you for your forum post.

    A colleague of yours, has already submitted a support ticket, ticket reference number is #105046.

    From the log file information he has kindly supplied, I see that you are comparing two script folders. From the testing I have performed on the schemas I exported to script folders, I am unable to replicate the reported problem.

    Therefore I have requested copies of the script folders he is using and waiting for his reply.

    Many Thanks
    Eddie

    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • aosalaaosala Posts: 3 New member
    edited January 9, 2018 12:09PM
    I'm having exactly the same problem. I'm comparing indexes in a database to a script folder, and every time I try to update the script folder, I get that same error saying an item with the same key already exists. This seems to happen with all the indexes involved in the comparison. It doesn't matter if the create script for the index already exists in the target folder or if it's a completely new index in the DB.

    I also sent an error report to you guys.

    PS. Version is the same 4.0.7.207
  • aosalaaosala Posts: 3 New member
    Don't know if this helps, but here is something I discovered:

    -- Version 4.0.7.207

    -- Index is shown as a new object in source (DB) compared to scripts folder
    -- => When I try to update this to script folder "Item with the same name" error occurs

    CREATE UNIQUE INDEX dw.pk_idx ON dw.tablename(id)
    NOCOMPRESS LOGGING TABLESPACE tablespacename;

    -- Same time the create table script looks like this in our scripts folder. This doesn't pop up when I compare DB to the scripts folder.

    CREATE TABLE dw.tablename (
    CONSTRAINT pk PRIMARY KEY (id) USING INDEX dw.pk_idx
    ) NOCOMPRESS
    LOGGING
    TABLESPACE tablespacename;


    -- Version 4.0.0.14
    -- The new index dw.pk_idx is not shown at all when comparing DB to our scripts folder (not as new or changed item)

    -- Index is added to the create table script, which is changed compared to the one in our scripts folder:
    CREATE TABLE dw.tablename (
    CONSTRAINT pk PRIMARY KEY (id) USING INDEX (CREATE UNIQUE INDEX dw.pk_idx ON dw.tablename(id) NOCOMPRESS LOGGING TABLESPACE tablespacename)
    ) NOCOMPRESS
    LOGGING
    TABLESPACE tablespacename;
  • mcharpenmcharpen Posts: 1 New member
    Hello All,

    I have exactly the same issue with an Create table DDL which create the FK toto
    and then the FK toto is created later again so I got an error that the FK constraint already exist.

    Let us know when the issue will be fixed.

    Cheers.
    Marc
  • Eddie DEddie D Posts: 1,780 Rose Gold 5
    Hi aosala
    Thank you for your update to this forum post.

    To investigate further I need further information from you.

    The 'An item with the same key has already been added' is very generic error message and from my experience has many different situations that can cause it to occur.

    However from your description of the problem, I believe it is related to the original post in this topic.

    Would please increase the minimum logging level to verbose as per this help article if using the GUI to perform your comparison and deployment:
    https://documentation.red-gate.com/sco4/troubleshooting/logging-and-log-files
    Repeat the comparison and deployment attempt to generate the verbose log file.

    Or if using the command line, add the /loglevel:verbose switch to the command line syntax. Run the command commands to reproduce the error and consequentially generate a log file.

    Email support@red-gate.com with a copy of the Source Control for Oracle verbose log file.

    You will find the log files in this folder:
    C:\Users\<user name>\AppData\Local\Red Gate\Logs\Schema Compare for Oracle.

    Once the email is received a support ticket will be created and I will follow up via the Redgate Support ticketing system.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Eddie DEddie D Posts: 1,780 Rose Gold 5
    Hi mcharpen
    Thank you for your update to this forum post.

    To investigate further I need further information from you.

    The 'An item with the same key has already been added' is very generic error message and from my experience has many different situations that can cause it to occur.

    However from your description of the problem, I believe it is unrelated to the original post in this topic.

    Would please increase the minimum logging level to verbose as per this help article if using the GUI to perform your comparison and deployment:
    https://documentation.red-gate.com/sco4/troubleshooting/logging-and-log-files
    Repeat the comparison and deployment attempt to generate the verbose log file.

    Or if using the command line, add the /loglevel:verbose switch to the command line syntax. Run the command commands to reproduce the error and consequentially generate a log file.

    Email support@red-gate.com with a copy of the Source Control for Oracle verbose log file.

    You will find the log files in this folder:
    C:\Users\<user name>\AppData\Local\Red Gate\Logs\Schema Compare for Oracle.

    Once the email is received a support ticket will be created and I will follow up via the Redgate Support ticketing system.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Eddie DEddie D Posts: 1,780 Rose Gold 5
    Hi RicardoKrot

    I have just updated the support ticket I have with your colleague, Support Ticket #105046, with details of a private build to download. Please let me know if it fixes this problem for you.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • Eddie DEddie D Posts: 1,780 Rose Gold 5
    Hi aosala and mcharpen,

    I have sent to you, individually, a private message from this forum.

    The message contains details of a private build of Schema Compare for Oracle to download. Please reply and let me know if it fixes the problem for you.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • aosalaaosala Posts: 3 New member
    Hi! I ran the update and did not face the same error anymore when running the same compares. Seems to have fixed the issue! Thanks!
  • Eddie DEddie D Posts: 1,780 Rose Gold 5
    Hi aosala
    Thank you for you reply and excellent news that the private build has resolved the error. This will be rolled up into the next official release of Schema Compare. Please continue to use the private build until the official release becomes available.

    Many Thanks
    Eddie
    Eddie Davis
    Senior Product Support Engineer
    Redgate Software Ltd
    Email: support@red-gate.com
  • CharliLJCharliLJ Posts: 1 New member
    Hi Eddie:  I have the very same issue, here, with SQL Compare for SQL Server, version 13.1.8.5525 Prof.  I have a large project with hundreds of objects to deploy to a script folder (thereby, to update a VS 2015 upd 3 solution of my client's database project. Having prepared the project from the source database system and comparing it using SQL Compare to the on-disk VS project for the same database, I now want to update the scripts folder for that VS project.  I get the "An item with the same key has already been added." error, which appears to me to be a very common .NET or Java related unique key violation on a list or collection.  This is certainly a bug in the SQL Compare code.

    Can you please provide a private build or a distributed hotfix for this?  Thanks.

    Charli
  • RichardLRichardL Posts: 417 Gold 4
    Hi @CharliLJ

    Thanks for your post. 

    Could you post this instead in the relevant forum for SQL Compare? 
    The link is below for you. 

    https://forum.red-gate.com/categories/sql-compare-12 

    Also, if you have a support contract you can send us a ticket so that a support engineer can look in to your issue for you. 

    Kind regards

    Richard Lynch. 
    Customer Support
    Redgate Software
Sign In or Register to comment.