MdsMigrateFile

MdsMigrateFile is a command-line tool for migrating Btrieve files to SQL when no Data Definition Files (DDFs) are available. It runs a B_STAT command on the file to determine the file statistics and index structure, then issues a B_CREATE against the SQL backend to create the table.

Warning

MdsMigrateFile is intended as a last-resort proof-of-concept tool. It produces tables that work with the BTR2SQL drivers, but the resulting data is typically not usable in SQL by other applications or tools because fields that are not indexed are combined into FILLER fields. See Improving the Conversion below for better alternatives.

Command-line Syntax

Run MdsMigrateFile from a command prompt:

MdsMigrateFile.exe <BtrieveFileName> [configuration parameters]

The BtrieveFileName can include wildcards.

Configuration Parameters

All parameters are optional.

Parameter

Description

/owner <ownername>

Owner name associated with the Btrieve file. Multiple /owner parameters can be provided; MdsMigrateFile will cycle through them to find the correct one.

/server <server name>

Destination SQL server and optional port number.

/database <dbname>

Destination database.

/schema <schema>

Destination database schema.

/user <username>

User name for server login (empty for trusted connection).

/password <password>

Password for server login.

/dll <Mertech migration dll>

Path and filename of the Mertech migration DLL (sql_btr.dll, ora_btr.dll, or pgs_btr.dll). Defaults to sql_btr.dll if not provided. If the full path is not specified, the DLL is loaded from the system PATH.

/force-int-usage

Use field definitions from an existing INT file (rather than those returned by B_STAT) to create the SQL table. For example, if the file is Billing.MKD, the expected INT file is Billing_MKD.INT.

/numThreads <n>

Number of worker threads to use when copying data. By default, multiple threads are used to speed up migration. Pass /numThreads 1 to disable multithreading.

/validate-data

After the migration completes, read back the migrated data from the SQL backend and compare it to the original Btrieve file. Any mismatches are reported. Can be combined with a normal migration run.

/validate-data-only

Run data validation without performing any migration. Reads the data from the SQL backend and compares it to the original Btrieve file. Useful for verifying an existing migration after the fact.

/trace <trace filename>

Path and filename for trace output.

/level <trace level>

Level of tracing (0 through 6). Trace level 2 is usually sufficient for debugging.

Note

If the server, database, and/or login credentials are not provided, the mds.ini file, registry settings, or Login dialog box provide these details.

Note

During migration, INT files are created in the same location as the Btrieve file unless redirected by the INT-Folder setting in the mds.ini file.

Example

"C:\Program Files (x86)\Mertech Data Systems\DB Drivers\Btrieve\bin\MdsMigrateFile.exe" BILLING.MKD /server DEV-PC\SQLEXPRESS /database TestDB /trace mytrace /level 2

Comparison to the GUI Migration Utility

The table structure produced by MdsMigrateFile differs significantly from the structure produced by the GUI Migration Utility or MdsMigrateTable:

  • GUI Migration Utility / MdsMigrateTable — field names, field sizes, and data types match the information provided in the DDFs.

  • MdsMigrateFile — columns are strictly based on the index structure returned by B_STAT. Fields that are not indexed are combined into FILLER fields.

Below are two SQL table structures for the Pervasive Demodata file Billing.MKD:

GUI Migration Utility

../../_images/image412.png

MdsMigrateFile

../../_images/image422.png

Query results from the GUI Migration Utility version:

../../_images/image432.png

Query results from the MdsMigrateFile version:

../../_images/image442.png

Improving the Conversion

If you know the file structure, you can greatly improve the conversion by:

  • Creating DDFs and then using the GUI Migration Utility or MdsMigrateTable to migrate the file.

  • Copying an existing INT file for a similar file, renaming it to match your filename (e.g., Billing_MKD.INT), and then running MdsMigrateFile with the /force-int-usage flag:

    MdsMigrateFile.exe BILLING.MKD /server DEV-PC\SQLEXPRESS /database TestDB /force-int-usage /TrustedConnection /dll sql_btr.dll
    

Note

Contact Mertech Technical Support for assistance with this conversion process.

See Also

  • MdsMigrateTable — the recommended command-line migration tool (requires DDFs)