• Scroll to top of this topic Scroll to Top of Page

  • Print the current topic Print Topic

  • No expanding elements on this page Show/Hide Expanders

CLI scenario samples

Here are the command-line interface scenario samples.

Compare table and export to automatically generated file

<?xml version="1.0" encoding="utf-8"?>
<DatabaseCompareSuiteScenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Connection side="left" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <Connection side="right" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <Operation name="Schema Comparison" sourceScope="Tables TestDB.dbo" targetScope="Tables TestDB2.dbo">
                 <Export />
         </Operation>
</DatabaseCompareSuiteScenario>

Execute scripts on databases

<?xml version="1.0" encoding="utf-8"?>
<DatabaseCompareSuiteScenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Connection side="left" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <Connection side="right" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <ExecuteSql side="left">Update dbo.Country Set CountryCode = 1234 Where CountryName="BAHAMAS"</ExecuteSql>
         <ExecuteSql side="right" path="D:\Word\DB\AddNewProd.sql"/>
</DatabaseCompareSuiteScenario>

Multiple operations in a scenario

<?xml version="1.0" encoding="utf-8"?>
<DatabaseCompareSuiteScenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Connection side="left" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <Connection side="right" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <Operation name="Schema Comparison" sourceScope="Tables TestDB.dbo" targetScope="Tables TestDB2.dbo" />
         <Operation name="Schema Comparison" sourceScope="Views TestDB.dbo" targetScope="Views TestDB2.dbo" />
         <Operation name="Schema Comparison" sourceScope="TestIntegers.dbo" targetScope="TestNewTypes.dbo" />
</DatabaseCompareSuiteScenario>

In this scenario there are 3 kinds of objects compared:

  1. Tables of schema “dbo” in databases “TestDB” and “TestDB2”.

  2. Views of schema “dbo” in databases “TestDB” and “TestDB2”.

  3. Schemas “dbo” in databases “TestIntegers” and “TestNewTypes”.

Open an existing project in a scenario

<?xml version="1.0" encoding="utf-8"?>
<DatabaseCompareSuiteScenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Connection side="left" databaseDialect="Oracle" server="oracle11" port="1521" database="orcl" userID="user" password="pass" />
         <Connection side="right" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <OpenProject>C:\WorkFolder\MyProjectFile.dsuite</OpenProject>
         <Operation name="Schema Comparison" sourceScope="TEST_DB" targetScope="TestDB.dbo" />
</DatabaseCompareSuiteScenario>

Schema comparison between different database platforms

<?xml version="1.0" encoding="utf-8"?>
<DatabaseCompareSuiteScenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Connection side="left" databaseDialect="Oracle" server="oracle11" port="1521" database="orcl" userID="user" password="pass" />
         <Connection side="right" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <Operation name="Schema Comparison" sourceScope="TEST_DB" targetScope="TestDB.dbo" />
</DatabaseCompareSuiteScenario>

The Settings comparison operation

<?xml version="1.0" encoding="utf-8"?>
<DatabaseCompareSuiteScenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Connection side="left" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <Connection side="right" databaseDialect="MSSQL" server="mssqlserver2014" port="1433" authentication="Standard" userID="user" password="pass" />
         <Operation name="Settings Comparison" sourceScope="Server mssqlserver2012" targetScope="Server mssqlserver2014">
                 <Export/>
         </Operation>
</DatabaseCompareSuiteScenario>

The operation with matching rules

<?xml version="1.0" encoding="utf-8"?>
<DatabaseCompareSuiteScenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
         <Connection side="left" databaseDialect="Oracle" server="oracle11" port="1521" database="orcl" userID="user" password="pass" />
         <Connection side="right" databaseDialect="MSSQL" server="mssqlserver2012" port="1433" authentication="Standard" userID="user" password="pass" />
         <Operation name="Schema Comparison" sourceScope="DB_SOURCE.dbo" targetScope="DB_2000.dbo">
           <MatchingRules>
             <FilterRule side="source" metadataObjectType="Table" mode="exactName" action="exclude">lobtypesTable, floatTypesTable</FilterRule>
             <CategoryRule sourceCategoriesList="Table" targetCategoriesList="View"/>
             <NameConversionRule sourceObjectType="View" targetObjectType="Table" sourcePattern="view_%{name}" targetReplacement="${name}"/>
           </MatchingRules>
         </Operation>
</DatabaseCompareSuiteScenario>

The operation with type mapping

<?xml version="1.0" encoding="UTF-8"?>
<DatabaseCompareSuiteScenario xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
   <Connection side="both" databaseDialect="DB2" server="db2server" database="DB2TEST" userID="user" password="pass" ></Connection>
   <Operation name="Schema Comparison" sourceScope="Tables DB2TEST.DB_SOURCE" targetScope="Tables DB2TEST.DB_TARGET">
      <TypeMapping type="Default" > 
          <TypePair>
            <LeftType name="INTEGER"/>
            <RightType name="DECIMAL" precision="10" scale="0"/>
         </TypePair>
      </TypeMapping> 
      <Export   path="D:\out.xml" />
   </Operation>
</DatabaseCompareSuiteScenario>