Exception when linking to an existing database

Early Access Program for SQL Source Control

Moderators: Chris Auckland, David Atkinson, sherr

Exception when linking to an existing database

Postby jimithing1980 » Tue Mar 09, 2010 6:12 pm

We have created a database in source control that was linked to our live database. I have since unlinked it from the live DB and tried to link our Dev DB to an Existing database in Source control which is the location I loaded our live DB to. When I do so, I receive the following exception:

Code: Select all
Failed to update:
#oEc.#8Jf: Failed to locate the target table [dbo].[tblJobs] for the FK_tblDataCurrency_tblLoanDepartmentIndex foreign key. ---> RedGate.SQLCompare.Engine.SqlCompareException: Failed to locate the target table [dbo].[tblJobs] for the FK_tblDataCurrency_tblLoanDepartmentIndex foreign key. ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1893, offset:358 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1936, offset:33 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 3952, offset:2117 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 602, offset:614 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1723, offset:37 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 250, offset:38 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1659, offset:0 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 249, offset:30 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 252, offset:38 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 823, offset:61 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 807, offset:89 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 821, offset:14 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1821, offset:31 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1647, offset:63 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 186, offset:468 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1818, offset:1011 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1663, offset:18 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 250, offset:38 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 254, offset:38 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1502, offset:224 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1815, offset:63 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1501, offset:99 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1500, offset:60 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1052, offset:31 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1049, offset:0 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1737, offset:0 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1649, offset:117 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 169, offset:11 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 216, offset:137 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 522, offset:26 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1883, offset:31 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1138, offset:500 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1142, offset:109 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1144, offset:22 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1147, offset:13
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   --- End of inner exception stack trace ---
   at #oEc.#7Jf.#t.#B3.#sKf()
   at #oEc.#7Jf.#gKf(Action action)
   --- End of inner exception stack trace ---

Server stack trace:
   at RedGate.SQLSourceControl.Engine.Cancellables.CancellableOperation.#t.#izb.#j5f()
   at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
   at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
   at RedGate.SQLSourceControl.CommonUI.Forms.ErrorDialog.DoWithObviousExceptionsThrowAll(Action action)
   at #JLc.#PLc.#CTc(ICancellableOperation`1 operation, Object token)



It's looking like it can't find dbo.tblJobs which does exist in our database. The Foreign Key referred to is here:

Code: Select all
ALTER TABLE [dbo].[tblDataCurrency]  WITH CHECK ADD  CONSTRAINT [FK_tblDataCurrency_tblLoanDepartmentIndex] FOREIGN KEY([JobID])
REFERENCES [dbo].[tblJobs] ([ID])
GO

ALTER TABLE [dbo].[tblDataCurrency] CHECK CONSTRAINT [FK_tblDataCurrency_tblLoanDepartmentIndex]
GO


the tblDataCurrency table does have a column called JobID and tblJobs does have a column called ID (the primary key of this table). The check contraint/foreign key actually work fine upon testing.
jimithing1980
 
Posts: 8
Joined: Mon Mar 08, 2010 11:26 pm

Postby jimithing1980 » Tue Mar 09, 2010 6:15 pm

I do see the dbo.tblJobs.sql file does not exist in "C:\\Documents and Settings\\XXXUSERXXX\\Local Settings\\Application Data\\Red Gate\\SQL Source Control 0\\WorkingBases\\XXXDBGUIDXXX" - I'm going to try a few things to see if I can get a workaround.
jimithing1980
 
Posts: 8
Joined: Mon Mar 08, 2010 11:26 pm

Postby jimithing1980 » Tue Mar 09, 2010 6:22 pm

Tried removing the Temp folder, unlinking and relinking with no luck. The only thing that I could do to fix it was delete everything in Source Control and reload it. In this case, that was fine - obviously not good in the long run. :D
jimithing1980
 
Posts: 8
Joined: Mon Mar 08, 2010 11:26 pm

Exception when linking to an existing database

Postby sherr » Tue Mar 09, 2010 7:08 pm

This is definitely not good in the long run, but I'm glad you're able to use SQL Source Control against your development db for now. We don't recommend using SQL Source Control with your live/production database because SQL Source Control is more for your day to day db development and committing these changes to source control so there is a history of every change along with who made the change, when, and why. When it comes time to push your changes to your other environments (test, QA, staging, production), then you can use SQL Compare Pro to generate the synchronization script to bring your target database up to date. There is a 14 day free trial of SQL Compare on our web site at http://www.red-gate.com/products/SQL_Compare.

There are some known issues of linking a database to source control if it doesn't match exactly. Do you know how your development db differed from your live/production db? Did one of the tables in the FK relationship match live/production exaclty and the other one have a slight change?

Our internal reference number for this issue is SOC-803.
Last edited by sherr on Wed Mar 10, 2010 12:27 am, edited 1 time in total.
sherr
 
Posts: 126
Joined: Thu Mar 19, 2009 12:45 pm
Location: Cambridge

Postby jimithing1980 » Tue Mar 09, 2010 7:52 pm

No, the two databases are exact replicas. We just pushed a live release on Friday evening and have made no changes in our development database with the exception of one stored procedure so far.

The linking to live was a mistake - it was not done on purpose. I realize it's not a good idea to keep source control on a production DB :)
jimithing1980
 
Posts: 8
Joined: Mon Mar 08, 2010 11:26 pm

Postby jimithing1980 » Tue Mar 09, 2010 7:52 pm

And we already have SQL Compare Pro. Wonderful product and we use it regularly.
jimithing1980
 
Posts: 8
Joined: Mon Mar 08, 2010 11:26 pm

Postby jfennell » Thu Apr 01, 2010 2:24 am

I seem to be having the same problem. I know my development database does not exactly match the database that was used to create the repository, which I understand may cause some issues.

Is there any information I can provide that might help resolve this problem in the future? Perhaps the full stack trace and a SQL Compare script showing the differences between the databases?

Please let me know if any information will help.

Thanks,
~ Jim Fennell
jfennell
 
Posts: 32
Joined: Thu Apr 01, 2010 2:19 am

Issues linking a db that doesn't match the repo

Postby sherr » Thu Apr 01, 2010 7:29 pm

Hello Jim,

Any information you could provide would be extremely valuable especially the SQL Compare script showing the differences between the databases.

Would it also be possible to send the scripts for the actual objects that are different if there are not too many? It would be helpful if you could include the db version and the source control version. Or would sending snapshots of your database and the source control version be possible? (You can create snapshots using SQL Compare, select DB as source and Snapshot as target, then create a new snapshot. Link a new empty db to the same source control and get latest. Then snapshot this db as the source control version.)

Please send this information to SqlSourceControlSupport@red-gate.com. If you zip up the information, please rename the zip as .zip.txt so that it passes our security check.

Thank you!
Stephanie Herr :-)
sherr
 
Posts: 126
Joined: Thu Mar 19, 2009 12:45 pm
Location: Cambridge

Postby Jason54 » Fri Apr 09, 2010 6:10 am

I'm also having the same problem.

I don't know if it has anything to do with it, but I am trying to get latest to a database that is hosted in SQL Server 2005, but most of the changes were committed from a SQL Server Express 2008 DB.

My exception:

Failed to update:
#oEc.#8Jf: Failed to locate the target table [dbo].[TourType] for the FK_TOURS_TourType foreign key. ---> RedGate.SQLCompare.Engine.SqlCompareException: Failed to locate the target table [dbo].[TourType] for the FK_TOURS_TourType foreign key. ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1893, offset:358 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1936, offset:33 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 3952, offset:2117 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 602, offset:614 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1760, offset:37 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 247, offset:38 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1701, offset:0 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 246, offset:30 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 249, offset:38 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 826, offset:61 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 812, offset:89 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 824, offset:14 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1864, offset:31 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1689, offset:63 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 186, offset:468 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1861, offset:1011 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1705, offset:18 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 247, offset:38 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 251, offset:38 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1543, offset:224 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1858, offset:63 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1542, offset:99 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1541, offset:60 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1080, offset:31 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1078, offset:0 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1778, offset:0 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1691, offset:117 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 169, offset:11 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 216, offset:137 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 522, offset:26 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1933, offset:18 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1727, offset:32 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1728, offset:36 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1885, offset:43 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1167, offset:500 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1171, offset:109 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1173, offset:22 ---> SmartAssembly.SmartExceptionsCore.UnhandledException: SmartExceptionsCore.UnhandledException @ 1147, offset:13
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
--- End of inner exception stack trace ---
at #oEc.#7Jf.#t.#B3.#sKf()
at #oEc.#7Jf.#gKf(Action action)
--- End of inner exception stack trace ---

Server stack trace:
at RedGate.SQLSourceControl.Engine.Cancellables.CancellableOperation.#t.#izb.#j5f()
at System.Runtime.Remoting.Messaging.StackBuilderSink._PrivateProcessMessage(IntPtr md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.PrivateProcessMessage(RuntimeMethodHandle md, Object[] args, Object server, Int32 methodPtr, Boolean fExecuteInContext, Object[]& outArgs)
at System.Runtime.Remoting.Messaging.StackBuilderSink.AsyncProcessMessage(IMessage msg, IMessageSink replySink)

Exception rethrown at [0]:
at RedGate.SQLSourceControl.CommonUI.Forms.ErrorDialog.DoWithObviousExceptionsThrowAll(Action action)
at #JLc.#PLc.#CTc(ICancellableOperation`1 operation, Object token)
Jason54
 
Posts: 2
Joined: Thu Feb 18, 2010 5:49 am

Issues linking a db that doesn't match the repo

Postby sherr » Fri Apr 09, 2010 11:39 am

Hi Jason54,

Thanks for reporting this issue.

The "Failed to locate the target table" is a known issue. We think it's because there are slight changes between the db and the repo and we're not sure which version you are at. The best thing to do for now is to create a new db and link that and then pull the latest from source control into that new db, if that is possible. I realize this means your new db won't have the data from your existing db...

We are working on fixing this FK Issue though. Our internal reference number is SOC-803.

There are some known issues if you have different db versions that are attached to the same repo. Things like using a SQL 2008 datatype and committing to a repo which a SQL 2005 db pulls from would fail. I don't think this is the issue in this case, but I just wanted to make sure you were aware of this. Also, we do not official support Express Editions. We don't load in SS 2005 Express at all.

Thank you!
Stephanie M. Herr :-)
sherr
 
Posts: 126
Joined: Thu Mar 19, 2009 12:45 pm
Location: Cambridge


Return to SQL Source Control EAP

Who is online

Users browsing this forum: No registered users and 0 guests

cron