Red Gate forums :: View topic - "... is not linked to sql source control" error on linked db
Return to www.red-gate.com RSS Feed Available

Search  | Usergroups |  Profile |  Messages |  Log in  Register 
Go to product documentation
SQL Compare 10
SQL Compare 10 forum

"... is not linked to sql source control" error on linked db

Search in SQL Compare 10 forum
Post new topic   Reply to topic
Jump to:  
Author Message
avisho



Joined: 26 Jan 2014
Posts: 5

PostPosted: Sun Jan 26, 2014 10:38 am    Post subject: "... is not linked to sql source control" error on linked db Reply with quote

Hi,
I'm trying to compare a db HEAD revision to other DB but unfortunately when trying to use SQL Compare command line I get the "... is not linked to sql source control" error.

Command line:
sqlcompare /server1:myserver /db1:my-linked-db /revision1:HEAD /server2:myserver /db2:my-other-linked-db

Error:
SQL Compare: activated, edition: professional, serial number: XXX-XXX-XXX-XXX
SQL Compare Command Line V10.4.8.87
========================================================================================================
Copyright c Red Gate Software Ltd 1999-2013

Unexpected error: The database myserver.my-linked-db is not linked to SQL Source Control
The database myserver.my-linked-db is not linked to SQL Source Control
RedGate.Shared.Utils.InvalidStateException
at RedGate.Shared.Utils.Aver.#j43(String #Wt6, Object[] #ead)
at RedGate.SQLToolsCommandLine.CommandProcessor.#dRzc(Int32 #HXi)
at RedGate.SQLToolsCommandLine.CommandProcessor.#pcmb(Project #zNSb, DataSourceNumber #o9rc)
at RedGate.SQLCompare.CommandLine.CommandProcessor.#pcmb(Project #zNSb, DataSourceNumber #o9rc)
at RedGate.SQLToolsCommandLine.CommandProcessor.#mcmb()
at RedGate.SQLCompare.CommandLine.CommandProcessor.#wOr()
at RedGate.SQLToolsCommandLine.CommandProcessor.#kcmb()
at RedGate.SQLCompare.CommandLine.CommandProcessor.#kcmb()
at RedGate.SQLToolsCommandLine.CommandProcessor.#OUb()
at #i9G.#OsPb.#6sc(String[] #ead)

What am I missing here?!
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6581

PostPosted: Tue Jan 28, 2014 12:48 pm    Post subject: Reply with quote

SQL Compare can automatically determine if a database is linked to source control via SQL Source ControlĀ®. If it has not been linked that way and you specify a revision number, you will get this message.

You can tell if the database has been linked using the extended properties below. They may not be there if you did not link the database using SQL Source Control or if you restored an earlier backup from before it was linked to source control.
Code:
SELECT value FROM fn_listextendedproperty('SQLSourceControl Database Revision', NULL,NULL,NULL,NULL,NULL,NULL)
SELECT value FROM fn_listextendedproperty('SQLSourceControl Scripts Location', NULL,NULL,NULL,NULL,NULL,NULL)
SELECT value FROM fn_listextendedproperty('SQLSourceControl Migration Scripts Location', NULL,NULL,NULL,NULL,NULL,NULL)
Back to top
View user's profile Send private message
avisho



Joined: 26 Jan 2014
Posts: 5

PostPosted: Tue Jan 28, 2014 12:57 pm    Post subject: Reply with quote

Hi Brain,
The database - IS - linked to source control and I use it daily (commit, get latest etc...).

I ran the query you gave me and below are the results:
Reader A: 39342

Reader B: <?xml version="1.0" encoding="utf-16" standalone="yes"?> <ISOCCompareLocation version="1" type="SvnLocation"> <RepositoryUrl>https://192.168.0.2:8010/svn/Dev/Projects/Server Projects/Database/trunk/Repository/MYDBNAME/</RepositoryUrl> </ISOCCompareLocation>

Reader C: <?xml version="1.0" encoding="utf-16" standalone="yes"?> <ISOCCompareLocation version="1" type="SvnLocation"> <RepositoryUrl>https://192.168.0.2:8010/svn/Dev/Projects/Server Projects/Database/trunk/MigrationScripts/MYDBNAME/</RepositoryUrl> </ISOCCompareLocation>

Please advise,
Avi
Back to top
View user's profile Send private message
Brian Donahue



Joined: 23 Aug 2004
Posts: 6581

PostPosted: Tue Jan 28, 2014 3:23 pm    Post subject: Reply with quote

Is SQL Source Control installed on the same computer, and has the database been linked from that computer so that there is a LinkedDatabases.xml file that mentions that database?
Back to top
View user's profile Send private message
avisho



Joined: 26 Jan 2014
Posts: 5

PostPosted: Wed Jan 29, 2014 8:12 am    Post subject: Reply with quote

Yes and yes.
below is the xml part:
Code:
<value version="7" type="LinkedDatabase">
  <DatabaseId version="2" type="DatabaseId">
    <ServerAndInstanceName>MY_SERVER\DEV</ServerAndInstanceName>
    <DatabaseName>MY_DB_NAME</DatabaseName>
  </DatabaseId>
  <ISrcCLocation version="1" type="SvnLocation">
    <RepositoryUrl>https://MY_SVN_SERVER_URL/svn/Dev/Projects/Server Projects/Database/trunk/Repository/MY_DB_NAME/</RepositoryUrl>
  </ISrcCLocation>
  <IWorkspaceId version="1" type="WorkspaceId">
    <RootPath>C:\Users\MY_USERNAME\AppData\Local\Red Gate\SQL Source Control 3\WorkingBases\ihltpb0r.0vn</RootPath>
  </IWorkspaceId>
  <LinkedMigrationsLocation version="2" type="LinkedMigrationsLocation">
    <ISrcCLocation version="1" type="SvnLocation">
      <RepositoryUrl>https://MY_SVN_SERVER_URL/svn/Dev/Projects/Server Projects/Database/trunk/MigrationScripts/MY_DB_NAME/</RepositoryUrl>
    </ISrcCLocation>
    <IWorkspaceId version="1" type="WorkspaceId">
      <RootPath>C:\Users\MY_USERNAME\AppData\Local\Red Gate\SQL Source Control 3\MigrationsFolderWorkingBases\hzucevn4.rvn</RootPath>
    </IWorkspaceId>
    <ITransientWorkspaceId version="1" type="WorkspaceId">
      <RootPath>C:\Users\MY_USERNAME\AppData\Local\Red Gate\SQL Source Control 3\Transients\nrtgunoo.hvj</RootPath>
    </ITransientWorkspaceId>
  </LinkedMigrationsLocation>
  <SharedModel>False</SharedModel>
  <ScriptTransientId version="1" type="WorkspaceId">
    <RootPath>C:\Users\MY_USERNAME\AppData\Local\Red Gate\SQL Source Control 3\Transients\hg2wmwnz.pte</RootPath>
  </ScriptTransientId>
</value>
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1116
Location: My desk.

PostPosted: Fri Jan 31, 2014 2:44 pm    Post subject: Reply with quote

Are you running the command-line under the same user account as SQL Source Control was used with? Because the LinkedDatabase.xml is in your user profile, running the commandline as a different account may result in this error as it's not able to find that file.


The other option would be to save the two extended property xml fragments out to two files (call them db.xml and mig.xml). Then add to your command-line the switches:

/sourcecontrol1 /scriptsfolderxml:<path to db.xml> /migrationsfolder:<path to mig.xml>

and remove the /server1 and /database1 switches
Back to top
View user's profile Send private message
avisho



Joined: 26 Jan 2014
Posts: 5

PostPosted: Sun Feb 02, 2014 1:08 pm    Post subject: Reply with quote

yes, it's the same user.

what's the difference between literally writing in command line and using xml files?
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1116
Location: My desk.

PostPosted: Mon Feb 10, 2014 12:46 pm    Post subject: Reply with quote

It'll just get processed internally by the engine a different way. The xml files are a slightly 'older' method, originally introduced in early version 10 releases of Compare.
Back to top
View user's profile Send private message
avisho



Joined: 26 Jan 2014
Posts: 5

PostPosted: Sun Feb 16, 2014 1:19 pm    Post subject: Reply with quote

I created the .xml file but the same error still happens...
Back to top
View user's profile Send private message
james.billings



Joined: 16 Jun 2010
Posts: 1116
Location: My desk.

PostPosted: Mon Feb 17, 2014 3:23 pm    Post subject: Reply with quote

I've replied directly to you to get some more information.
Back to top
View user's profile Send private message
Display posts from previous:   
Reply to topic All times are GMT + 1 Hour
Page 1 of 1

 
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group