Random error: A duplicate object name has been found

vincentjvincentj Posts: 47
edited April 1, 2013 5:28AM in SQL Compare Previous Versions
We have a script that runs a comparison report between SVN and our production databases to make sure they stay in sync. However, it fails over 40% of the time with this error:
A duplicate object name has been found. This may occur if the SQL Server that you are registering is case sensitive but the case sensitive option is not set.

We am not using any case sensitive options or collations. In fact, usually I can just re-run the report and it works the second time. It would be great if it at least told me what object was causing the comparison to fail, but I have no idea what causes this.

I reported a similar issue about a year ago but never found a solution, though I don't know for sure if these are related.

Any ideas?

Comments

  • James BJames B Posts: 1,124 Silver 4
    Thanks for your post.

    I'm afraid I can't think of any obvious reason why this message would happen and then not happen when you run the script again immediately afterwards.

    You mentioned you're comparing to SVN - can you tell me a little more about how your script does this?

    Asides from case sensitivity problems (which, if your DB isn't case sensitive, should be irrelevant) there are other possible causes such as two files in your scripts that contain a definition for the same object.

    The other thing to try is to add the /logLevel:<logLevel> switch to your commandline script, and set it to "v" - this should create a more verbose log file that may contain further clues.

    The logfile will be located in the usual location (c:\users\<username>\appdata\local\red gate\logs\sql compare 10)
    Systems Software Engineer

    Redgate Software

  • Our script checks out the branch from Subversion and then runs a command line comparison to generate the report. The command line looks something like this (with NAnt variable placeholders):
    "D:\Red Gate\SQL Compare 10\SQLCompare.exe" /f /loglevel:Verbose /scr1:d:\build\Database\trunk\Standard /server2:$&#123;sqlcompare.server2&#125; /database2:$&#123;sqlcompare.database2&#125; /username2:$&#123;sqlcompare.username2&#125; /password2:$&#123;sqlcompare.password2&#125; /options:Default,IgnoreIdentitySeedAndIncrement,IgnoreStatistics /reporttype:Interactive /report:$&#123;report.filename&#125;
    

    Thanks for the tip about the log file. The report ran fine the past few days but we had another failure this morning. The log file doesn't seem to contain any information to help me identify which object is viewed as a duplicate. I looked at the extensive list of files that were processed and there are no duplicates there. Here is a snippet from the log file, maybe it's useful to somone at Redgate?
    10:16:21.194|Verbose|Command Line        |1  |Argument /force has value 'True'
    10:16:21.194|Verbose|Command Line        |1  |Argument /logLevel has value 'Verbose'
    10:16:21.194|Verbose|Command Line        |1  |Argument /filter has value 'D:\build\Database\filters\comparefilter.scpf'
    10:16:21.194|Verbose|Command Line        |1  |Argument /scripts1 has value 'D:\build\Database\DBReport\Standard'
    10:16:21.194|Verbose|Command Line        |1  |Argument /server2 has value 'server3'
    10:16:21.194|Verbose|Command Line        |1  |Argument /database2 has value 'prod3
    10:16:21.194|Verbose|Command Line        |1  |Argument /username2 has value 'user'
    10:16:21.194|Verbose|Command Line        |1  |Argument /password2 has value 'pw'
    10:16:21.194|Verbose|Command Line        |1  |Argument /options has value 'Default;IgnoreIdentitySeedAndIncrement;IgnoreStatistics'
    10:16:21.194|Verbose|Command Line        |1  |Argument /reporttype has value 'Interactive'
    10:16:21.194|Verbose|Command Line        |1  |Argument /report has value 'D:\ReportArchive\reports_2013-03-29_10-07\trunk-server3.prod3.html'
    10:16:21.194|Verbose|Command Line        |1  |
    10:16:21.397|Verbose|Command Line        |1  |SQL Compare running with option: Default &#40;OK&#41;.
    10:16:21.397|Verbose|Command Line        |1  |SQL Compare running with option: IgnoreIdentitySeedAndIncrement &#40;OK&#41;.
    10:16:21.397|Verbose|Command Line        |1  |SQL Compare running with option: IgnoreStatistics &#40;OK&#41;.
    10:16:21.444|Verbose|Command Line        |1  |Comparing database Scripts.Standard with database server3.prod3...
    10:16:24.085|Trace  |Source Control Link |5  |SQL Source control link successfully created
    10:16:24.085|Info   |SQL Compare Engine  |5  |Register folder start: D:\build\Database\DBReport\Standard
    10:16:24.100|Info   |SQL Compare Engine  |5  |Script folder database version: SqlServer2008
    10:16:24.100|Info   |SQL Compare Engine  |5  |Script folder database collation: SQL_Latin1_General_CP1_CI_AS
    10:16:24.194|Info   |SQL Compare Engine  |5  |Populate Folder Start.
    &#91;...processing files...&#93;
    10:16:40.774|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing.
    10:16:40.883|Warn   |SQL Compare Engine  |5  |DBScriptResolver Warning db or server set, not resolving: server1.prod1.dbo.subscriber_to_event
    10:16:41.227|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing triggers.
    10:16:41.227|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing functions.
    10:16:41.227|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing stored procs.
    10:16:41.227|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing #8rg.#Bsg triggers.
    10:16:41.227|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing #8rg.#2zg triggers.
    10:16:41.227|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing ddl triggers.
    10:16:41.227|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing permissions.
    10:16:41.243|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing bindings.
    10:16:41.243|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing udt fields and params.
    10:16:42.055|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing partition schemes.
    10:16:42.055|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing tables.
    10:16:42.071|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing indexes.
    10:16:42.134|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing fulltext columns.
    10:16:42.149|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing udt scale and precision.
    10:16:42.149|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing assembly dependancies.
    10:16:42.165|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing foreign keys.
    10:16:42.165|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing foreign key fields.
    10:16:42.165|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing trigger order.
    10:16:42.165|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing ddl trigger patchup.
    10:16:42.165|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing role membership.
    10:16:42.180|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing synonym dependancies.
    10:16:42.180|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing dependency stacks.
    10:16:42.274|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing messagetypes.
    10:16:42.274|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing contracts.
    10:16:42.274|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing queue event notifications.
    10:16:42.274|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing queues.
    10:16:42.274|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing services.
    10:16:42.274|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing extended properties.
    10:16:42.305|Info   |SQL Compare Engine  |5  |Populate Folder postprocessing sanitize dependencies.
    10:16:42.337|Info   |SQL Compare Engine  |5  |Register folder finished: D:\build\Database\DBReport\Standard
    10:16:42.462|Trace  |Source Control Link |5  |SQL Source control link successfully created
    10:16:42.462|Info   |SQL Compare Engine  |5  |Register live database start: prod3
    10:16:42.477|Info   |SQL Compare Engine  |5  |Populate Live Start, popoptions: DatabaseCollation, DecryptPost2kEncryptedObjects
    10:16:42.493|Info   |SQL Compare Engine  |5  |Populate Live Start, options: Default, IgnoreIdentitySeedAndIncrement, IgnoreStatistics
    10:16:42.634|Info   |SQL Compare Engine  |5  |Populate major version: SqlServer2005
    10:16:42.649|Info   |SQL Compare Engine  |5  |Populate got casing: False
    10:16:42.649|Info   |SQL Compare Engine  |5  |Populate Case Sensitive: False
    10:16:44.165|Info   |SQL Compare Engine  |5  |Populate FulltextCatalogs start.
    10:16:44.181|Info   |SQL Compare Engine  |5  |Populate Fulltext Stoplists start.
    10:16:44.181|Info   |SQL Compare Engine  |5  |Populate Fulltext Stopwords start.
    10:16:44.196|Info   |SQL Compare Engine  |5  |Populate ObjectNames start.
    10:16:50.181|Error  |SQL Compare Engine  |5  |SqlCompareException: A duplicate object name has been found. This may occur if the SQL Server that you are registering is case sensitive but the case sensitive option is not set.
    System.ArgumentException: An item with the same key has already been added.
       at System.ThrowHelper.ThrowArgumentException&#40;ExceptionResource resource&#41;
       at System.Collections.Generic.Dictionary`2.Insert&#40;TKey key, TValue value, Boolean add&#41;
       at #8rg.#Ssg.#Glh&#40;&#41;
       at #8rg.#Ssg.#vl&#40;DBPopulationOptions #WXrc&#41;
    10:16:50.275|Fatal  |Command Line        |1  |A duplicate object name has been found. This may occur if the SQL Server that you are registering is case sensitive but the case sensitive option is not set.
    RedGate.Shared.Utils.CommandLine.FatalExecutionException: A duplicate object name has been found. This may occur if the SQL Server that you are registering is case sensitive but the case sensitive option is not set. ---&gt; RedGate.SQLCompare.Engine.SqlCompareException: A duplicate object name has been found. This may occur if the SQL Server that you are registering is case sensitive but the case sensitive option is not set. ---&gt; System.ArgumentException: An item with the same key has already been added.
       at System.ThrowHelper.ThrowArgumentException&#40;ExceptionResource resource&#41;
       at System.Collections.Generic.Dictionary`2.Insert&#40;TKey key, TValue value, Boolean add&#41;
       at #8rg.#Ssg.#Glh&#40;&#41;
       at #8rg.#Ssg.#vl&#40;DBPopulationOptions #WXrc&#41;
       --- End of inner exception stack trace ---
       at #8rg.#Ssg.#vl&#40;DBPopulationOptions #WXrc&#41;
       at RedGate.SQLCompare.Engine.Database.#crc&#40;ConnectionProperties #Ap8b, #en #5OPb&#41;
       at RedGate.SQLCompare.Common.CompareEngineExecutor.#DaH&#40;Database #RHc, LiveDatabaseSource #ovUb&#41;
       at RedGate.SQLCompare.Common.CompareEngineExecutor.#DaH&#40;Database #RHc, DataSource #ovUb&#41;
       at RedGate.SQLCompare.Common.CompareEngineExecutor.#8bH&#40;&#41;
       at #dRb.#8Rb.#kco&#40;&#41;
       at #dRb.#eRb.#Pao&#40;&#41;
       --- End of inner exception stack trace ---
       at #namb.#tamb.#q1r&#40;ExitCodes #M6rc, Exception #9Z&#41;
       at RedGate.SQLToolsCommandLine.CommandProcessor.#Acmb&#40;Exception #9Z&#41;
       at RedGate.SQLToolsCommandLine.CommandProcessor.#Acmb&#40;&#41;
       at RedGate.SQLToolsCommandLine.CommandProcessor.#ZjD&#40;&#41;
       at RedGate.SQLToolsCommandLine.CommandProcessor.#kcmb&#40;&#41;
       at RedGate.SQLCompare.CommandLine.CommandProcessor.#kcmb&#40;&#41;
       at RedGate.SQLToolsCommandLine.CommandProcessor.#OUb&#40;&#41;
    
    
  • James BJames B Posts: 1,124 Silver 4
    Thanks for posting back- you're right, the error isn't telling us the object unfortunately.

    When it happens again, can you immediately run the GUI and see if it reports the same problem? If it does (hopefully!) then you should see a link on the error message saying something like "Serious Error? Send an error report". If you do this (adding your email address where prompted) we should be able to then find it in our bug-tracker and it should give more 'under-the-hood' information including object names.
    Systems Software Engineer

    Redgate Software

Sign In or Register to comment.