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 for 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 and are not supported by OceanBase Database.
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. Some SQL syntaxes not supported by OceanBase Database will result in a syntax not supported error.
SELECT
Supports most query features, including single- and multi-table queries, subqueries, lateral derived tables, 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 data updates.
Supports updates by using subqueries.
Supports set updates.
DELETE
- Supports single- and multi-table data 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.
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
Static SQL statements
Dynamic SQL statements
Subprocedures
Triggers
Exception handling
Packages
Performance optimization
Customized 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
System views
OceanBase Database is compatible with some system views of Oracle Database. Specifically:
OceanBase Database is compatible with 195 dictionary views of Oracle Database.
OceanBase Database is compatible with 20 performance views (with the prefix of v$).
For more information, see System views.
For more information about columns in system views, see Overview of system views.
Character sets
OceanBase Database supports the following character sets:
- utf8mb4
- gbk
- utf16
- gb18030
- latin1
- gb18030_2022
Collations
OceanBase Database supports the collations listed in the following table.
| 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. This is 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 and function-based indexes.
Allows you to create and drop indexes.
View management
Allows you to create simple and complex views.
Allows you to drop views.
Allows you to query views using the
SELECTstatement.Allows you to execute DML statements on views.
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 or 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, see Overview.
Allows you to use Network File System (NFS), Alibaba Cloud OSS, and Tencent Cloud COS as the backup destination.
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 to a specified local or remote path.
Does not support backup for some databases and tables within a tenant.
Does not support compression for log archives.
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 for 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.