---
title: "NAMES.DIRECTORY_PATH客户端连接参数"
author: "streamsong"
date: "2011-10-08T22:38:31Z"
tags: []
categories: ["数据库"]
slug: "names-directory-path"
draft: false
lastmod: "2011-10-08T22:38:31Z"
id: 1187243
url: "https://streamsong.iteye.com/blog/1187243"
---

今天在做oracle10gR2新特性透明加密（TDE）的时候，建立wallet默认路径和修改sqlnet.ora文件都 报ORA-28368和ORA-28353错误，而且修改sqlnet.ora文件后，监听程序起不来，后来在sqlnet.ora文件里加入NAMES.DIRECTORY\_PATH= (TNSNAMES, EZCONNECT)问题解决。  
    下面简单介绍下我对NAMES.DIRECTORY\_PATH连接参数的了解：  
NAMES.DIRECTORY\_PATH常用的值有tnsnames，hostname，onames和ezconnect和ldap，cds，nis不常用的值，默认值是（tnsnames，onames，hostname）。  
    如果设置NAMES.DIRECTORY\_PATH=（tnsnames），那么客户端就只会从tnsnames.ora查找你要连接的字符串（如orcl）记录，如果tnsname.ora文件中没有此记录，则连接不上数据库。  
如果设置NAMES.DIRECTORY\_PATH=（tnsnames，hostname），那么客户端首先会从tnsnames.ora查找你要连接的字符串（如orcl）记录，如果tnsname.ora文件中没有此记录，则尝试把你要连接的字符串（如orcl）当作一个主机名，通过网络的途径去解析它的ip地址然后去连接这个ip上GLOBAL\_DBNAME=连接字符串（如orcl）这个实例，当然这里连接字符串（如orcl）并不是一个主机名，最后会尝试以ezconnect的方式连接数据库。  
下面是oracle官方文档对这些值的介绍：  
tnsnames:local naming naming method  
Set to resolve a net service name through the tnsnames.ora file on the client.

hostname:host naming method  
Set to resolve a host name alias through an existing names resolution service or a centrally-maintained set of /etc/hosts files.

onames:Oracle Names method  
Set to resolve database objects through a Oracle Names server.

ldap:directory naming naming method  
Set to resolve a database service name, net service name, or net service alias through a directory server.

cds:Cell Directory Services (CDS) external naming method  
Set to resolve an Oracle database name in a Distributed Computing Environment (DCE) environment.

nis:Network Information Service (NIS) external naming method  
Set to resolve service information through an existing NIS.

Ezconnect：The easy connect naming method eliminates the need for service name lookup in the tnsnames.ora files for TCP/IP environments; in fact, no naming or directory system is required if you use this method.