This topic describes the compatibility between OceanBase Database in Oracle-compatible mode and native Oracle Database.
OceanBase Database is compatible with Oracle Database in terms of basic features such as data types, SQL functionality, and database objects. It is largely compatible with all development features of Oracle's Procedural Language (PL). OceanBase Database also offers excellent compatibility with advanced features like database security, backup and recovery, high availability, and the optimizer, with some aspects even surpassing Oracle Database. This means users can migrate smoothly from Oracle Database to OceanBase Database without spending significant time learning new concepts.
However, due to differences in underlying architecture and product form factor between OceanBase Database and Oracle Database, some features are not currently supported or behave differently in OceanBase Database. This topic covers the compatibility between OceanBase Database and Oracle Database in the following areas:
SQL data types
Built-in functions
SQL syntax
Procedural language
System views
Character sets
Collations
Database object management
Security features
Backup and recovery
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.
For optimization reasons, the LONG and LONG RAW data types are considered obsolete, and OceanBase Database currently has no plans to support them.
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 syntax
OceanBase Database supports most of the SQL syntax of Oracle Database. A few missing features will result in a syntax error.
SELECT
Supports most query features, including single-table and multi-table queries; subqueries; inner joins, semi joins, and outer joins; grouping and aggregation; hierarchical queries; and common data mining functions such as probability and linear regression.
Supports the following set operations:
UNION,UNION ALL,INTERSECT, andMINUS.Supports using the
EXPLAINstatement to view execution plans.
INSERT
Supports single-row and multi-row data insertion, including inserting data into specified partitions.
Supports the
INSERT INTO ... SELECT ...statement.Supports inserting data into single and multiple tables.
UPDATE
Supports single-column and multi-column data updates.
Supports updating data using subqueries.
Supports set updates.
DELETE
- Supports single-table and multi-table deletion.
TRUNCATE
- Supports completely truncating a specified table.
Parallel query
Supports parallel queries similar to those in Oracle Database.
OceanBase Database supports the Auto DOP feature. You can also manually specify the DOP using
Hint/Sessionvariables.Supports parallel Data Manipulation Language (DML).
Hint
OceanBase Database supports using Hint syntax. For detailed information about Hints, see Hint.
Materialized View
CREATE MATERIALIZED VIEW(creates a materialized view).DROP MATERIALIZED VIEW(drops a materialized view).
Materialized View Log
CREATE MATERIALIZED VIEW LOG(creates a materialized view log).Note
In OceanBase Database, the default behavior of the
with_clause(PRIMARY KEY,ROWID,SEQUENCE) in theCREATE MATERIALIZED VIEW LOGsyntax is incompatible with Oracle Database.DROP MATERIALIZED VIEW LOG(drops a materialized view log).
Materialized View
- In the
CREATE MATERIALIZED VIEW(creates a materialized view) syntax, theON COMMITandON STATMENTrefresh modes are not currently supported. - In the
DROP MATERIALIZED VIEW(drops a materialized view) syntax, thePRESERVE TABLEclause is not currently supported.
Materialized View Log
In the
CREATE MATERIALIZED VIEW LOG(creates a materialized view log) syntax:- The
ASYNCHRONOUSclause (performs clearance asynchronously) is not currently supported. - Using the
EXCLUDING NEW VALUESclause will result in an error. - Partitions are not currently supported.
- The
Procedural Language
OceanBase Database is compatible with most PL features of Oracle Database. For detailed information about PL features, see PL reference.
OceanBase Database supports the following PL features:
Data types
Process control
Collections and records (multi-dimensional collections are not supported).
Static SQL
Dynamic SQL
Subprograms
Triggers
Exception handling
Packages
Performance optimization
Custom data types
PL system packages, including
DBMS_CRYPTO,DBMS_DEBUG,DBMS_LOB,DBMS_LOCK,DBMS_METADATA,DBMS_OUTPUT,DBMS_RANDOM,DBMS_SQL,DBMS_XA,UTL_I18N, andUTL_RAW.PL label security packages, including
SA_SYSDBA,SA_COMPONENTS,SA_LABEL_ADMIN,SA_POLICY_ADMIN,SA_USER_ADMIN, andSA_SESSION.
OceanBase Database has compatibility differences with Oracle Database in implementing the behavior of NOCOPY parameters:
For basic data type parameters and complex data type parameters with the OUT attribute only, OceanBase Database is not compatible with the pass-by-reference behavior of Oracle Database.
For complex data type parameters with the IN OUT attribute, OceanBase Database is compatible with the pass-by-reference behavior of Oracle Database.
OceanBase Database does not currently support the following PL feature:
- Conditional compilation
System views
OceanBase Database is compatible with some system views of Oracle Database. For a detailed list of compatible views, see System views. For more information about fields in system views, see Overview of system views.
Character sets
The following character sets are supported in the Oracle-compatible mode of OceanBase Database:
- binary
- utf8mb4
- gbk
- utf16
- gb18030
- latin1
- gb18030_2022
- ascii
- tis620
- utf16le
- hkscs
- hkscs31
- dec8
- gb2312
- eucjpms
- macroman
Collations
The following table describes the collations supported by the Oracle mode of OceanBase Database.
Collation |
Character set |
Description |
|---|---|---|
| utf8mb4_general_ci | utf8mb4 | A general collation. |
| utf8mb4_bin | utf8mb4 | A binary collation. |
| utf8mb4_unicode_ci | utf8mb4 | A collation based on the Unicode Collation Algorithm (UCA). |
| binary | binary | A binary collation. |
| gbk_chinese_ci | gbk | A collation for Chinese. |
| gbk_bin | gbk | A binary collation. |
| utf16_general_ci | utf16 | A general collation. |
| utf16_bin | utf16 | A binary collation. |
| utf16_unicode_ci | utf16 | A collation based on the Unicode Collation Algorithm (UCA). |
| gb18030_chinese_ci | gb18030 | A collation for Chinese. |
| gb18030_bin | gb18030 | A binary collation. |
| latin1_swedish_ci | latin1 | A collation for Swedish and Finnish. |
| latin1_german1_ci | latin1 | A collation for the Latin-1 character set in German-speaking environments. |
| latin1_danish_ci | latin1 | A collation for the Latin-1 character set in Danish-speaking environments. |
| latin1_german2_ci | latin1 | A collation for German-speaking environments, suitable for applications requiring lexicographical character comparison. |
| latin1_general_ci | latin1 | A collation for scenarios requiring case-insensitivity and support for diacritics, such as database design for some European languages. |
| latin1_general_cs | latin1 | A general collation that is case-sensitive and supports multiple languages (such as Western European languages). |
| latin1_spanish_ci | latin1 | A collation for Spanish-speaking environments. |
| latin1_bin | latin1 | A binary collation for Latin-1. |
| gb18030_2022_bin | gb18030_2022 | A binary collation. The default collation for this character set in Oracle mode. |
| gb18030_2022_chinese_ci | gb18030_2022 | A collation that sorts data using Pinyin. It is case-insensitive. |
| gb18030_2022_chinese_cs | gb18030_2022 | A collation that sorts data using Pinyin. It is case-sensitive. |
| gb18030_2022_radical_ci | gb18030_2022 | A collation that sorts data using radicals and strokes. It is case-insensitive. |
| gb18030_2022_radical_cs | gb18030_2022 | A collation that sorts data using radicals and strokes. It is case-sensitive. |
| gb18030_2022_stroke_ci | gb18030_2022 | A collation that sorts data using strokes. It is case-insensitive. |
| gb18030_2022_stroke_cs | gb18030_2022 | A collation that sorts data using strokes. It is case-sensitive. |
| ascii_bin | ascii | A binary collation. |
| ascii_general_ci | ascii | An alphabet-based case-insensitive collation. It ignores case differences, treating uppercase and lowercase letters as the same character. |
| tis620_bin | tis620 | A binary collation. |
| tis620_thai_ci | tis620 | A collation for Thai that is case-insensitive. |
| gb2312_chinese_ci | gb2312 | A collation that uses the GB2312 character set and sorts data in a case-insensitive manner according to Chinese rules. |
| gb2312_bin | gb2312 | A collation that uses the GB2312 character set and sorts data in a case-sensitive manner according to binary rules. |
| eucjpms_japanese_ci | eucjpms | A collation that uses the EUCJPMS character set and sorts data in a case-insensitive manner according to Japanese rules. |
| eucjpms_bin | eucjpms | A collation that uses the EUCJPMS character set and sorts data in a case-sensitive manner according to binary rules. |
| macroman_general_ci | macroman | A collation that uses the MacRoman character set and sorts data in a case-insensitive manner according to general rules. |
| macroman_bin | macroman | A collation that uses the MacRoman character set and sorts data in a case-sensitive manner according to binary rules. |
Database object management
Table management
Create tables: You can create tables and specify partitions, constraints, and other information during creation. For detailed syntax on creating tables, see CREATE TABLE.
Modify base tables: You can use the
ALTER TABLEstatement to add, drop, or modify columns; add or drop constraints; and add, drop, or modify partitions. For detailed syntax on modifying tables, see ALTER TABLE.Drop base tables: You can drop tables with cascading constraints. For detailed syntax on dropping tables, see DROP TABLE.
Constraints
Supports the
CHECK,UNIQUE, andNOT NULLconstraints.Supports the
PRIMARY KEYconstraint.Supports the
FOREIGN KEYconstraint.Supports adding
CHECK,PRIMARY KEY,FOREIGN KEY, andNOT NULLconstraints using theALTER TABLEstatement.Supports
SET NULLin cascading operations.
Partition support
Supports partitions, template-based subpartitions, and non-template-based subpartitions.
Supports partitioning methods such as hash (Hash), range (Range), list (List), and composite partitioning.
Supports local indexes and global indexes.
For partition maintenance operations:
- Partitioned tables support adding, dropping, and truncating partitions.
- Subpartitioned tables support adding and dropping subpartitions.
- Subpartitioned tables also support adding, dropping, and truncating subpartitions.
For more information about partitions, see Partition overview.
Index management
OceanBase Database supports only B-tree indexes, function-based indexes, and spatial indexes.
Supports creating and dropping indexes.
View management
Supports creating simple or complex views.
Supports dropping views.
Supports the
SELECTstatement.Supports DML statements.
Sequence management
Supports creating sequences.
Supports modifying sequences, including the ability to reset sequence values.
Supports dropping sequences.
Synonyms
Supports creating synonyms for objects such as tables, views, synonyms, and sequences.
Supports creating public synonyms.
Trigger management
Supports creating triggers.
Supports modifying triggers.
Supports dropping triggers.
Database links
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 the
DISABLEoperation forUNIQUEconstraints.
Index management
- Does not support index types such as bitmap and reverse indexes.
- The index is unavailable during the rebuild using UPDATE GLOBAL INDEX.
Updatable views
Does not support the WITH CHECK OPTION clause.
Security features
OceanBase Database implements a rich set of security features.
Privilege management
Compatible with most system privileges of Oracle Database. For information about the privileges supported in Oracle-compatible mode of OceanBase Database, see Privilege types in Oracle-compatible mode.
Supports common object privilege management, such as granting and revoking privileges.
Supports allowlist policies to implement network access control.
Supports system-defined roles and user-defined roles.
Identity authentication
Oracle-compatible mode is compatible with the password policies of Oracle Database.
Supports locking and unlocking users.
Transparent data encryption
Compatible with the TDE feature of Oracle Database. Data is automatically encrypted before being written to storage devices and automatically decrypted upon read.
Auditing
Supports standard auditing in Oracle Database.
Supports statement-level and object-level auditing.
Object-level auditing currently supports tables, sequences, functions, and package objects.
Audit results can be stored in files or internal tables.
Supports various system views related to auditing.
Label Security
Compatible with the Label Security feature in Oracle Database.
Supports the Level dimension.
SSL for transmission link encryption
Supports transmission link encryption between clients and OceanBase Database servers, as well as data transmission encryption between OceanBase Database nodes.
In addition to supporting SSL one-way authentication and X509 two-way authentication, it also supports special two-way authentications such as specified encryption algorithms, specified issuer authentication, and specified SSL subject authentication.
Audit
Unified audit and fine-grained audit of file and group access (FGA) are not supported.
Permission audit and network audit are not supported.
Modifying, overwriting, or deleting audit data is not supported.
Tag Security
- The compartment and group dimensions are not supported.
Backup and Recovery
OceanBase Database also provides backup and recovery features. For more information about the physical backup and recovery features of OceanBase Database, see Overview of Backup and Recovery.
Supports using NFS, Alibaba Cloud OSS, AWS S3, and S3-compatible object storage services (such as Huawei OBS, Google GCS, and Tencent Cloud COS) as backup media.
Supports automatic and manual cleanup of backups.
Supports specifying backups or archives for cleanup.
Supports backup and recovery at the tenant level.
Supports recovery at the database and table levels.
Supports recovery to a specified path.
Supports log archiving and verification of backup data.
Does not support backup and recovery at the cluster level.
Does not support backup at the table level.
Does not support log archiving compression.
Does not support backup to a specified path.
Does not support backup of backups.
SQL engine
The SQL engine of OceanBase Database is compatible with most features of Oracle Database. For more information about the SQL engine, see SQL Tuning Guide.
Supports query rewriting.
Supports prepared statements.
Supports the cost-based optimizer.
Supports execution plan generation and display (
EXPLAIN).Supports execution plan caching.
Supports rapid parameterization of execution plans.
Supports execution plan binding.
Supports Optimizer Hint.
Supports adaptive cursor sharing (ACS).
Supports execution plan management (SPM).
Does not support the estimator.
Does not support execution plan isolation.
Does not support expression statistics storage (ESS).
Does not support approximate query processing.
