Overview

2025-04-28 03:35:15  Updated

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.

Supported
Not supported

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, and MINUS.

  • Supports the EXPLAIN statement 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 VIEW statement for creating a materialized view.
  • Supports the DROP MATERIALIZED VIEW statement for dropping a materialized view.

Materialized view logs

  • Supports the CREATE MATERIALIZED VIEW LOG statement for creating a materialized view log.

    Note

    The default behavior of with_clause (where you can specify PRIMARY KEY, ROWID, and SEQUENCE) in the CREATE MATERIALIZED VIEW LOG statement in OceanBase Database is incompatible with those in Oracle Database.

  • Supports the DROP MATERIALIZED VIEW LOG statement for dropping a materialized view log.

Materialized views

  • Does not support the ON COMMIT or ON STATMENT refresh mode in the CREATE MATERIALIZED VIEW statement.
  • Does not support the PRESERVE TABLE clause in the DROP MATERIALIZED VIEW statement.

Materialized view logs

  • Does not support the following items in the syntax of the CREATE MATERIALIZED VIEW LOG statement:

    • The ASYNCHRONOUS clause for asynchronous purging.
    • The EXCLUDING NEW VALUES clause. If it is used, OceanBase Database returns an error.
    • Partitions.

PL features

OceanBase Database is compatible with most PL features of Oracle Database. For more information, see PL reference.

Supported
Not supported

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, and UTL_RAW

  • PL tag security packages, including SA_SYSDBA, SA_COMPONENTS, SA_LABEL_ADMIN, SA_POLICY_ADMIN, SA_USER_ADMIN, and SA_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.

Note

For 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.

Note

For 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.

Note

For 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.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

euckr_korean_ci euckr Uses EUCKR character set, performs case-insensitive sorting according to Korean collation.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

euckr_bin euckr Uses EUCKR character set, performs case-sensitive sorting in binary order.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

eucjpms_japanese_ci eucjpms Uses EUCJPMS character set, performs case-insensitive sorting according to Japanese collation.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

eucjpms_bin eucjpms Uses EUCJPMS character set, performs case-sensitive sorting in binary order.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

cp932_japanese_ci cp932 Uses CP932 character set, performs case-insensitive sorting according to Japanese collation.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

cp932_bin cp932 Uses CP932 character set, performs case-sensitive sorting in binary order.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

cp850_general_ci cp850 Uses CP850 character set, performs case-insensitive sorting according to general collation.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

cp850_bin cp850 Uses CP850 character set, performs case-sensitive sorting in binary order.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

hp8_english_ci hp8 Uses HP8 character set, performs case-insensitive sorting according to English collation.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

hp8_bin hp8 Uses HP8 character set, performs case-sensitive sorting in binary order.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

macroman_general_ci macroman Uses MacRoman character set, performs case-insensitive sorting according to general collation.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

macroman_bin macroman Uses MacRoman character set, performs case-sensitive sorting in binary order.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

swe7_swedish_ci swe7 Uses SWE7 character set, performs case-insensitive sorting according to Swedish collation.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

swe7_bin swe7 Uses SWE7 character set, performs case-sensitive sorting in binary order.

Note

For OceanBase Database V4.3.5, this collation is supported since V4.3.5 BP1.

Database object management

Supported
Not supported

Table management

  • Create tables: You can create tables and specify partitions and constraints when you create a table. For more information about the syntax for creating tables, see CREATE TABLE.

  • Modify base tables: You can use the ALTER TABLE statement to add, drop, and modify columns; add, drop, and modify constraints; and add, drop, and modify partitions. For more information about the syntax for modifying tables, see ALTER TABLE.

  • Drop base tables: You can drop tables and the constraints on the tables. For more information about the syntax for dropping tables, see DROP TABLE.

Constraints

  • Supports the CHECK, UNIQUE, and NOT NULL constraints.

  • Supports the PRIMARY KEY constraint.

  • Supports the FOREIGN KEY constraint.

  • Allows you to add CHECK, PRIMARY KEY, FOREIGN KEY, and NOT NULL constraints by executing the ALTER TABLE statement.

  • Supports the SET NULL constraint for cascaded tables.

Partition support

  • Supports partitioning, template-based subpartitioning, and non-template-based subpartitioning.

  • Supports HASH, RANGE, LIST, and composite partitioning.

  • Supports local and global indexes.

  • For partition maintenance, note that:

    • You can add, drop, and truncate partitions for partitioned tables.

    • You can add and drop partitions for template-based subpartitioned tables, and add, drop, and truncate partitions and subpartitions for non-template-based subpartitioned tables.

For more information about partitions, see Partition overview.

Index management

  • Supports only B-tree indexes.

  • Allows you to create and drop indexes.

View management

  • Allows you to create simple and complex views.

  • Allows you to drop views.

  • Supports SELECT statements.

  • Supports DML statements.

Sequence management

  • Allows you to create sequences.

  • Allows you to modify sequences. For example, you can reset sequences.

  • Allows you to drop sequences.

Synonym

  • Allows you to create synonyms for objects such as tables, views, synonyms, and sequences.

  • Allows you to create public synonyms.

Trigger management

  • Allows you to create triggers.

  • Allows you to modify triggers.

  • Allows you to drop triggers.

DBLinks

  • Supports read and write operations from OceanBase Database to OceanBase Database.

  • Supports read and write operations from OceanBase Database to Oracle Database.

Constraints

  • Does not support DISABLE operations for the UNIQUE constraint.

Partition support

  • Does not allow you to add or drop subpartitions for template-based subpartitioned tables.

Index management

  • Does not support index types such as bitmap indexes or reverse indexes.

Updatable views

Does not support the WITH CHECK OPTION clause.

Security features

OceanBase Database implements a wide range of security features.

Supported
Not supported

Privilege management

  • Compatible with most system privileges in Oracle Database. For more information about the privileges supported by the Oracle mode of OceanBase Database, see Privilege types in Oracle mode.

  • Supports regular object privilege management operations such as privilege granting and revocation.

  • Supports allowlist configuration for secure network access control.

  • Supports predefined system roles and custom roles.

Identity authentication

  • Compatible with the password strategies of Oracle Database.

  • Supports user locking and unlocking.

Transparent data encryption

OceanBase Database is compatible with the transparent data encryption (TDE) feature of Oracle Database. Data is automatically encrypted before it is written to storage devices and automatically decrypted when it is read.

Auditing

  • Supports the standard auditing feature of Oracle Database.

  • Supports statement auditing and object auditing.

  • Supports only tables, sequences, functions, and packages for object auditing.

  • Allows you to store audit data in files or internal tables.

  • Provides various audit-related system views.

Label security

  • Compatible with the Oracle Label Security feature of Oracle Database.

  • Supports the level component of Oracle Label Security.

SSL-based transmission link encryption

  • Offers the ability to encrypt data transmission both between clients and OBServer nodes and between OBServer nodes themselves.

  • Supports one-way Secure Sockets Layer (SSL) authentication, two-way X509 authentication, as well as additional special two-way authentication mechanisms, such as specifying the encryption algorithm, issuer, and SSL subject for authentication.

Auditing

  • Does not support unified auditing or fine-grained auditing (FGA).

  • Does not support privilege auditing or network auditing.

  • Does not allow you to delete audit data.

Label security

  • Does not support the compartment component or group component of Oracle Label Security.

Backup and restore

OceanBase Database also supports backup and restore features. For more information about the physical backup and restore features of OceanBase Database, see Overview of backup and restore.

Supported
Not supported
  • Allows you to use Network File System (NFS), Alibaba Cloud Object Storage Service (OSS), Tencent Cloud Object Storage (COS), Amazon Simple Storage Service (S3), and object storage services compatible with the S3 protocol as the backup media.

  • Supports automatic cleanup of expired backups.

  • Supports backup and restore at the tenant level.

  • Supports restore at the database and table levels.

  • Supports restore to a specified path.

  • Does not support backup and restore at the cluster level.

  • Does not support backup at the table level.

  • Does not support compression for log archives.

  • Does not support backup to a specified path.

  • Does not support manual cleanup of backups.

  • Does not support secondary backup.

  • Does not support the verification of backup data.

SQL engine

The SQL engine of OceanBase Database is compatible with most features of Oracle Database. For more information about the SQL engine of OceanBase Database, see SQL tuning.

Supported
Not supported
  • Supports query rewriting.

  • Supports precompiled statements.

  • Supports the cost-based optimizer.

  • Supports the EXPLAIN feature for execution plan generation and display.

  • Supports the plan cache.

  • Supports fast parameterization of execution plans.

  • Supports execution plan binding.

  • Supports optimizer hints.

  • Supports adaptive cursor sharing (ACS).

  • Supports the SQL plan management (SPM) feature.

  • Does not support the estimator feature.

  • Does not support execution plan isolation.

  • Does not support expression statistics store (ESS).

  • Does not support approximate query processing.

Contact Us