You can query information about existing DBLinks from views.
Procedure
After you create a DBLink, you can query the DBA_DB_LINKS, ALL_DB_LINKS, or USER_DB_LINKS view for its information.
SELECT * FROM SYS.USER_DB_LINKS;
The query result is as follows:
+-----------+----------+----------+-----------------+------------------+---------------------+-----------+--------+----------------+-------+-----------+-------------+---------------------+--------------+----------------------+--------------+--------------+------------------+
| DB_LINK | USERNAME | PASSWORD | CREDENTIAL_NAME | CREDENTIAL_OWNER | HOST | CREATED | HIDDEN | SHARD_INTERNAL | VALID | INTRA_CDB | TENANT_NAME | REVERSE_TENANT_NAME | CLUSTER_NAME | REVERSE_CLUSTER_NAME | REVERSE_HOST | REVERSE_PORT | REVERSE_USERNAME |
+-----------+----------+----------+-----------------+------------------+---------------------+-----------+--------+----------------+-------+-----------+-------------+---------------------+--------------+----------------------+--------------+--------------+------------------+
| OB_DBLINK | SYS | NULL | NULL | NULL | xx.xx.xx.xx:2881 | 22-MAY-23 | NULL | NULL | YES | NULL | oracle001 | NULL | NULL | NULL | 0.0.0.0 | 0 | NULL |
+-----------+----------+----------+-----------------+------------------+---------------------+-----------+--------+----------------+-------+-----------+-------------+---------------------+--------------+----------------------+--------------+--------------+------------------+
1 row in set
Columns in the query result are described as follows:
DB_LINK: the name of the DBLink.USERNAME: the username used to connect to the remote database by using the DBLink.HOST: the hostname (or IP address) used to connect to the remote database by using the DBLink.CREATED: the time when the DBLink was created.VALID: indicates whether the DBLink is available. This field is used only for compatibility. The default value isYES.TENANT_NAME: the tenant name used to connect to the remote database by using the DBLink.REVERSE_HOST: the hostname (or IP address) used to connect to the local database from the remote database by using the DBLink. If the current DBLink does not support the reverse link feature, the value is0.0.0.0.REVERSE_PORT: the port number used to connect to the local database from the remote database by using the DBLink. If the current DBLink does not support the reverse link feature, the value is0.REVERSE_USERNAME: the username used to connect to the local database from the remote database by using the DBLink. If the current DBLink does not support the reverse link feature, the value isNULL.
References
For more information about operations on DBLinks, see the following topics: