All Products
Search
Document Center

Create database links

Last Updated: Jun 18, 2021

To reference an object in a database other than the local database, specify the name of the database link that points to the desired database after the object name. A database link is a schema object that enables ApsaraDB for OceanBase to connect to a remote database and access the objects in the remote database.

You can use the CREATE DATABASE LINK statement to create a database link. When you use this statement, you must specify the following database link information:

  • The tenant name, username, and password.

  • The network address and port number.

ApsaraDB for OceanBase stores the preceding information in a data dictionary.

Limits on creating links

  1. You can only create database links to connect an Oracle tenant to another Oracle tenant in ApsaraDB for OceanBase. Currently, ApsaraDB for OceanBase does not allow you to create a link that connect an ApsaraDB for OceanBase database to an external Oracle database.

  2. A tenant can create and delete database links for multiple times. However, a maximum of 15 database links are allowed under a tenant at the same time.

Format of database connection strings

user_name@tenant_name IDENTIFIED BY password HOST 'ip:port'
  • user_name: The username.
  • tenant_name: The tenant name.
  • password: The password.
  • ip: The network address.
  • port: The port number.

For example, you can execute the following statement to create a database link:

CREATE DATABASE LINK my_link CONNECT TO 
root@oracle  IDENTIFIED BY abcdef HOST '192.168.0.0:1521';