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

Forum for users of SQL Compare schema synchronization utility

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

Postby avisho » Sun Jan 26, 2014 10:38 am

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?!
avisho
 
Posts: 6
Joined: Sun Jan 26, 2014 10:34 am

Postby Brian Donahue » Tue Jan 28, 2014 12:48 pm

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 all
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)
Brian Donahue
 
Posts: 6590
Joined: Mon Aug 23, 2004 10:48 am

Postby avisho » Tue Jan 28, 2014 12:57 pm

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
avisho
 
Posts: 6
Joined: Sun Jan 26, 2014 10:34 am

Postby Brian Donahue » Tue Jan 28, 2014 3:23 pm

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?
Brian Donahue
 
Posts: 6590
Joined: Mon Aug 23, 2004 10:48 am

Postby avisho » Wed Jan 29, 2014 8:12 am

Yes and yes.
below is the xml part:
Code: Select all
<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>
avisho
 
Posts: 6
Joined: Sun Jan 26, 2014 10:34 am

Postby james.billings » Fri Jan 31, 2014 2:44 pm

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
james.billings
 
Posts: 1120
Joined: Wed Jun 16, 2010 11:10 am
Location: Red Gate

Postby avisho » Sun Feb 02, 2014 1:08 pm

yes, it's the same user.

what's the difference between literally writing in command line and using xml files?
avisho
 
Posts: 6
Joined: Sun Jan 26, 2014 10:34 am

Postby james.billings » Mon Feb 10, 2014 12:46 pm

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.
james.billings
 
Posts: 1120
Joined: Wed Jun 16, 2010 11:10 am
Location: Red Gate

Postby avisho » Sun Feb 16, 2014 1:19 pm

I created the .xml file but the same error still happens...
avisho
 
Posts: 6
Joined: Sun Jan 26, 2014 10:34 am

Postby james.billings » Mon Feb 17, 2014 3:23 pm

I've replied directly to you to get some more information.
james.billings
 
Posts: 1120
Joined: Wed Jun 16, 2010 11:10 am
Location: Red Gate


Return to SQL Compare Previous Versions

Who is online

Users browsing this forum: No registered users and 1 guest