in its most basic form ,Oracle uses threes files(listneres.ora ,tnsnames.ora,sqlnet.ora) for network configuration.
1 listener.ora. this file contains the server side parameters configuration
2 tnsnames.ora,sqlnet.ora this file contains the client side parameters configuration
Assumptions
The example files below are relevant for an Oracle installation and instance with the following values:
Parameter Value
HOST hostname
ORACLE_HOME C:\Oracle\817
ORACLE_SID ORCL
DOMAIN world
Listener.ora
The listerner.ora file contains server side network configuration parameters. It can be found in the ORACLE_HOME/network/admin directory on the server. Here is an example of a listener.ora file from Windows 2000:
# LISTENER.ORA Network Configuration File: C:\Oracle\817\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
)
(DESCRIPTION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 2481))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\Oracle\817)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL.WORLD)
(ORACLE_HOME = C:\Oracle\817)
(SID_NAME = ORCL)
)
)
After the listener.ora file is amended the listener should be restarted or reloaded to allow the new configuation to take effect:
C:> lsnrctl stop
C:> lsnrctl start
C:> lsnrctl reload
Tnsnames.ora
The tnsnames.ora file contains client side network configuration parameters. It can be found in the ORACLE_HOME/network/admin or ORACLE_HOME/net80/admin directory on the client. This file will also be present on the server if client style connections are used on the server itself. Here is an example of a tnsnames.ora file from Windows 2000:
# TNSNAMES.ORA Network Configuration File: C:\Oracle\817\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL.WORLD)
)
)
INST1_HTTP.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = MODOSE)
(PRESENTATION = http://admin)
)
)
EXTPROC_CONNECTION_DATA.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
Sqlnet.ora
The sqlnet.ora file contains client side network configuration parameters. It can be found in the ORACLE_HOME/network/admin or ORACLE_HOME/net80/admin directory on the client. This file will also be present on the server if client style connections are used on the server itself. Here is an example of an sqlnet.ora file from Windows 2000:
# SQLNET.ORA Network Configuration File: C:\Oracle\817\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
NAMES.DEFAULT_DOMAIN = WORLD
Testing
1 listener.ora. this file contains the server side parameters configuration
2 tnsnames.ora,sqlnet.ora this file contains the client side parameters configuration
Assumptions
The example files below are relevant for an Oracle installation and instance with the following values:
Parameter Value
HOST hostname
ORACLE_HOME C:\Oracle\817
ORACLE_SID ORCL
DOMAIN world
Listener.ora
The listerner.ora file contains server side network configuration parameters. It can be found in the ORACLE_HOME/network/admin directory on the server. Here is an example of a listener.ora file from Windows 2000:
# LISTENER.ORA Network Configuration File: C:\Oracle\817\network\admin\listener.ora
# Generated by Oracle configuration tools.
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
)
(DESCRIPTION =
(PROTOCOL_STACK =
(PRESENTATION = GIOP)
(SESSION = RAW)
)
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 2481))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = C:\Oracle\817)
(PROGRAM = extproc)
)
(SID_DESC =
(GLOBAL_DBNAME = ORCL.WORLD)
(ORACLE_HOME = C:\Oracle\817)
(SID_NAME = ORCL)
)
)
After the listener.ora file is amended the listener should be restarted or reloaded to allow the new configuation to take effect:
C:> lsnrctl stop
C:> lsnrctl start
C:> lsnrctl reload
Tnsnames.ora
The tnsnames.ora file contains client side network configuration parameters. It can be found in the ORACLE_HOME/network/admin or ORACLE_HOME/net80/admin directory on the client. This file will also be present on the server if client style connections are used on the server itself. Here is an example of a tnsnames.ora file from Windows 2000:
# TNSNAMES.ORA Network Configuration File: C:\Oracle\817\network\admin\tnsnames.ora
# Generated by Oracle configuration tools.
ORCL.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = ORCL.WORLD)
)
)
INST1_HTTP.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = hostname)(PORT = 1521))
)
(CONNECT_DATA =
(SERVER = SHARED)
(SERVICE_NAME = MODOSE)
(PRESENTATION = http://admin)
)
)
EXTPROC_CONNECTION_DATA.WORLD =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
Sqlnet.ora
The sqlnet.ora file contains client side network configuration parameters. It can be found in the ORACLE_HOME/network/admin or ORACLE_HOME/net80/admin directory on the client. This file will also be present on the server if client style connections are used on the server itself. Here is an example of an sqlnet.ora file from Windows 2000:
# SQLNET.ORA Network Configuration File: C:\Oracle\817\network\admin\sqlnet.ora
# Generated by Oracle configuration tools.
SQLNET.AUTHENTICATION_SERVICES= (NTS)
NAMES.DIRECTORY_PATH= (TNSNAMES, ONAMES, HOSTNAME)
NAMES.DEFAULT_DOMAIN = WORLD
Testing
本文介绍了Oracle数据库中三种关键网络配置文件:listener.ora、tnsnames.ora 和 sqlnet.ora 的用途及示例。listener.ora 负责服务器端参数配置,tnsnames.ora 和 sqlnet.ora 则负责客户端参数配置。文章提供了具体配置示例,并说明了如何应用这些更改。
3625

被折叠的 条评论
为什么被折叠?



