oracle TNSnames.ora

1. location of  TNSnames.ora

C:\app\dingl\product\11.2.0\client_1\network\admin\tnsnames.ora

2. Use of the TNSnames.ora

Oracle provides a utility called tnsping:

the rest commands like sqlplus/sqlldr all use it.

R:\>tnsping someconnection

TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20
08 10:38:07

Copyright (c) 1997 Oracle Corporation.  All rights reserved.

Used parameter files:
C:\Oracle92\network\ADMIN\sqlnet.ora
C:\Oracle92\network\ADMIN\tnsnames.ora

TNS-03505: Failed to resolve name

R:\>


R:\>tnsping entpr01

TNS Ping Utility for 32-bit Windows: Version 9.0.1.3.1 - Production on 27-AUG-20
08 10:39:22

Copyright (c) 1997 Oracle Corporation.  All rights reserved.

Used parameter files:
C:\Oracle92\network\ADMIN\sqlnet.ora
C:\Oracle92\network\ADMIN\tnsnames.ora

Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (COMMUNITY = **)
 (PROTOCOL = TCP) (Host = ****) (Port = 1521))) (CONNECT_DATA = (SID = ENTPR0
1)))
OK (40 msec)

R:\>

This should show what file you're using. The utility sits in the Oracle bin directory.


http://docs.oracle.com/cd/A59447_01/nt_804ee/doc/network.804/a55913/apc.htm

3.Oracle Network Products use the following configuration files:

On Your Server   On Your Client  

CMAN.ORA  

SQLNET.ORA  

LISTENER.ORA  

TNSNAMES.ORA  

SQLNET.ORA  

 

TNSNAMES.ORA  

 

 

Below is a description of the configuration files:

Configuration File  Description  

CMAN.ORA  

Contains Oracle Connection Manager parameters.  

LISTENER.ORA  

Includes service names and addresses of all network listeners on a machine, the system IDs (SIDs) of the databases for which they listen, and various control parameters used by the network listener.  

NAMES.ORA  

Contains control parameters for preferred Oracle Names Servers.

This file is not needed for well-known Oracle Names Servers.  

SQLNET.ORA  

Includes optional diagnostic parameters, client information about Oracle Names Servers, and can contain other optional parameters.  

TNSNAMES.ORA  

Includes a list of service names of network databases mapped to connect descriptors.  

 

Note:

It is possible to have system and local versions of TNSNAMES.ORA and SQLNET.ORA files. Any service name or parameter is first searched in the local version of the configuration file. If the service name or parameters is not found in the local version, it is searched in the system version.

The system version is located in the ORACLE_HOME\NET80\ADMIN directory. A local version can exist in the current working directory where the application is running. For example, if you start SQL*Plus in ORACLE_HOME\BIN, then Net8 looks for a local TNSNAMES.ORA in ORAWIN\BIN. If you start SQL*Plus in \PLUS, then Net8 looks for a local TNSNAMES.ORA in \PLUS.

A consequence of this is that you can have multiple local files in the various directories from which you start applications. In most cases, it is recommended that only one TNSNAMES.ORA file exist and that it be located in the default ORACLE_HOME\NET80\ADMIN directory.

 
 

A description of how the files are created is described below:

This file...   Is created...  

CMAN.ORA  

during installation on the server  

LISTENER.ORA  

during installation on the server  

NAMES.ORA  

on the server by Oracle Net8 Assistant when configuring preferred Oracle Names Servers  

SQLNET.ORA  

during installation on the clients and server, and regenerated on the client by Oracle Net8 Assistant.  

TNSNAMES.ORA  

on the clients and server by Oracle Net8 Easy Config or Oracle Net8 Assistant  

你可能感兴趣的:(数据库)