SQLCompare Not Synchronizing Databases
37stars
Posts: 10
I am setting up one of our applications for continuous integration via Team Foundation Server. I am working locally with two databases. The source database (TFSTestSource) has a single table named User. The target database (TFSTest) has no tables. I am trying to create the User table in the target database. Below is the batch file I am using to test and I have added commands to delete the report files.
cd "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"
tf get "D:\Development\Spikes\TFS Test Project\Database" /version:T /recursive
cd "C:\Program Files (x86)\Red Gate\SQL Compare 8"
del "C:\Temp\SchemaDiffReport.html"
del "C:\Temp\SchemaSyncScript.sql"
del /Q /F "C:\Temp\SchemaDiffReport_images\*.*"
rd "C:\Temp\SchemaDiffReport_images"
sqlcompare /scr1:"D:\Development\Spikes\TFS Test Project\Database" /s2:MYDESKTOP\SQL2008 /UserName2:sa /p2:password /db2:TFSTest /o:Default /Report:"C:\Temp\SchemaDiffReport.html" /ReportType:Interactive /ScriptFile:"C:\Temp\SchemaSyncScript.sql" /sync /force /include:Table
When I run the batch file above I get this output from SQLCompare:
Registering data sources
Creating mappings
Comparing
Applying Command Line Items
Error: The selected objects are identical or no objects have been selected in the comparison.
But there is no User table in the TFSTest database.
I have checked the SQL in the Table subfolder in my Database folder and there is a file present that contains a script to create the User table. Is there something more I can check to see why the table is not getting created in the target database?
Your documents have been very helpful in setting up this process. I have run into a couple of issues with the example batch file listed in the continuous integration PDF. These are the changes/issues I found while working the example batch file provided.
Thanks
cd "C:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE"
tf get "D:\Development\Spikes\TFS Test Project\Database" /version:T /recursive
cd "C:\Program Files (x86)\Red Gate\SQL Compare 8"
del "C:\Temp\SchemaDiffReport.html"
del "C:\Temp\SchemaSyncScript.sql"
del /Q /F "C:\Temp\SchemaDiffReport_images\*.*"
rd "C:\Temp\SchemaDiffReport_images"
sqlcompare /scr1:"D:\Development\Spikes\TFS Test Project\Database" /s2:MYDESKTOP\SQL2008 /UserName2:sa /p2:password /db2:TFSTest /o:Default /Report:"C:\Temp\SchemaDiffReport.html" /ReportType:Interactive /ScriptFile:"C:\Temp\SchemaSyncScript.sql" /sync /force /include:Table
When I run the batch file above I get this output from SQLCompare:
Registering data sources
Creating mappings
Comparing
Applying Command Line Items
Error: The selected objects are identical or no objects have been selected in the comparison.
But there is no User table in the TFSTest database.
I have checked the SQL in the Table subfolder in my Database folder and there is a file present that contains a script to create the User table. Is there something more I can check to see why the table is not getting created in the target database?
Your documents have been very helpful in setting up this process. I have run into a couple of issues with the example batch file listed in the continuous integration PDF. These are the changes/issues I found while working the example batch file provided.
-
The "Red Gate" folder is created in "C:\Program Files (x86)" instead of "C:\Program Files"
The tf get command needs the /recursive switch
SQLCompare needs the switch /force to overwrite the report files, however this still fails because /force doesn't force the deletion of images in the SchemaDiffReport_images folder
SQLCompare needs the switch /include
I ran cross documentation on your web site that says synchronization flows from database 2 to database 1. I can't remember now where I saw that. But SQLCompare reports the direction is from 1 to 2.
Thanks
Comments
I've contacted you directly to go through a few things on this, so you should get an email through shortly.
Redgate Software