Adaptation for Migrating from Oracle to Kingbase
KDTS Tool Usage Guide
For details, see KDTS Migration Tool User Guide and Best Practices 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.
- Go to the database installation directory.
1cd /opt/Kingbase/ES/V8/KESRealPro/V008R006C008B0020/Server/bin
- Connect to the database.
1./ksql -U system -d KINGBASE
Enter the password of the system user as prompted.
1Password for user system:
- Change the password. Replace xxxxxx with the new password.
1alter 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:
1select 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:
- Go to the data directory.
1cd /opt/Kingbase/ES/V8/data
- Open the kingbase.conf file and modify the following parameter. If the parameter does not exist, add it.
1nls_length_semantics = byte
If the preceding value is byte but the corresponding value is char in Oracle, change the value to char.
- Switch to user kingbase and restart the database.
1/opt/Kingbase/ES/V8/Server/bin/sys_ctl -D /opt/Kingbase/ES/V8/data restart
- Go to the data directory.
- 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.
- Go to the data directory.
1cd /opt/Kingbase/ES/V8/data
- Open the kingbase.conf file and modify the following parameter. If the parameter does not exist, add it.
1default_with_oids = on
- Switch to user kingbase and restart the database.
1/opt/Kingbase/ES/V8/Server/bin/sys_ctl -D /opt/Kingbase/ES/V8/data restart
- Go to the data directory.
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.
- Go to the data directory.
1cd /opt/Kingbase/ES/V8/data
- Open the kingbase.conf file. Check whether the value of ora_input_emptystr_isnull is on. If it is not, change it to on.
- 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