Xml configuration file allows you to specify all data compare options and settings. Even though some settings can be set via command line switches, we recommend you specify them in the xml file.

With the xml configuration file you can:

  • Specify SQL Server databases and login credentials;
  • Define the comparison options;
  • Customize data compare by excluding objects, defining custom keys and where clauses;
  • Specify mapping rules;
  • Specify the files for the synchronization script and logs;
  • Execute the data synchronization script.

The xml file groups the comparison options into the following sections:

SectionDescription

Database
        <LeftDatabase>
        <RightDatabase>

Contains the source and target database.
Data Compare Options
        <DataCompareOptions>
Contains the data compare options.
Table Mapping Rules
        <TableMappingRules>
Contains the rules that determine how database tables are mapped.
View Mapping Rules
        <ViewMappingRules>
Contains the rules that determine how database views are mapped.
Table Pairs
        <TablePairs>
Contains the pairs of tables that should be mapped manually or pairs that should be excluded.
View Pairs
        <ViewPairs>
Contains the pairs of views that should be mapped manually or pairs that should be excluded.
Command Line Settings
        <CommandLineOptions>
Contains additional data compare settings.

 A typical xml configuration file has the following structure:

<?xml version="1.0" encoding="utf-8" ?>
<SqlDataCompareCmdConfig xmlns="http://www.xsqlsoftware.com/schemas/xSQLDataCompareCmdSchema.xsd">
     <LeftDatabase>
<SqlServer>(local)</SqlServer>
<DatabaseName>DB_Test1</DatabaseName>
<TrustedConnection>true</TrustedConnection>
</LeftDatabase>
<RightDatabase>
<SqlServer>(local)</SqlServer>
<DatabaseName>DB_Test2</DatabaseName>
<Username>username</Username>
<Password>password</Password>
</RightDatabase>
<CommandLineOptions>
<Synchronize>true</Synchronize>
<DataScriptFile>script.sql</DataScriptFile>
<DataLogFile>script.log</DataLogFile>
<ComparisonLogFile>log.txt</ComparisonLogFile>
<ErrorLogName>error.log</ErrorLogName>
</CommandLineOptions>
</SqlDataCompareCmdConfig>

 

  • <LeftDatabase> and <RightDatabase> elements specify the source and the target database referred to as the left and the right database respectively.
  • No explicit data compare options are set. The command line will use the default options.
  • <CommandLineSettings> contains the following settings:
    • <Synchronize> true: Indicates that the command line should synchronize the target database by executing the data synchronization script. This setting forces command line to make permanent changes in the target database
    • <DataScriptFile>: Specifies a file name for data synchronization script.
    • <DataLogFile>: Specifies a file name for data synchronization log.
    • <ComparisonLogFile>: Specifies a file name for data compare operational log.
    • <ErrorLogName>: Specifies a file name for logging the errors that might occur during the comparison.

You can run the command line with a xml configuration file as follows:

IderaDataCmd <config.xml>

You can validate an xml file as follows:

IderaDataCmd <config.xml> /v

where: <config.xml> is the name of the xml file.

 

Total compare from data to schema with IDERA SQL Comparison Toolset. Learn more > >
  • No labels