VSDBCMD for Two Database Diff?
Doing a Google/Bing search for "vsdbcmd two databases diff" is not 开发者_如何学Pythonshowing me anything clear. I just have two databases live on the same server and I want to diff them and then apply schemata differences from A->B. Just like I could do in the VS2010 GUI.
Can anyone point me in the right direction for this?
Thanks.
Got this through trial and error. Hope it helps the next person.
VSDBCMD /a:Import /cs:"Server=myserver;Integrated Security=true;Pooling=false;Initial Catalog=mydb" /dsp:Sql /model:sourcedb.dbschema
VSDBCMD /a:Import /cs:"Server=myserver;Integrated Security=true;Pooling=false;Initial Catalog=mydestdb" /dsp:Sql /model:mydestdb.dbschema
vsdbcmd /action:deploy /dd:- /dsp:Sql /modelfile:sourcedb.dbschema /targetmodelfile:mydestdb.dbschema /p:TargetDatabase="mydestdb" /Quiet:- /DeploymentScriptFile:diff.sql
I got an incorrect error message about not being able to determine the schema based on the connection string. It turns out the problem was missing "DatabaseSchemaProviders.Extensions.xml" file, I was trying to make a standalone VSDBCMD distro and did not have that file handy.
精彩评论