问题描述:在执行sqlldr时出错,以下是错误信息
C:\Documents and Settings\Administrator>sqlldr username/password@Statistics control='controlfile.txt' log='log.txt'
SQL*Loader: Release 9.2.0.8.0 - Production on 星期五 1月 6 11:23:55 2012
Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
SQL*Loader-704: Internal error: ulconnect: OCIServerAttach [0]
ORA-12154: TNS:could not resolve service name
但是pl/sql工具用这个连接名就可以连接上。
解决方法:
1、
SQL*PLUS连接报错,错误显示:ORA-12154: TNS:could not resolve service name
使用Oracle的tnsping命令测试报错,错误显示:TNS-03505: 未能分解名称
2、用oracle的tnsping命令测试
C:\Documents and Settings\Administrator>tnsping Statistics 2
TNS Ping Utility for 32-bit Windows: Version 9.2.0.8.0 - Production on 06-1月 -2012 11:35:27
Copyright (c) 1997, 2006, Oracle Corporation. All rights reserved.
Used parameter files:
E:\oracle\ora92\network\admin\sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION= (ADDRESS_LIST = (ADDRESS=PROTOCOL=TCP)(HOST =10.20.30.12)(PORT = 1521))) (CONNECT_DATA= (SERVER=DEDICATED) (SERVICE_NAME=oralce_servicename))
TNS-12533: TNS:illegal ADDRESS parameters
分析错误信息可以,ADDRESS参数不合法。
原来在PROTOCOL=TCP前少了一个左括号。正确配置如下
Statistics=
(DESCRIPTION=
(ADDRESS_LIST =
(ADDRESS=(PROTOCOL=TCP)(HOST =10.20.30.12)(PORT = 1521))
)
(CONNECT_DATA=
(SERVER=DEDICATED)
(SERVICE_NAME=oralce_servicename)
)
)