You can query information about existing DBLinks from views.
Procedure
After a DBLink is created, you can query the DBA_DB_LINKS, ALL_DB_LINKS, and USER_DB_LINKS views for information about created DBLinks.
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
The following describes the fields in the query results:
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 that the DBLink connects to.CREATED: the creation time of the DBLink.VALID: indicates whether the DBLink is available. This field is for compatibility only. The default value isYES.TENANT_NAME: the tenant name used by the DBLink to connect to the remote database.REVERSE_HOST: the hostname (IP address) of the local database that the reverse DBLink connects to. If the current DBLink does not support the reverse link feature, the value is0.0.0.0.REVERSE_PORT: the port number of the local database that the reverse DBLink connects to. If the current DBLink does not support the reverse link feature, the value is0.REVERSE_USERNAME: the username used by the reverse DBLink to connect to the local database. If the current DBLink does not support the reverse link feature, the value isNULL.
For more information about fields in the DBA_DB_LINKS, ALL_DB_LINKS, and USER_DB_LINKS views, see DBA_DB_LINKS, ALL_DB_LINKS, and USER_DB_LINKS.
References
For more information about operations on DBLinks, see the following topics: