This section describes how to migrate Teradata Perl files.
Run the runDSC.sh or runDSC.bat command and set --application-lang to perl to migrate Teradata BTEQ or SQL_LANG scripts in Perl files to Perl-compatible GaussDB(DWS). After migrating Perl files, you can verify the migration by comparing the output file with its input file using a comparison tool.
The Perl file migration process is as follows:
To migrate Perl files, execute DSC with --source-db Teradata and --application-lang Perl parameter values. DSC supports the migration of BTEQ and SQL_LANG scripts. You can specify the scripts to be migrated by setting db-bteq-tag-name or db-tdsql-tag-name.
Run the following commands to set the source database, input and output folder paths, log paths, and application language.
Linux:
./runDSC.sh --source-db|-S Teradata [--application-lang|-A Perl] [--input-folder|-I <input-script-path>] [--output-folder|-O <output-script-path>] [--conversion-type|-M <Bulk or BLogic>] [--log-folder|-L <log-path>]
Windows:
runDSC.bat --source-db|-S Teradata [--application-lang|-A Perl] [--input-folder|-I <input-script-path>] [--output-folder|-O <output-script-path>] [--conversion-type|-M <Bulk or BLogic>] [--log-folder|-L <log-path>]
./runDSC.sh --input-folder /opt/DSC/DSC/input/teradata_perl/ --output-folder /opt/DSC/DSC/output/ --source-db teradata --conversion-type Bulk --application-lang PERL
During the execution of DSC, the migration summary, including the progress and completion status, is displayed on the console.
********************** Schema Conversion Started ************************* DSC process start time : Mon Jan 20 17:24:49 IST 2020 Statement count progress 100% completed [FILE(1/1)] Schema Conversion Progress 100% completed ************************************************************************** Total number of files in input folder : 1 ************************************************************************** Log file path :....../DSC/DSC/log/dsc.log DSC process end time : Mon Jan 20 17:24:49 IST 2020 DSC total process time : 0 seconds ********************* Schema Conversion Completed ************************
For details about the parameters for Teradata Perl migration, see Teradata Perl Configuration.
For details about CLI parameters, see Database Schema Conversion.
Example:
1 2 3 4 | $V_SQL2 = "SELECT T1.userTypeInd FROM T07_EBM_CAMP T1 WHERE T1.Camp_List_Id = '$abc'"; $STH = $dbh->prepare($V_SQL2); $sth->execute(); @rows = $sth->fetchrow(); |
$V_SQL2 = "SELECT T1.userTypeInd FROM T07_EBM_CAMP T1 WHERE T1.Camp_List_Id = '$abc'"; $STH = $dbh->prepare($V_SQL2); use Time::HiRes qw/gettimeofday/; my $start = [Time::HiRes::gettimeofday()]; $sth->execute(); my $elapsed = Time::HiRes::tv_interval($start); $elapsed = $elapsed * 1000; printf("Time: %.3f ms\n", $elapsed); @rows = $sth->fetchrow();
To optimize the migration, you are advised to follow the standard practices:
print BTEQ <<ENDOFINPUT; TRUNCATE TABLE employee; ENDOFINPUT close(BTEQ);
1 2 3 | my $sSQL=<<SQL_LANG; TRUNCATE TABLE employee; SQL_LANG |