All technological notes.
tnsnames.ora File
connection string containing a tnsname.tnsname.ora to find the detail information about the connect descriptor, specially the host name and the service name. Then, the information will be sent to the Oracle listener.Oracle listener will check whether the information is a valid.Oracle listener will create a server process to deal with the Oracle instance and database.server process is responsible for all the client requests.server process is created by Oracle Listener, there is no need for Oracle Listener.
tnsnames.ora Filetnsnames.ora
net service names mapped to connect descriptors for establishing connections to Oracle databases.Oracle client will need to know the following:
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
# Lo
LISTENER_ORCL =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.com)(PORT = 1521))
ORCL =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orcl.com)
)
)
#################################################
# LISTENER_ORCL: local listener
# ORCL: A TNS name entry
#################################################
# ADDRESS section
# PROTOCOL parameter: identifies the listener protocol address
# HOST parameter: identifies the host name.
# PORT parameter: identifies the port. Default = 1521
# HTTPS_PROXY and HTTPS_PROXY_PORT parameters:
# Optional, allow the database client connection to traverse through the organization’s forward web proxy.
# applicable only to the connect descriptors where PROTOCOL=TCPS.
#################################################
# CONNECT_DATA section:
# SID parameter: identifies the system identifier (SID) of the Oracle database.
# SERVICE_NAME parameter identifies the service. SERVICE_NAMES initialization parameter, typically the global database name
# INSTANCE_NAME parameter optional, identifies the database instance. useful for an Oracle RAC configuration
# SERVER parameter identifies the service handler type.
# DEDICATED, default value. a dedicated server process is assigned to each user session, providing isolation and dedicated resources for that connection.
# SHARED, multiple client connections share a common server process.
# POOLED, typically associated with Oracle Connection Manager. The pool contains shared server processes that are dynamically allocated to client connections as needed.
-- Command uses a connect string that has a complete connect descriptor as the connect identifier instead of a network service name.
CONNECT hr@(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server1)
(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales.us.example.com)))
-- command uses a connect string that uses network service name sales as the connect identifier
CONNECT hr@sales
CONNECT hr/password@sales # here sales represent the tnsname entry in the client machine.
CONNECT username@connect_identifier
Default Connect Identifier
TWO_TASK environment variableLOCAL environment variableTWO_TASK = salesCONNECT username = CONNECT username@salesConnect identifiers used in a connect string cannot contain spaces unless enclosed within single quotation marks (‘) or double quotation marks (“).
CONNECT scott@'(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)
(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=sales.us.example.com)))'
CONNECT scott@'cn=sales, cn=OracleContext, dc=us, dc=example, dc=com'
CONNECT scott@'sales@"good"example.com'
CONNECT scott@"cn=sales, cn=OracleContext, ou=Mary's Dept, o=example"
tnsname.ora to connect with database.


tnsname.ora fileORCLPDB =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = test.com)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = orclpdb.com)
)
)
sqlplus / as sysdba
show pdbs; # confirm the pdb is open
ALTER PLUGGABLE DATABASE orclpdb OPEN; # open target pdb
CONNECT sys/pwd@orclpdb AS SYSDBA; # connect to pdb
show con_name # confirm it is in the pdb

Actually, tns name can be used in the client side.



unknow reason cannot load tns names. Skip
