Random error: A duplicate object name has been found

Compares and synchronizes SQL Server databases, backups and scripts.

Moderators: JonathanWatts, Chris Auckland, David Atkinson, eddie davis, Anu Deshpande, Michelle Taylor, alice.easey, james.billings, chengvoon.tong

Random error: A duplicate object name has been found

Postby vincentj » Fri Mar 22, 2013 8:38 pm

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?
vincentj
 
Posts: 36
Joined: Thu Feb 17, 2011 10:20 pm

Postby james.billings » Mon Mar 25, 2013 8:36 pm

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)
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.

Postby vincentj » Fri Mar 29, 2013 4:33 pm

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):

Code: Select all
\"D:\\Red Gate\\SQL Compare 10\\SQLCompare.exe\" /f /loglevel:Verbose /scr1:d:\\build\\Database\\trunk\\Standard /server2:${sqlcompare.server2} /database2:${sqlcompare.database2} /username2:${sqlcompare.username2} /password2:${sqlcompare.password2} /options:Default,IgnoreIdentitySeedAndIncrement,IgnoreStatistics /reporttype:Interactive /report:${report.filename}


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?

Code: Select all
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 (OK).
10:16:21.397|Verbose|Command Line        |1  |SQL Compare running with option: IgnoreIdentitySeedAndIncrement (OK).
10:16:21.397|Verbose|Command Line        |1  |SQL Compare running with option: IgnoreStatistics (OK).
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.
[...processing files...]
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(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at #8rg.#Ssg.#Glh()
   at #8rg.#Ssg.#vl(DBPopulationOptions #WXrc)
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. ---> 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. ---> System.ArgumentException: An item with the same key has already been added.
   at System.ThrowHelper.ThrowArgumentException(ExceptionResource resource)
   at System.Collections.Generic.Dictionary`2.Insert(TKey key, TValue value, Boolean add)
   at #8rg.#Ssg.#Glh()
   at #8rg.#Ssg.#vl(DBPopulationOptions #WXrc)
   --- End of inner exception stack trace ---
   at #8rg.#Ssg.#vl(DBPopulationOptions #WXrc)
   at RedGate.SQLCompare.Engine.Database.#crc(ConnectionProperties #Ap8b, #en #5OPb)
   at RedGate.SQLCompare.Common.CompareEngineExecutor.#DaH(Database #RHc, LiveDatabaseSource #ovUb)
   at RedGate.SQLCompare.Common.CompareEngineExecutor.#DaH(Database #RHc, DataSource #ovUb)
   at RedGate.SQLCompare.Common.CompareEngineExecutor.#8bH()
   at #dRb.#8Rb.#kco()
   at #dRb.#eRb.#Pao()
   --- End of inner exception stack trace ---
   at #namb.#tamb.#q1r(ExitCodes #M6rc, Exception #9Z)
   at RedGate.SQLToolsCommandLine.CommandProcessor.#Acmb(Exception #9Z)
   at RedGate.SQLToolsCommandLine.CommandProcessor.#Acmb()
   at RedGate.SQLToolsCommandLine.CommandProcessor.#ZjD()
   at RedGate.SQLToolsCommandLine.CommandProcessor.#kcmb()
   at RedGate.SQLCompare.CommandLine.CommandProcessor.#kcmb()
   at RedGate.SQLToolsCommandLine.CommandProcessor.#OUb()

vincentj
 
Posts: 36
Joined: Thu Feb 17, 2011 10:20 pm

Postby james.billings » Mon Apr 01, 2013 10:28 am

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.
james.billings
 
Posts: 1144
Joined: Wed Jun 16, 2010 11:10 am
Location: My desk.


Return to SQL Compare 10

Who is online

Users browsing this forum: grinnell and 1 guest