After creating a DBLink, you can view its information through a view, including the user who created the database link, the database link name, and the IP address and port number of the remote database.
Procedure
After a DBLink is successfully created, you can view the created DBLink through the DBA_DB_LINKS view.
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
Some fields in the query result are described as follows:
OWNER: The owner of the DBLink. Currently, all DBLinks arePUBLIC, meaning they are available to all users within the tenant.DB_LINK: The name of the created DBLink.USERNAME: The username used by the DBLink to connect to the remote database.HOST: The hostname (IP address) of the remote database connected by the DBLink.CREATED: The creation time of the DBLink.VALID: Indicates whether the DBLink is available. This field is for compatibility only and defaults toYES.TENANT_NAME: The tenant name used by the DBLink to connect to the remote database.DATABASE_NAME: The name of the remote database connected by the DBLink.REVERSE_TENANT_NAME: The tenant name used by the reverse DBLink to connect to the local database. The reverse link feature is not currently supported.CLUSTER_NAME: The cluster name used by the DBLink to connect to the remote database.REVERSE_CLUSTER_NAME: The cluster name used by the reverse DBLink to connect to the local database. The reverse link feature is not currently supported.REVERSE_HOST: The hostname (IP address) of the local database connected by the reverse DBLink. If the current DBLink does not have the reverse link feature, this field displays0.0.0.0. The reverse link feature is not currently supported.REVERSE_PORT: The port number of the local database connected by the reverse DBLink. If the current DBLink does not have the reverse link feature, this field displays0. The reverse link feature is not currently supported.
For more information about the fields in the DBA_DB_LINKS view, see oceanbase.DBA_DB_LINKS.
References
For more operations related to DBLinks, see the following topics: