oracle 将 sqlloader 连接到服务器时出现 ERROR 704 & 12154

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/6232958/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-10 03:19:39  来源:igfitidea点击:

ERROR 704 & 12154 while connecting sqlloader to server

oraclesql-loadertnsnames

提问by csuo

I have a oracle database based on a server, and I want to import the data in the tables on the server. I am trying to use sqlloadr(sqlldr) for inserting all data in the oracle database, which is on localhost and there is no problem in this case, but the problem occurs while I try to connect a web-server(not localhost).

我有一个基于服务器的oracle数据库,我想导入服务器上表中的数据。我正在尝试使用 sqlloadr(sqlldr) 将所有数据插入到 oracle 数据库中,该数据库位于 localhost 上,在这种情况下没有问题,但是在我尝试连接 Web 服务器(不是 localhost)时出现问题。

The command that I've used in localhost case:

我在 localhost 案例中使用的命令:

sqlldr <usrname>/<password> control=table.ctl log=table.log ERRORS=25000

and following is concerning to web-server

以下是关于网络服务器的

sqlldr <usrname>/<password>@LABSERVER control=table.ctl log=table.log ERRORS=25000

where I created a tnsnames.ora as following:

我创建了一个 tnsnames.ora 如下:

LABSERVER =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(Host = <hostaddress>)(Port = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = <servicename>)
    )
  )

but I got this error:

但我收到了这个错误:

SQL*Loader-704: Internal error: ulconnect:OCIServerAttache [0]

ORA-12154: TNS:could not resolve the connect identifier specified

Any idea will be appreciated

任何想法将不胜感激

回答by APC

"where I created a tnsnames.ora which is like following:"

“我在这里创建了一个 tnsnames.ora,如下所示:”

That seems to mean you have posted the TNSNAMES.ORA file from the database server.

这似乎意味着您已经从数据库服务器发布了 TNSNAMES.ORA 文件。

Remember you also need a TNSNAMES.ORA file on the client. Is that correctly configured too?

请记住,您还需要客户端上的 TNSNAMES.ORA 文件。那也配置正确吗?

回答by dilip

if your password has a @ character , then sqlldr utility will not work , change ur password it will work http://www-01.ibm.com/support/docview.wss?uid=swg21347615

如果您的密码有@ 字符,那么 sqlldr 实用程序将无法使用,更改您的密码即可使用 http://www-01.ibm.com/support/docview.wss?uid=swg21347615

回答by JavaTec

We had a similar issue and did not have privileges to modify tnsnames.ora on local, so we had to specify the service in the command line like:

我们遇到了类似的问题,并且没有权限在本地修改 tnsnames.ora,因此我们必须在命令行中指定服务,例如:

sqlldr userid=username/password@\"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myDBHost)(PORT= 1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=MYDBSID)))\" Control='mytable.ldr' Log='mytable.log'

sqlldr userid=username/password@\"(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=myDBHost)(PORT= 1521)))(CONNECT_DATA=(SERVER=DEDICATED)(SID=MYDBSID))) \" Control='mytable.ldr' Log='mytable.log'

thanks to https://hs2n.wordpress.com/2012/06/12/oracle-using-sqlplus-and-sqlldr-on-databases-without-tnsnames-entry/#comment-700

感谢https://hs2n.wordpress.com/2012/06/12/oracle-using-sqlplus-and-sqlldr-on-databases-without-tnsnames-entry/#comment-700

回答by rus

For those, like me, who found this thread.

对于那些像我一样发现这个线程的人。

One thing to check: file permissions on the tnsnames.ora file.

要检查的一件事:tnsnames.ora 文件的文件权限。

For clients on the same machine yet not part of the DBA group and with ORACLE_HOME and ORACLE_BIN set correctly subject error was reported. File permissions of the tnsnames.ora file precluded world read; as the tnsnames.ora file could not be read 704 / 12514 thrown as service name could not be resolved.

对于在同一台机器上但不属于 DBA 组并且 ORACLE_HOME 和 ORACLE_BIN 设置正确的客户端,报告了主题错误。tnsnames.ora 文件的文件权限排除了全局读取;因为无法读取 tnsnames.ora 文件,因为无法解析服务名称而抛出 704 / 12514。

From command prompt: chmod 644 $ORACLE_HOME/network/admin/tnsnames.ora

从命令提示符:chmod 644 $ORACLE_HOME/network/admin/tnsnames.ora

回答by DCookie

Basically this error is telling you that given the host, port, protocol and service_name the client could not find a listening Oracle service. Make sure that your hostname is valid (e.g., you can ping it), that the listener is listening on 1521, and that the service_name in the server database is really the name you specified. You can verify it by issuing this command in sqlplus:

基本上这个错误告诉你,给定主机、端口、协议和 service_name,客户端找不到正在监听的 Oracle 服务。确保您的主机名有效(例如,您可以 ping 它),侦听器正在侦听 1521,并且服务器数据库中的 service_name 确实是您指定的名称。您可以通过在 sqlplus 中发出此命令来验证它:

SHOW PARAMETER service_names

which tells you what the database is registering itself as with the listener.

它告诉您数据库将自己注册为侦听器的内容。