Rate This Document
Findability
Accuracy
Completeness
Readability

Adaptation for Migrating from Oracle to Kingbase

Changing the Password of the Kingbase Database Administrator

After the Kingbase database is installed, the initial password of the system administrator account system is randomly generated. You can perform the following operations to change the initial password.

  1. Go to the database installation directory.
    1
    cd /opt/Kingbase/ES/V8/KESRealPro/V008R006C008B0020/Server/bin
    
  2. Connect to the database.
    1
    ./ksql -U system -d KINGBASE
    

    Enter the password of the system user as prompted.

    1
    Password for user system:
    
  3. Change the password. Replace xxxxxx with the new password.
    1
    alter user system with password 'xxxxxx';
    

Kingbase Database Compatibility Settings

Configure Oracle compatibility for the KingbaseES database. Generally, the following session-level compatibility parameters should be configured:

  • nls_length_semantics: specifies whether the default unit of the Char data type is byte or char, which is also the unit of the maximum identifier length. If the unit is char, the maximum identifier length is 63 characters. Otherwise, the maximum identifier length is 63 bytes.

    The default value of nls_length_semantics in KingbaseES must match the corresponding parameter setting in Oracle, and is char by default. The default value of the byte|char attribute in Oracle is determined by the Oracle database parameter NLS_LENGTH_SEMANTICS. You can run the following statement to query the default value:

    1
    select value from nls_database_parameters where parameter = 'NLS_LENGTH_SEMANTICS';
    

    If you do not change the default value, redundant spaces may exist in the migrated data due to different database storage types when the Char type is migrated.

    You can modify the setting as follows:

    1. Go to the data directory.
      1
      cd /opt/Kingbase/ES/V8/data
      
    2. Open the kingbase.conf file and modify the following parameter. If the parameter does not exist, add it.
      1
      nls_length_semantics = byte
      

      If the preceding value is byte but the corresponding value is char in Oracle, change the value to char.

    3. Switch to user kingbase and restart the database.
      1
      /opt/Kingbase/ES/V8/Server/bin/sys_ctl -D /opt/Kingbase/ES/V8/data restart
      
  • default_with_oids: OID pseudocolumn switch. The OID pseudocolumn of KingbaseES is compatible with the ROWID pseudocolumn of Oracle. Therefore, if the migrated Oracle object contains the ROWID pseudocolumn, you are advised to replace it with the OID pseudocolumn.
    1. Go to the data directory.
      1
      cd /opt/Kingbase/ES/V8/data
      
    2. Open the kingbase.conf file and modify the following parameter. If the parameter does not exist, add it.
      1
      default_with_oids = on
      
    3. Switch to user kingbase and restart the database.
      1
      /opt/Kingbase/ES/V8/Server/bin/sys_ctl -D /opt/Kingbase/ES/V8/data restart
      

Kingbase Database Null Value Settings

In Kingbase, the default value of ora_input_emptystr_isnull is off. If the inserted field information is empty, the field information is not automatically converted to NULL when being written to the database. You need to set ora_input_emptystr_isnull to on.

  1. Go to the data directory.
    1
    cd /opt/Kingbase/ES/V8/data
    
  2. Open the kingbase.conf file. Check whether the value of ora_input_emptystr_isnull is on. If it is not, change it to on.
  3. After the modification is complete, switch to the kingbase user and restart the database.
    1
    /opt/Kingbase/ES/V8/Server/bin/sys_ctl -D /opt/Kingbase/ES/V8/data restart
    

Compatibility Between Kingbase and Oracle

For details, see the official compatibility guide.

This document provides only basic information. For more information about Kingbase database usage, see the Kingbase official documentation.