This topic describes the compatibility between OceanBase Database's Oracle mode and native Oracle Database.
OceanBase Database is compatible with Oracle Database in terms of basic features, including the data types, SQL features, and database objects. OceanBase Database is compatible with most Procedural Language (PL)-related R&D features of Oracle Database. In terms of advanced features such as database security, backup and restore, high availability, and optimizer, OceanBase Database provides sound compatibility with and even outperforms Oracle Database. Therefore, you can smoothly migrate data and services from Oracle Database to OceanBase Database without spending much time learning everything about OceanBase Database.
However, due to differences in underlying architecture and product structure, there are some features that OceanBase Database does not support or where it behaves differently from Oracle Database. This topic covers the compatibility between OceanBase Database's Oracle mode and Oracle Database in the following areas:
SQL data types
Built-in functions
SQL syntaxes
PL features
System views
Character sets
Collations
Database object management
Security features
Backup and restore
SQL engine
SQL data types
OceanBase Database is compatible with most of the data types supported by Oracle Database. For more information, see SQL data types.
However, for optimization reasons, the LONG and LONG RAW data types are considered too outdated, and OceanBase Database currently has no plans to support these two data types.
Built-in functions
OceanBase Database is compatible with most of the built-in functions supported by Oracle Database. For more information, see Built-in functions.
SQL syntaxes
OceanBase Database supports most of the SQL syntaxes in Oracle Database. For some unsupported SQL syntaxes, OceanBase Database will return an "unsupported syntax" error to indicate that the corresponding features are unavailable.
SELECT
Supports most query features, including single- and multi-table queries, subqueries, inner joins, semi joins, outer joins, grouping, aggregation, hierarchical queries, and regular data mining functions such as probability and linear regression functions.
Supports the following collection operations:
UNION,UNION ALL,INTERSECT, andMINUS.Supports the
EXPLAINstatement for viewing execution plans.
INSERT
Supports single- and multi-row inserts, as well as insertion into a specified partition.
Supports the
INSERT INTO ... SELECT ...statement.Supports single- and multi-table inserts.
UPDATE
Supports single- and multi-column updates.
Supports updates by using subqueries.
Supports collection updates.
DELETE
- Supports single- and multi-table deletion.
TRUNCATE
- Supports the truncation of a specified table.
Parallel queries
Supports parallel queries similar to those in Oracle Database.
OceanBase Database supports the auto degree of parallelism (DOP) feature. You can also manually specify the DOP by using hints or session variables.
Supports parallel DML statements.
Hint
OceanBase Database supports hints. For more information about hints, see Hint.
Materialized views
- Supports the
CREATE MATERIALIZED VIEWstatement for creating a materialized view. - Supports the
DROP MATERIALIZED VIEWstatement for dropping a materialized view.
Materialized view logs
Supports the
CREATE MATERIALIZED VIEW LOGstatement for creating a materialized view log.Note
The default behavior of
with_clause(where you can specifyPRIMARY KEY,ROWID, andSEQUENCE) in theCREATE MATERIALIZED VIEW LOGstatement in OceanBase Database is incompatible with those in Oracle Database.Supports the
DROP MATERIALIZED VIEW LOGstatement for dropping a materialized view log.
Materialized views
- Does not support the
ON COMMITorON STATMENTrefresh mode in theCREATE MATERIALIZED VIEWstatement. - Does not support the
PRESERVE TABLEclause in theDROP MATERIALIZED VIEWstatement.
Materialized view logs
Does not support the following items in the syntax of the
CREATE MATERIALIZED VIEW LOGstatement:- The
ASYNCHRONOUSclause for asynchronous purging. - The
EXCLUDING NEW VALUESclause. If it is used, OceanBase Database returns an error. - Partitions.
- The
PL features
OceanBase Database is compatible with most PL features of Oracle Database. For more information, see PL reference.
OceanBase Database supports the following PL features of Oracle Database:
Data types
Process control
Collections and records (multi-dimensional collections are not supported)
Static SQL statements
Dynamic SQL statements
Subprograms
Triggers
Exception handling
Packages
Performance optimization
Custom data types
PL packages, including
DBMS_CRYPTO,DBMS_DEBUG,DBMS_LOB,DBMS_LOCK,DBMS_METADATA,DBMS_OUTPUT,DBMS_RANDOM,DBMS_SQL,DBMS_XA,UTL_I18N, andUTL_RAWPL tag security packages, including
SA_SYSDBA,SA_COMPONENTS,SA_LABEL_ADMIN,SA_POLICY_ADMIN,SA_USER_ADMIN, andSA_SESSION
In the implementation of NOCOPY for a parameter, compatibility between OceanBase Database and Oracle Database varies as follows:
If the parameter is of a basic data type or the parameter has the OUT attribute and is of a complex data type, OceanBase Database is incompatible with the pass-by-reference behavior in Oracle Database.
If the parameter has the IN OUT attribute and is of a complex data type, OceanBase Database is compatible with the pass-by-reference behavior in Oracle Database.
OceanBase Database does not support the following PL feature of Oracle Database:
- Conditional compilation
System views
OceanBase Database is compatible with some system views of Oracle Database. For more information, see System views. For more information about columns in system views, see Overview of system views.
Character sets
The Oracle mode of OceanBase Database supports the following character sets:
- binary
- utf8mb4
- gbk
- utf16
- gb18030
- latin1
- gb18030_2022
- ascii
- tis620
- utf16le
- sjis
- hkscs
- hkscs31
- dec8
- gb2312
- ujis
- euckr
- eucjpms
- cp932
- cp850
- hp8
- macroman
- swe7
Note
For OceanBase Database V4.3.5, the following character sets are supported starting from V4.3.5 BP1: gb2312, ujis, euckr, eucjpms, cp932, cp850, hp8, macroman, and swe7.
Collations
The following table describes the collations supported by the Oracle mode of OceanBase Database.
| Collation | Character set | Description |
|---|---|---|
| utf8mb4_general_ci | utf8mb4 | Uses general collation. |
| utf8mb4_bin | utf8mb4 | Uses binary collation. |
| utf8mb4_unicode_ci | utf8mb4 | Uses collation based on the Unicode Collation Algorithm (UCA). |
| binary | binary | Uses binary collation. |
| gbk_chinese_ci | gbk | Uses Chinese language collation. |
| gbk_bin | gbk | Uses binary collation. |
| utf16_general_ci | utf16 | Uses general collation. |
| utf16_bin | utf16 | Uses binary collation. |
| utf16_unicode_ci | utf16 | Uses collation based on the UCA. |
| gb18030_chinese_ci | gb18030 | Uses Chinese language collation. |
| gb18030_bin | gb18030 | Uses binary collation. |
| latin1_swedish_ci | latin1 | Uses Swedish/Finnish collation. |
| latin1_german1_ci | latin1 | Uses collation for the German language environment in the latin1 character set. |
| latin1_danish_ci | latin1 | Uses collation for the Danish language environment in the latin1 character set. |
| latin1_german2_ci | latin1 | Used for German environments, suitable for applications needing dictionary order character comparison. |
| latin1_general_ci | latin1 | Used for case-insensitive scenarios supporting diacritics, such as database designs for some European languages. |
| latin1_general_cs | latin1 | Used for case-sensitive general collation, supporting multiple languages (for example, Western European languages). |
| latin1_spanish_ci | latin1 | Used for collation in the Spanish language environment. |
| latin1_bin | latin1 | Uses binary collation for latin1. |
| gb18030_2022_bin | gb18030_2022 | Uses binary collation, which is the default character sequence in Oracle mode. |
| gb18030_2022_chinese_ci | gb18030_2022 | Uses pinyin collation, which is case-insensitive. |
| gb18030_2022_chinese_cs | gb18030_2022 | Uses pinyin collation, which is case-sensitive. |
| gb18030_2022_radical_ci | gb18030_2022 | Uses radical-stroke collation, which is case-insensitive. |
| gb18030_2022_radical_cs | gb18030_2022 | Uses radical-stroke collation, which is case-sensitive. |
| gb18030_2022_stroke_ci | gb18030_2022 | Uses stroke collation, which is case-insensitive. |
| gb18030_2022_stroke_cs | gb18030_2022 | Uses stroke collation, which is case-sensitive. |
| ascii_bin | ascii | Uses binary collation. |
| ascii_general_ci | ascii | Uses case-insensitive alphabetical collation, treating uppercase and lowercase letters as the same. |
| tis620_bin | tis620 | Uses binary collation. |
| tis620_thai_ci | tis620 | Uses Thai collation, which is case-insensitive. |
| gb2312_chinese_ci | gb2312 | Uses GB2312 character set, performs case-insensitive sorting according to Chinese collation.
NoteFor OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1. |
| gb2312_bin | gb2312 | Uses GB2312 character set, performs case-sensitive sorting in binary order.
NoteFor OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1. |
| ujis_japanese_ci | ujis | Uses UJIS character set, performs case-insensitive sorting according to Japanese collation.
NoteFor OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1. |
| ujis_bin | ujis | Uses UJIS character set, performs case-sensitive sorting in binary order.
NoteFor OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1. |
| euckr_korea |
