170 DBMS_TNS
The DBMS_TNS
package provides the RESOLVE_TNSNAME
function to resolve a TNS name and return the corresponding Oracle Net8 connection string.
This chapter contains the following topics:
170.1 DBMS_TNS Overview
The DBMS_TNS
package contains one function, RESOLVE_TNSNAME
, which returns the resolved connect string from configured sources that have been defined in the names.directory_path
parameter in the sqlnet.ora
file.
The RESOLVE_TNSNAME
function in this package helps you to identify interconnected databases and trace the system change number (SCN) flow across distributed databases.
See Also:
-
Oracle Database Administrator’s Guide for more information about finding database link information
-
Oracle Database Reference for information about the
ALL_DB_LINKS
data dictionary view
170.3 Summary of DBMS_TNS Subprograms
This table lists the DBMS_TNS
subprograms and briefly describes them.
Table 170-1 DBMS_TNS Parameters
Subprogram | Description |
---|---|
Returns the resolved connect string from any configured source (tnsnames, LDAP, Easy Connect) as indicated in the |
170.3.1 RESOLVE_TNSNAME Function
This function returns the resolved connect string from any configured source (for example, TNS names, Lightweight Directory Access Protocol (LDAP), or Oracle Easy Connect) as indicated in the sqlnet.ora
names.directory_path
parameter.
Syntax
DBMS_TNS.RESOLVE_TNSNAME ( tns_name VARCHAR2) RETURN VARCHAR2;
RESOLVE_TNSNAME Function Parameters
Parameter | Description |
---|---|
|
Database address for establishing the connection |
Usage Notes
-
Database administrators and system management tools can explicitly call the
DBMS_TNS.RESOLVE_TNSNAME function
to resolve atns_name
: -
Because the resolved value can change over time, Oracle does not recommend storing or caching this value, because these kinds of values can become invalid over time.
-
You can use the
DBMS_TNS.RESOLVE_TNSNAME
function to resolve TNS names that were referred to by other data dictionary views such asALL_DB_LINKS
andUSER_DB_LINKS
. In addition, you can use it to find any TNS name entry in thetnsnames.ora
file.
Example
SELECT DB_LINK, DBMS_TNS.RESOLVE_TNSNAME(HOST) FROM DBA_DB_LINKS;
DB_LINK
--------------------------------------------------------------------------------
DBMS_TNS.RESOLVE_TNSNAME(HOST)
--------------------------------------------------------------------------------
US.EXAMPLE.COM
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=may))(CONNECT_DATA=(SERVICE_NAME=us.example.com)(CID=(PROGRAM=oracle)(HOST=juno)(USER=psmith))
))