0

我们有一个用于包装自动化的 NANT 脚本。如果有任何结构和数据更改,我们还会使用 SQLCompare 命令行工具比较以前的 DB 和当前 DB。

即使我比较相同的数据库,我也无法获得退出代码“63”,这意味着“两个数据库相同”。我总是得到退出代码“0”。如何控制数据库是否相同?

SQLCompare 的 NANT 脚本:

*<property name="remcom.machine" value="server"/>
    <property name="remcom.user" value="${server.user.administrator}"/>
    <property name="remcom.pwd" value="${server.password.administrator}"/>
    <property name="remcom.workdir" value="${sqlcompare.dir}"/>
    <property name="remcom.command" 
              value="&quot;${sqlcompare.file} /s1:${compare.db.instance}        /u1:${compare.db.user} /p1:${compare.db.pwd} /db1:${db.current} /s2:${compare.db.instance} /u2:${compare.db.user} /p2:${compare.db.pwd} /db2:${db.previous} /f /q /sf:e:\redgateReports\${script.file} /r:e:\redgateReports\${report.file} /rt:Interactive /options:IgnoreWhiteSpace,IgnoreFillFactor,IgnoreFileGroups,IgnoreUserProperties,IgnoreWithElementOrder,ForceColumnOrder,IgnorePermissions,NoSQLPlumbing&quot;"/>
    <call target="RemoteCommand"/>
    <property name="sqlcompare.exitCode" value="${remcom.result}"/>*

这是我控制退出代码的代码:

<property name="compare.failed" value="${sqlcompare.exitCode != '63'}"/>
    <if test="${property::exists('failIfDifferent') and failIfDifferent == 'true'}">
      <fail if="${compare.failed}" message="Exit code is NOT 63.  DB stuctures [  ${db.current} and ${db.previous} ] are NOT identical. see report files in server: ${report.file} " />
    </if>
4

1 回答 1

0

感谢您的回复。我在本地机器上测试了我的 sqlcompare 命令。它没有给我“63”代码。然后我用 sqlcompare 创建了一个比较项目,并在我的命令行选项列表中使用了相同的选项然后它工作正常,现在我将在我们的 NANT 脚本和服务器中对其进行测试。

此致。

阿里布鲁特

于 2011-10-14T10:20:46.410 回答