Oracle SQL Migration (to GaussDB A)

DSC supports the migration from Oracle to GaussDB A, including the migration of schemas, DML, queries, system functions, and PL/SQL.

Oracle SQL Migration

Run the following commands to set the source database, input and output folder paths, log paths, application language, and schema conversion type:

Linux:

./runDSC.sh
--source-db Oracle 
[--input-folder <input-script-path>] 
[--output-folder <output-script-path>]
[--log-folder <log-path>]
[--application-lang Oracle] 
[--conversion-type <conversion-type>]

Windows:

runDSC.bat
--source-db Oracle 
[--input-folder <input-script-path>] 
[--output-folder <output-script-path>]
[--log-folder <log-path>]
[--application-lang Oracle] 
[--conversion-type <conversion-type>]
  • When migrating common DDL statements (such as tables, views, indexes, sequences, and so on) that do not contain PL/SQL statements, use the Bulk mode (that is, set conversion-type to Bulk).

    Example of the command with sample folder information and conversion-type set as Bulk:

    Linux:

    ./runDSC.sh --source-db Oracle --input-folder /opt/DSC/DSC/input/oracle/ --output-folder /opt/DSC/DSC/output/ --log-folder /opt/DSC/DSC/log/ --application-lang SQL --conversion-type bulk --targetdb gaussdbA

    Windows:

    runDSC.bat --source-db Oracle --input-folder D:\test\conversion\input --output-folder D:\test\conversion\output --log-folder D:\test\conversion\log --application-lang SQL --conversion-type bulk --targetdb gaussdb

    During the execution of DSC, the migration summary, including the progress and completion status, is displayed on the console. Execution information and errors are written into log files.

    ********************** 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 ************************
  • When migrating objects such as functions, procedures, and packages that contain PL/SQL statements, use the BLogic mode (that is, set conversion-type to BLogic).

    Example of the command with sample folder information and conversion-type set as BLogic:

    Linux:

    ./runDSC.sh --source-db Oracle --input-folder /opt/DSC/DSC/input/oracle/ --output-folder /opt/DSC/DSC/output/ --log-folder /opt/DSC/DSC/log/ --application-lang SQL --conversion-type bulk --targetdb gaussdbA

    Windows:

    runDSC.bat --source-db Oracle --input-folder D:\test\conversion\input --output-folder D:\test\conversion\output --log-folder D:\test\conversion\log --application-lang SQL --conversion-type blogic --targetdb gaussdbA

    During the execution of DSC, the migration summary, including the progress and completion status, is displayed on the console. Execution information and errors are written into log files.

    ********************** 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 ************************

Note that common DDL scripts and PL/SQL scripts should be placed in different input folders for migration.

Oracle PACKAGE Migration Precautions

  1. The package specifications (that is, the package header) and the package body should be placed in different files and in the same input path for migration.
  2. You need to migrate common DDL statements (including all table structure information referenced in the PACKAGE script) in Bulk mode to form a dictionary in the config/create-types-UDT.properties file. Then, migrate the package specification (that is, the package header) and the package body in Blogic mode. The details are as follows:

When some Oracle PACKAGE defines package specifications, the tbName.colName%TYPE syntax is used to declare custom record types based on other table objec

    Example
    CREATE OR REPLACE PACKAGE p_emp
    AS
        --Define the RECORD type
        TYPE re_emp IS RECORD(
            rno emp.empno%TYPE,
            rname emp.empname%TYPE
        );
    END;

The GaussDB does not support "tbName.colName%TYPE" in specifying data type for a column of a CREATE TYPE statement. Therefore, during the migration, the DSC needs to build a database context environment containing the emp table information. In this case, you need to use DSC to migrate all table creation scripts (that is, use the Bulk mode to migrate common DDL statements). DSC automatically generates corresponding data dictionaries. After the context environment containing various table information is built, the Blogic mode can be used to migrate the Oracle PACKAGE. In this case, the re_emp record type is migrated according to the column type of the emp table.

    Expected output
    CREATE TYPE p_emp.re_emp AS (
        rno NUMBER(4),
        rname VARCHAR2(10)
    );

For details about how to migrate Oracle SQL using DSC, see Executing DSC.