This topic describes the compatibility between OceanBase Database's Oracle mode and native Oracle Database.
OceanBase Database is compatible with Oracle Database in fundamental aspects, such as data types, SQL functionalities, and database objects. OceanBase Database is largely compatible with Oracle Database in Procedural Language (PL) features used in research and development. Regarding advanced features like database security, backup and restore, high availability, and optimizer, OceanBase Database not only offers strong compatibility but also surpasses Oracle Database in some areas. This means that users can smoothly migrate from Oracle Database to OceanBase Database without needing to spend a lot of time learning new concepts.
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, the LONG and LONG RAW data types are considered too outdated for optimization reasons. Therefore, 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 SQL syntaxes supported by Oracle Database. If a SQL syntax is not supported, an error will be returned.
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 set operations:
UNION,UNION ALL,INTERSECT, andMINUS.Supports the
EXPLAINstatement for viewing execution plans.
INSERT
Supports single- and multi-row inserts, as well as insert operations 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 set 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, 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.- Supports the
DROP MATERIALIZED VIEW LOGstatement for dropping 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
Materialized views
- Does not support the
ON COMMITorON STATMENTrefresh mode in the syntax of theCREATE MATERIALIZED VIEWstatement. - Does not support the
PRESERVE TABLEclause in the syntax of theDROP MATERIALIZED VIEWstatement.
Materialized view logs
Does not support the following items in the syntax of the
CREATE MATERIALIZED VIEW LOGstatement:- The
ASYNCHRONOUSclause (which specifies to purge the log asynchronous). - The
EXCLUDING NEW VALUESclause. If it is used, an error will be returned. - Partitions.
- The
Procedural Language 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
Sets and records (multi-dimensional sets are not supported)
Static SQL statements
Dynamic SQL statements
Subprocedures
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, the behavior differs between the two databases.
If the parameter has the IN OUT attribute and is of a complex data type, the two databases are compatible.
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
OceanBase Database Oracle mode supports the following character sets:
- utf8mb4
- gbk
- utf16
- gb18030
- latin1
- gb18030_2022
Collations
The Oracle mode of OceanBase Database supports the following collations.
| Collation | Character set | Description |
|---|---|---|
| utf8mb4_general_ci | utf8mb4 | A general collation. |
| utf8mb4_bin | utf8mb4 | A binary collation. |
| utf8mb4_unicode_ci | utf8mb4 | A collation that is based on 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 that is based on Unicode Collation Algorithm (UCA). |
| gb18030_chinese_ci | gb18030 | A collation for Chinese. |
| gb18030_bin | gb18030 | A binary collation. |
| latin1_bin | latin1 | latin1 uses a binary collation. |
| 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 by Pinyin. The collation is case-insensitive. |
| gb18030_2022_chinese_cs | gb18030_2022 | A collation that sorts data by Pinyin. The collation is case-sensitive. |
| gb18030_2022_radical_ci | gb18030_2022 | A collation that sorts data by radicals. The collation is case-insensitive. |
| gb18030_2022_radical_cs | gb18030_2022 | A collation that sorts data by radicals. The collation is case-sensitive. |
| gb18030_2022_stroke_ci | gb18030_2022 | A collation that sorts data by strokes. The collation is case-insensitive. |
| gb18030_2022_stroke_cs | gb18030_2022 | A collation that sorts data by strokes. The collation is case-sensitive. |
Database object management
Table management
Create tables: You can create tables and specify partitions and constraints when you create a table. For more information, see CREATE TABLE.
Modify base tables: You can use the
ALTER TABLEstatement to add, drop, and modify columns; add, drop, and modify constraints; and add, drop, and modify partitions. For more information, see ALTER TABLE.Drop base tables: You can drop tables and the constraints on the tables. For more information, see DROP TABLE.
Constraints
Supports
CHECK,UNIQUE, andNOT NULLconstraints.Supports
PRIMARY KEYconstraints.Supports
FOREIGN KEYconstraints.Allows you to add
CHECK,PRIMARY KEY,FOREIGN KEY, andNOT NULLconstraints by executing theALTER TABLEstatement.Supports
SET NULLfor 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, take note of the following points:
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
OceanBase Database supports only B-tree indexes, function-based indexes, and columnstore indexes.
Allows you to create and drop indexes.
View management
Allows you to create simple and complex views.
Allows you to drop views.
Supports
SELECTstatements.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
DISABLEoperations for theUNIQUEconstraint.
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 and reverse indexes.
- The index is unavailable during the rebuilding process by using the UPDATE GLOBAL INDEX statement.
Updatable views
Does not support the WITH CHECK OPTION clause.
Security features
OceanBase Database implements a wide range of security features.
Privilege management
Compatible with most system privileges in Oracle Database. For more information, 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.
TDE
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 OceanBase Database servers and between OceanBase Database nodes.
Supports one-way Secure Sockets Layer (SSL) authentication, two-way X509 authentication, as well as additional special two-way authentication mechanisms.
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 offers backup and restore features. For more information about the physical backup and restore features of OceanBase Database, see Overview.
Allows you to use NFS, Alibaba Cloud OSS, Tencent Cloud COS, and AWS S3 as backup destinations.
Supports automatic cleanup of expired backups.
Supports backup and restore at the tenant level.
Supports restore at the database and table levels.
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 local 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, see SQL tuning.
Supports query rewriting.
Supports precompiled statements.
Supports the cost-based optimizer.
Supports the
EXPLAINfeature for plan generation and display.Supports plan caching.
Supports fast parameterization of plans.
Supports 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 plan isolation.
Does not support expression statistics store (ESS).
Does not support approximate query processing.