OceanBase logo

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Resources

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS

OceanBase Cloud

OceanBase Database

Tools

Connectors and Middleware

QUICK START

OceanBase Cloud

OceanBase Database

BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Company

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

International - English
中国站 - 简体中文
日本 - 日本語
Sign In
Start on Cloud

OceanBase

A unified distributed database ready for your transactional, analytical, and AI workloads.

Product Overview
DEPLOY YOUR WAY

OceanBase Cloud

The best way to deploy and scale OceanBase

OceanBase Enterprise

Run and manage OceanBase on your infra

TRY OPEN SOURCE

OceanBase Community Edition

The free, open-source distributed database

OceanBase seekdb

Open source AI native search database

Customer Stories

Real-world success stories from enterprises across diverse industries.

View All
BY USE CASES

Mission-Critical Transactions

Global & Multicloud Application

Elastic Scaling for Peak Traffic

Real-time Analytics

Active Geo-redundancy

Database Consolidation

Comprehensive knowledge hub for OceanBase.

Blog

Live Demos

Training & Certification

Documentation

Official technical guides, tutorials, API references, and manuals for all OceanBase products.

View All
PRODUCTS
OceanBase CloudOceanBase Database
ToolsConnectors and Middleware
QUICK START
OceanBase CloudOceanBase Database
BEST PRACTICES

Practical guides for utilizing OceanBase more effectively and conveniently

Learn more about OceanBase – our company, partnerships, and trust and security initiatives.

About OceanBase

Partner

Trust Center

Contact Us

Start on Cloud
编组
All Products
    • Databases
    • iconOceanBase Database
    • iconOceanBase Cloud
    • iconOceanBase Tugraph
    • iconInteractive Tutorials
    • iconOceanBase Best Practices
    • Tools
    • iconOceanBase Cloud Platform
    • iconOceanBase Migration Service
    • iconOceanBase Developer Center
    • iconOceanBase Migration Assessment
    • iconOceanBase Admin Tool
    • iconOceanBase Loader and Dumper
    • iconOceanBase Deployer
    • iconKubernetes operator for OceanBase
    • iconOceanBase Diagnostic Tool
    • iconOceanBase Binlog Service
    • Connectors and Middleware
    • iconOceanBase Database Proxy
    • iconEmbedded SQL in C for OceanBase
    • iconOceanBase Call Interface
    • iconOceanBase Connector/C
    • iconOceanBase Connector/J
    • iconOceanBase Connector/ODBC
    • iconOceanBase Connector/NET
icon

OceanBase Database

SQL - V4.4.2

    Download PDF

    OceanBase logo

    The Unified Distributed Database for the AI Era.

    Follow Us
    Products
    OceanBase CloudOceanBase EnterpriseOceanBase Community EditionOceanBase seekdb
    Resources
    DocsBlogLive DemosTraining & CertificationTicket
    Company
    About OceanBaseTrust CenterLegalPartnerContact Us
    Follow Us

    © OceanBase 2026. All rights reserved

    Cloud Service AgreementPrivacy PolicySecurity
    Contact Us
    Document Feedback
    1. Documentation Center
    2. OceanBase Database
    3. SQL
    4. V4.4.2
    iconOceanBase Database
    SQL - V 4.4.2
    SQL
    KV
    • V 4.6.0
    • V 4.4.2
    • V 4.3.5
    • V 4.3.3
    • V 4.3.1
    • V 4.3.0
    • V 4.2.5
    • V 4.2.2
    • V 4.2.1
    • V 4.2.0
    • V 4.1.0
    • V 4.0.0
    • V 3.1.4 and earlier

    CREATE DATABASE LINK

    Last Updated:2026-04-02 06:23:58  Updated
    share
    What is on this page
    Purpose
    Syntax
    Considerations
    Examples
    References

    folded

    share

    Purpose

    This statement is used to create a dblink that accesses a specified remote database. The statement requires specifying the name of the dblink and providing the username, tenant name, password, IP address, port number, and access type of the remote database. For a reverse link, the username, tenant name, password, IP address, and port number of the local database are also required. If the access type is not specified, the dblink will default to accessing a remote OceanBase Database.

    If the remote database is an OceanBase Database, the IP address and port number can be those of an OBServer node in the specified OceanBase cluster or the IP address and port number of the Proxy of the OceanBase cluster. When the port number of the dblink is the port number of the Proxy and the Proxy is deployed via ConfigUrl, the cluster name must be specified. For reverse link functionality, the IP address and port number of an OBServer node in the local OceanBase cluster, along with the username, tenant name, and password, must also be provided.

    If the remote database is an Oracle database, the access type must be explicitly specified as OCI, and the oracle_sid must be provided. The tenant name must be oracle.

    Syntax

    CREATE DATABASE LINK dblink_name CONNECT TO user_name@tenant_name
        IDENTIFIED BY password_str [OB|OCI] HOST 'ip:port[/oracle_sid]' [CLUSTER cluster_name] [MY_NAME local_user_name@local_tenant_name
                IDENTIFIED BY local_password_str HOST 'local_ip:local_port'];
    
    

    Considerations

    Field
    Description
    dblink_name Specifies the name of the database link to be accessed.
    user_name Specifies the username of the remote database.
    tenant_name Specifies the tenant name of the remote database. If the remote database is an Oracle database, the tenant name is always oracle.
    password Specifies the login password for the username of the remote database. If the password contains special characters other than digits and letters (~!@#%^&*_-+=|(){}[]:;,.?/), double quotes must be used to enclose the password to avoid syntax errors.
    OB | OCI OB specifies the remote database type as OceanBase Database, and OCI specifies the access type as Oracle. If neither parameter is provided, the default remote database type is OceanBase Database.
    ip Specifies the IP address of the remote database. If the remote database is an OceanBase Database, the IP address can be that of the Proxy or an OBServer node in the cluster. If the IP address is specified as that of an OBServer node, the network between the local database and the specified OBServer node must be accessible.

    Note

    OceanBase Database also supports domain names as addresses. For example, example.com:port. You can use the appropriate domain name address to connect to the remote database based on your environment.

    port Specifies the port number of the remote database. If the remote database is an OceanBase Database, the port number can be that of the Proxy or an OBServer node in the cluster. If the port number is specified as that of an OBServer node, the network between the local database and the specified OBServer node must be accessible. If the remote database is an Oracle database, the IP address is that of the Oracle instance.
    oracle_sid The sid of the remote Oracle database. This parameter is required only when the remote database is an Oracle database.
    cluster_name The name of the remote OceanBase cluster. This parameter is required only when the IP address and port number are those of the Proxy, and the Proxy is deployed via ConfigUrl. The cluster name must be enclosed in double quotes.
    local_cluster_name The name of the local OceanBase cluster. This parameter is required only when the IP address and port number are those of the Proxy, and the Proxy is deployed via ConfigUrl. The cluster name must be enclosed in double quotes.
    local_user The username of the local database.
    local_tenant The tenant name of the local database.
    local_password The login password for the username of the local database. If the password contains special characters other than digits and letters (~!@#%^&*_-+=|(){}[]:;,.?/), double quotes must be used to enclose the password to avoid syntax errors.
    local_ip The IP address of an OBServer node in the local database cluster.
    local_port The port number of an OBServer node in the local database cluster.

    Examples

    Example 1: Create a dblink named ob_dblink_proxy to connect to a remote OceanBase Database. The tenant name is the default oracle. The Proxy is deployed via ConfigUrl. The cluster name must be enclosed in double quotes to prevent the cluster name from being capitalized.

    obclient> CREATE DATABASE LINK ob_dblink_proxy CONNECT TO ob_testuser@oracle IDENTIFIED BY **1** OB HOST  '10.XXX.XXX.XXX:30084' CLUSTER "ob***";
    Query OK, 1 row affected
    

    Example 2: Create a dblink named ob_dblink_reverse_link to connect to a remote OceanBase Database with a reverse link. The tenant name is oracle.

    obclient> CREATE DATABASE LINK ob_dblink_reverse_link CONNECT TO ob_testuser2@oracle IDENTIFIED BY **1** OB HOST '10.XXX.XXX.XXX:35305' MY_NAME local_ob_testuser@oracle identified by **2** host '10.XXX.XXX.XXX:35307';
    Query OK, 1 row affected
    

    Example 3: Create a dblink named orcl_dblink to connect to a remote Oracle database. The tenant name is oracle.

    obclient> CREATE DATABASE LINK orcl_dblink CONNECT TO orcl_testuser@oracle IDENTIFIED BY **1** OCI HOST '10.XXX.XXX.XXX:1521/ORCL';
    Query OK, 1 row affected
    

    References

    • View a DBLink
    • Manage DBLinks

    Previous topic

    CREATE DIRECTORY
    Last

    Next topic

    CREATE EXTERNAL TABLE
    Next
    What is on this page
    Purpose
    Syntax
    Considerations
    Examples
    References