This topic describes the compatibility between OceanBase Database in Oracle mode and native Oracle Database.
OceanBase Database is compatible with Oracle Database in data types, SQL features, and database objects. It is also compatible with most PL/SQL features. OceanBase Database is also compatible with advanced features such as database security, backup and restore, high availability, and the optimizer. In some cases, OceanBase Database outperforms Oracle Database. This means that you can smoothly migrate from Oracle Database to OceanBase Database without spending a lot of time learning new features.
However, OceanBase Database is not compatible with some features of Oracle Database. This is because OceanBase Database and Oracle Database differ in architecture and product form. This topic describes the compatibility between OceanBase Database and Oracle Database in the following aspects:
SQL data types
Built-in functions
SQL syntax
PL/SQL
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.
Considering optimization, the LONG and LONG RAW data types are too outdated and OceanBase Database does not plan 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 syntax
OceanBase Database supports most of the SQL syntax supported by Oracle Database. If a feature is not supported, an error will be returned.
SELECT
Supports most query features, including single-table and multi-table queries, subqueries, inner joins, semi-joins, outer joins, grouping, 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 the
EXPLAINsyntax to view the execution plan.
INSERT
Supports inserting single rows and multiple rows of data, and supports inserting data into specified partitions.
Supports the
INSERT INTO ... SELECT ...statement.Supports inserting data into single tables and multi-tables.
UPDATE
Supports updating data in single columns and multiple columns.
Supports updating data using subqueries.
Supports set-based updates.
DELETE
- Supports deleting data from single tables and multi-tables.
TRUNCATE
- Supports truncating specified tables.
Parallel queries
Supports parallel queries similar to those in Oracle Database.
OceanBase Database supports the Auto DOP feature and also allows you to manually specify the DOP using
Hint/Sessionvariables.Supports parallel DML operations.
Hint
OceanBase Database supports the Hint syntax. For more information about Hints, see Hint.
Materialized views
CREATE MATERIALIZED VIEW(create a materialized view).DROP MATERIALIZED VIEW(drop a materialized view).
Materialized view logs
CREATE MATERIALIZED VIEW LOG(create a materialized view log).Note
In OceanBase Database, the
with_clause(such asPRIMARY KEY,ROWID, andSEQUENCE) of theCREATE MATERIALIZED VIEW LOGsyntax has a different default behavior from that in Oracle Database.DROP MATERIALIZED VIEW LOG(drop a materialized view log).
Materialized views
- In the
CREATE MATERIALIZED VIEW(create a materialized view) syntax, theON COMMITandON STATEMENTrefresh modes are not supported. - In the
DROP MATERIALIZED VIEW(drop a materialized view) syntax, thePRESERVE TABLEclause is not supported.
Materialized view logs
In the
CREATE MATERIALIZED VIEW LOG(create a materialized view log) syntax:- The
ASYNCHRONOUSclause is not supported. - An error will be returned if you use the
EXCLUDING NEW VALUESclause. - Partitions are not supported.
- The
PL/SQL
OceanBase Database is compatible with most of the PL features supported by Oracle Database. For more information about PL features, see PL reference.
OceanBase Database supports the following PL features:
Data types
Control flow
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.
The behavior of the NOCOPY parameter in OceanBase Database is different from that in Oracle Database:
For basic data types and complex data types with the OUT attribute, the reference passing behavior in Oracle Database is not supported.
For complex data types with the IN OUT attribute, the reference passing behavior in Oracle Database is supported.
OceanBase Database does not support the following PL feature:
- Conditional compilation
System views
OceanBase Database is compatible with some system views supported by Oracle Database. For more information about the compatible views, see System views. For more information about the fields of system views, see Overview of system views.
Character sets
The following character sets are supported in OceanBase Database in Oracle mode:
- 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 OceanBase Database in Oracle mode.
| Collation | Description |
|---|---|
| utf8mb4_general_ci | Uses the general collation rules. |
| utf8mb4_bin | Uses the binary collation rules. |
| utf8mb4_unicode_ci | Uses the Unicode Collation Algorithm (UCA) based collation rules. |
| binary | Uses the binary collation rules. |
| gbk_chinese_ci | Uses the Chinese language collation rules. |
| gbk_bin | Uses the binary collation rules. |
| utf16_general_ci | Uses the general collation rules. |
| utf16_bin | Uses the binary collation rules. |
| utf16_unicode_ci | Uses the Unicode Collation Algorithm (UCA) based collation rules. |
| gb18030_chinese_ci | Uses the Chinese language collation rules. |
| gb18030_bin | Uses the binary collation rules. |
| latin1_swedish_ci | Uses the Swedish/Finnish language collation rules. |
| latin1_german1_ci | Uses the collation rules for the Latin-1 character set in the German language environment. |
| latin1_danish_ci | Uses the collation rules for the Latin-1 character set in the Danish language environment. |
| latin1_german2_ci | Uses the collation rules for the German language environment, which are suitable for applications that require character comparisons in dictionary order. |
| latin1_general_ci | Uses the collation rules for scenarios that require case-insensitive comparisons and support accented characters, such as in the design of databases for certain European languages. |
| latin1_general_cs | Uses the case-sensitive collation rules for multiple languages (such as Western European languages). |
| latin1_spanish_ci | Uses the collation rules for the Spanish language environment. |
| latin1_bin | Uses the binary collation rules for the Latin-1 character set. |
| gb18030_2022_bin | Uses the binary collation rules. It is the default collation for the gb18030_2022 character set in Oracle mode. |
| gb18030_2022_chinese_ci | Uses the pinyin-based collation rules. It is case-insensitive. |
| gb18030_2022_chinese_cs | Uses the pinyin-based collation rules. It is case-sensitive. |
| gb18030_2022_radical_ci | Uses the radical-stroke-based collation rules. It is case-insensitive. |
| gb18030_2022_radical_cs | Uses the radical-stroke-based collation rules. It is case-sensitive. |
| gb18030_2022_stroke_ci | Uses the stroke-based collation rules. It is case-insensitive. |
| gb18030_2022_stroke_cs | Uses the stroke-based collation rules. It is case-sensitive. |
| ascii_bin | Uses the binary collation rules. |
| ascii_general_ci | Uses the case-insensitive collation rules based on letters. It ignores the case of characters and treats uppercase and lowercase letters as the same character. |
| tis620_bin | Uses the binary collation rules. |
| tis620_thai_ci | Uses the Thai language collation rules. It is case-insensitive. |
| gb2312_chinese_ci | Uses the GB2312 character set and the case-insensitive collation rules for Chinese. |
| gb2312_bin | Uses the GB2312 character set and the case-sensitive collation rules. |
| eucjpms_japanese_ci | Uses the EUCJPMS character set and the case-insensitive collation rules for Japanese. |
| eucjpms_bin | Uses the EUCJPMS character set and the case-sensitive collation rules. |
| macroman_general_ci | Uses the MacRoman character set and the case-insensitive collation rules. |
| macroman_bin | Uses the MacRoman character set and the case-sensitive collation rules. |
Database object management
Table management
Create tables: You can create tables and specify partitioning and constraints when you create a table. For more information about the syntax of the CREATE TABLE statement, 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 more information about the syntax of the ALTER TABLE statement, see ALTER TABLE.Drop base tables: You can drop a table and drop the constraints that are associated with the table. For more information about the syntax of the DROP TABLE statement, see DROP TABLE.
Constraints
The
CHECK,UNIQUE, andNOT NULLconstraints are supported.The
PRIMARY KEYconstraint is supported.The
FOREIGN KEYconstraint is supported.You can use the
ALTER TABLEstatement to add theCHECK,PRIMARY KEY,FOREIGN KEY, andNOT NULLconstraints.The
SET NULLoption is supported in cascading operations.
Partitioning
First-level partitioning, templated second-level partitioning, and non-templated second-level partitioning are supported.
Hash, range, list, and composite partitioning are supported.
Local and global indexes are supported.
For partition maintenance operations:
You can add, drop, and truncate first-level partitions in a first-level partitioned table.
You can add and drop first-level partitions in a templated second-level partitioned table. You can add, drop, and truncate first-level partitions, and add, drop, and truncate second-level partitions in a non-templated second-level partitioned table.
For more information about partitions, see Partition overview.
Index management
Only B-tree indexes, function indexes, and spatial indexes are supported in OceanBase Database.
You can create and drop indexes.
View management
You can create simple or complex views.
You can drop views.
You can use the
SELECTstatement.You can use DML statements.
Sequence management
You can create sequences.
You can modify sequences, including resetting the sequence value.
You can drop sequences.
Synonyms
You can create synonyms for tables, views, synonyms, and sequences.
You can create public synonyms.
Trigger management
You can create triggers.
You can modify triggers.
You can drop triggers.
Database links
You can read from and write to OceanBase Database from OceanBase Database.
You can read from and write to Oracle Database from OceanBase Database.
Constraints
- The
DISABLEoperation on theUNIQUEconstraint is not supported.
Partitioning
- You cannot add or drop second-level partitions in a templated second-level partitioned table.
Index management
- Bitmap and reverse indexes are not supported.
- During the index rebuild by using the UPDATE GLOBAL INDEX statement, the index is unavailable.
Updatable views
The WITH CHECK OPTION clause is not supported.
Security features
OceanBase Database implements a variety of security features.
Privilege management
Most system privileges of Oracle Database are supported. For more information about the privileges supported by OceanBase Database in Oracle mode, see Privilege classification in Oracle mode.
Common object privilege management is supported, such as granting and revoking privileges.
A whitelist strategy is supported to implement network security access control.
System predefined roles and user-defined roles are supported.
User authentication
The password policy of Oracle Database is supported in Oracle mode.
User lock and unlock are supported.
Transparent data encryption
The transparent data encryption (TDE) feature of Oracle Database is supported. Data is automatically encrypted before being written to storage devices and automatically decrypted when read.
Audit
Standard audit of Oracle Database is supported.
Statement and object audit types are supported.
Object audit is supported only for tables, sequences, functions, and packages.
Audit results can be stored in files or internal tables.
System views related to audit are supported.
Label security
The label security feature of Oracle Database is supported.
The Level dimension is supported.
Transport layer security (TLS) encryption
TLS encryption is supported for data transmission between the client and OceanBase Database server, and between OceanBase Database nodes.
In addition to supporting single-way SSL authentication and X.509 two-way authentication, special two-way authentication is supported, such as specifying the encryption algorithm, the issuer authentication, and the SSL subject authentication.
Audit
Unified audit and fine-grained audit (FGA) are not supported.
Privilege audit and network audit are not supported.
Audit data cannot be modified, overwritten, or deleted.
Label security
- The Compartment and Group dimensions are not supported.
Backup and recovery
OceanBase Database provides backup and recovery features. For more information about the physical backup and recovery features of OceanBase Database, see Backup and recovery overview.
You can use Network File System (NFS), Alibaba Cloud Object Storage Service (OSS), Amazon Web Services (AWS) Simple Storage Service (S3), and object storage services that are compatible with the S3 protocol (such as Huawei Object Storage Service (OBS), Google Cloud Storage (GCS), and Tencent Cloud Object Storage (COS)) as backup media.
You can automatically or manually clean up backups.
You can clean up specified backups or archives.
You can perform backup and recovery at the tenant level.
You can perform database-level and table-level recovery.
You can perform recovery by specifying a path.
You can archive logs and verify backup data.
You cannot perform backup and recovery at the cluster level.
You cannot perform table-level backup.
You cannot compress archived logs.
You cannot perform backup by specifying a path.
You cannot perform 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.
Query rewriting is supported.
Precompiled statements are supported.
Cost-based optimizer is supported.
Execution plan generation and display (
EXPLAIN) are supported.Execution plan caching is supported.
Fast parameterization of execution plans is supported.
Execution plan binding is supported.
Optimizer hints are supported.
Adaptive cursor sharing (ACS) is supported.
Execution plan management (SPM) is supported.
Estimators are not supported.
Execution plan isolation is not supported.
Expression statistics storage (ESS) is not supported.
Approximate query processing is not supported.
