Note
This view is available starting with V4.2.0.
Purpose
This view displays all DBLinks created in the current tenant.
Columns
| Column | Type | Nullable | Description |
|---|---|---|---|
| OWNER | varchar(128) | NO | The username of the user who created the DBLink. |
| DB_LINK | varchar(128) | NO | The name of the DBLink. |
| USERNAME | varchar(128) | NO | The username used to connect to the remote database. |
| CREDENTIAL_NAME | varchar(128) | NO | The name of the credentials used to connect to the remote database. This parameter is for compatibility. |
| CREDENTIAL_OWNER | varchar(128) | NO | The owner of the credentials used to connect to the remote database. This parameter is for compatibility. |
| HOST | text | YES | The host name (IP address) used to connect to the remote database. |
| CREATED | datetime | NO | The time when the DBLink was created. |
| HIDDEN | varchar(3) | NO | A reserved parameter for internal use. This parameter is for compatibility. |
| SHARD_INTERNAL | varchar(3) | NO | A reserved parameter for internal use. This parameter is for compatibility. |
| VALID | varchar(3) | NO | A reserved parameter for internal use. This parameter is for compatibility. The default value is YES. |
| INTRA_CDB | varchar(3) | NO | A reserved parameter for internal use. This parameter is for compatibility. |
| TENANT_NAME | varchar(128) | NO | The name of the tenant used to connect to the remote database. |
| DATABASE_NAME | varchar(128) | YES | The name of the remote database to which the DBLink connects. |
| REVERSE_TENANT_NAME | varchar(128) | YES | The name of the tenant used to connect to the local database for a reverse DBLink. |
| CLUSTER_NAME | varchar(128) | YES | The name of the cluster used to connect to the remote database. |
| REVERSE_CLUSTER_NAME | varchar(128) | YES | The name of the cluster used to connect to the local database for a reverse DBLink. |
| REVERSE_HOST | text | YES | The host name (IP address) used to connect to the local database for a reverse DBLink. |
| REVERSE_PORT | bigint(20) | YES | The port number used to connect to the local database for a reverse DBLink. |
| REVERSE_USERNAME | VARCHAR2(128) | YES | The username used to connect to the local database for a reverse DBLink. |
Sample query
Query the DBLinks created in the current user tenant.
obclient [oceanbase]> SELECT * FROM oceanbase.DBA_DB_LINKS;
The query result is as follows:
+--------+-----------+----------+-----------------+------------------+---------------------+---------------------+--------+----------------+-------+-----------+-------------+---------------+---------------------+--------------+----------------------+--------------+--------------+
| OWNER | DB_LINK | USERNAME | CREDENTIAL_NAME | CREDENTIAL_OWNER | HOST | CREATED | HIDDEN | SHARD_INTERNAL | VALID | INTRA_CDB | TENANT_NAME | DATABASE_NAME | REVERSE_TENANT_NAME | CLUSTER_NAME | REVERSE_CLUSTER_NAME | REVERSE_HOST | REVERSE_PORT |
+--------+-----------+----------+-----------------+------------------+---------------------+---------------------+--------+----------------+-------+-----------+-------------+---------------+---------------------+--------------+----------------------+--------------+--------------+
| PUBLIC | ob_dblink | test | | | xx.xx.xx.xx:2881 | 2023-05-25 13:40:35 | | | YES | | mysql001 | mydb | | | | 0.0.0.0 | 0 |
+--------+-----------+----------+-----------------+------------------+---------------------+---------------------+--------+----------------+-------+-----------+-------------+---------------+---------------------+--------------+----------------------+--------------+--------------+
1 row in set