ORA-12171: TNS:could not resolve connect identifier: string

文档解释

ORA-12171: TNS:could not resolve connect identifier: string

Cause: A connection to a database or other service was requested using a connect identifier, and the connect identifier specified could not be resolved into a connect descriptor using one of the naming methods configured. For example, if the type of connect identifier used was a net service name then the net service name could not be found in a naming method repository, or the repository could not be located or reached.

Action:
– If you are using local naming (TNSNAMES.ORA file):
– Make sure that “TNSNAMES” is listed as one of the values of the NAMES.DIRECTORY_PATH parameter in the Oracle Net profile (SQLNET.ORA)
– Verify that a TNSNAMES.ORA file exists and is in the proper directory and is accessible.
– Check that the net service name used as the connect identifier exists in the TNSNAMES.ORA file.
– Make sure there are no syntax errors anywhere in the TNSNAMES.ORA file. Look for unmatched parentheses or stray characters. Errors in a TNSNAMES.ORA file may make it unusable.
– If you are using directory naming:
– Verify that “LDAP” is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
– Verify that the LDAP directory server is up and that it is accessible.
– Verify that the net service name or database name used as the connect identifier is configured in the directory.
– Verify that the default context being used is correct by specifying a fully qualified net service name or a full LDAP DN as the connect identifier
– If you are using easy connect naming:
– Verify that “EZCONNECT” is listed as one of the values of the NAMES.DIRETORY_PATH parameter in the Oracle Net profile (SQLNET.ORA).
– Make sure the host, port and service name specified are correct.
– Try enclosing the connect identifier in quote marks. See the Oracle Net Services Administrators Guide or the Oracle operating system specific guide for more information on naming.

ORA-12171错误表明当尝试连接到一个数据库实例时,Oracle服务无法找到有效的连接标识。这可能是由于服务名不正确或不确定,或提供的TNS连接字符串不正确,或遇到了有关TNSNames.ora文件的问题,如文件路径不正确,文件权限不正确,文件不可达,文件名写错等情况。

官方解释

ORA-12171表明Oracle服务无法找到有效连接识别符。

这是一个可以恢复的错误,可能是由于服务名不正确或不确定,TNS连接字符串不正确,或者TNSNames.ora文件有问题,如文件不可达,文件名写错,文件路径不正确,文件权限不正确等。

常见案例

1、错误的服务名:如果使用的服务名与TNSNames.ora中的不一致,则客户端将无法正确识别服务,而ORA-12171将出现。

2、不正确的TNS连接字符串:如果使用的TNS连接字符串不正确,则ORA-12171错误将出现。

3、TNSNames文件路径不正确:如果在由客户端访问的工作站上没有正确设置TNSNames.ora文件路径,则ORA-12171错误将出现。

4、TNSNames文件权限不正确:如果TNSNames.ora文件的权限不正确,则ORA-12171错误将出现。

正常处理方法及步骤

1、确定服务名:首先,检查TNSNames.ora文件以确保该服务名存在。

2、确定TNS连接字符串:检查TNS连接字符串是否正确,如果需要修改,那么应当使用正确的TNS连接字符串来替换它。

3、确定TNSNames文件路径:向客户端提出修改TNSNames文件的路径,或者由DBA向客户端添加该路径的访问权限。

4、确定TNSNames文件权限:检查TNSNames文件的写入权限,由DBA给客户端添加写入权限。

你可能感兴趣的