All technological notes.
Oracle Net
Oracle uses 2 main files for network confguration:
listener.ora: which defines listeners.tnsname.ora: which defines the Net service names.
service name is valid then the Listener create Dedicated SP, else it will be Error. 监控只会检查服务名.initialization info to it.
initialization info includes user name and pwd for authentication.Instance Name:
INSTANCE_NAME initialization parameter.Default value:
Oracle system identifier (SID) of the database instance
- e.g.: sales and finance. (
us.example.comis the hostname)
instance.
instance name.instance name.DB_NAME and INSTANCE_NAME forms a unique identifier for an instance within a database.SHOW PARAMETER INSTANCE_NAME;
SELECT instance_name FROM v$isntacnes;

Oracle Real Application Clusters (Oracle RAC) allow multiple instances on different computers that share a single physical database.
Database Services
service name
SERVICE_NAMES initialization parameter in the server parameter file.global database name, a name comprising
database name (DB_NAME initialization parameter)domain name (DB_DOMAIN initialization parameter).database can have multiple service names.Associating multiple services with one database enables the following functionality:
listener using one or more service names.使用服务名注册实例For client:
SHOW PARAMETER service_names;
# orcl
SHOW PARAMETER db_name;
# com
SHOW PARAMETER db_domain;
# orcl.com
SELECT name FROM v$database;
# orcl.com
SELECT name FROM v$services;
# ORCL
SELECT * FROM GLOBAL_NAME;
# ORCL.COM



- Three Web browsers connecting to the same database server.
- two Web browsers are connecting to the
book.us.example.comservice.Here service name of the database is book, host name is us.example.- the other Web browser is connecting to the
soft.us.example.comservice. Here service name of the database is soft, host name is us.example.- Both services are associated with the same database.
无对应关系
service name can identify multiple database instancesinstance can belong to multiple services.
tnsname.ora: define a Net service named “orcl” using a descriptor, to map this “orcl” to a database with a service name “orcl.com”.- When client establish a connection using a connection string that contains this “orcl” net service, listener will map this request to the database with a service name “orcl.com”.
listener registration process (LREG) registers information about the database instance and dispatcher processes with the Oracle Net Listener.connect descriptor
Components
host name or IP addressOracle Listener is listening for incoming connection requests.1521.listener.ora file.TCP/IP or IPC (Inter-Process Communication).Use case:
tnsnames.ora filetnsnames.ora filesales-server/sales.us.example.com
sales.us.example.comsales-serverdefault port: 1521
the entry in the tnsnames.ora file for the preceding Easy Connect connect descriptor and database service
(DESCRIPTION=
(ADDRESS=(PROTOCOL=tcp)(HOST=sales-server)(PORT=1521))
(CONNECT_DATA=
(SERVICE_NAME=sales.us.example.com)))
connect string
connect identifier can be
connect descriptorconnect descriptor.Example
# 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)))
# connect identifiers is a network service name, a simple name for a service.
# uses network service name sales as the connect identifier
# connection processing takes place by first mapping sales to the connect descriptor.
CONNECT hr@sales
naming method
connect identifier to a connect descriptor when attempting to connect to a database service.connect identifier to a connect desriptor. 如何将 map 信息存储的方法.Local naming:
tnsnames.oraDirectory naming:
Easy Connect naming:
Easy Connect Plus naming
Centralized Configuration Provider naming:
Easy Connect naming:
local naming:
directory naming:
local naming method.connect descriptors to the names or to a connect identifier.connect identifier.connect identifier is resolved to a connect descriptor by a naming method.connect descriptor.listener receives the request and directs it to the appropriate database server.database server.tnsnames.oralocal naming
tnsnames.ora file on the clients.localized management is used, network computers are configured with the files:| File | Locate | Description |
|---|---|---|
tnsnames.ora |
clients | Contain mapping info. local naming method. |
sqlnet.ora |
client+db server | Contain Client domain, Order of naming methods, Logging and tracing features, Route of connections, External naming parameters, security parameters, and Database access control parameters |
listener.ora |
db server | Contain Protocol addresse, listening services, Control parameters |
cman.ora |
computer where Oracle Connection Manager runs | Contain listening endpoint, Access control rule list,Parameter list |
Typical path of Configuration files:
$ORACLE_HOME/network/adminORACLE_BASE_HOME/network/admin for a read-only Oracle homeOracle Net checks the other directories for the configuration files.
$TNS_ADMIN environment variable.$ORACLE_HOME/network/admin environment variable;$ORACLE_BASE_HOME/network/admin$ORACLE_HOME/network/admin