You can query information about existing DBLinks from views.
Procedure
You can query the DBA_DB_LINKS, ALL_DB_LINKS, and USER_DB_LINKS views for information about 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
where:
DB_LINKindicates the name of the DBLink.USERNAMEindicates the username used to connect to the remote database by using the DBLink.HOSTindicates the hostname (or IP address) used to connect to the remote database by using the DBLink.CREATEDindicates the time when the DBLink was created.VALIDindicates whether the DBLink is available. This field is used only for compatibility. The default value isYES.TENANT_NAMEindicates the tenant name used to connect to the remote database by using the DBLink.REVERSE_HOSTindicates 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_PORTindicates 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_USERNAMEindicates 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.
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: