简体   繁体   English

sqlplus 12.1中的ORA-01017错误,可以在其他应用程序中使用相同的凭据连接

[英]ORA-01017 error in sqlplus 12.1, can connect with same credentials in other applications

I have SQL*Plus 12.1 installed on Fedora 19 trying to connect to an Oracle 11g database. 我在Fedora 19上安装了SQL * Plus 12.1,试图连接到Oracle 11g数据库。 I installed the instantclient RPM packages (basic, devel, sqlplus) from here . 我从这里安装了instantclient RPM软件包(basic,devel,sqlplus)。 I can successfully connect to other Oracle databases using SQL*Plus, so I know I have a working installation of the software. 我可以使用SQL * Plus成功连接到其他Oracle数据库,因此我知道我已经安装了该软件。 However, when I try to connect to this particular database, I get this error: 但是,当我尝试连接到此特定数据库时,我收到此错误:

ERROR:
ORA-01017: invalid username/password; logon denied

Here's my tnsnames.ora file (with the host and port obfuscated out): 这是我的tnsnames.ora文件(主机和端口被混淆了):

PSPRODDB =
 (DESCRIPTION =
   (ADDRESS_LIST =
     (ADDRESS = (PROTOCOL = TCP)(HOST = #HOST-ADDR)(PORT = #PORT-NUM))
   )
 (CONNECT_DATA =
   (SERVICE_NAME = PSPRODDB)
 )
)

My TNS_ADMIN environment variable is set to the path of my tnsnames.ora file. 我的TNS_ADMIN环境变量设置为我的tnsnames.ora文件的路径。

The command I'm running to connect: 我正在运行连接的命令:

sqlplus username/password@PSPRODDB

After pressing enter, it hangs on the version and copyright info for about 2-3 seconds before giving me the ORA-01017 error. 按Enter后,它会在版本和版权信息上挂起约2-3秒,然后再给我ORA-01017错误。

I know I have the username and password correctly typed in because I copied and pasted it from another application that successfully connects to the database. 我知道我输入的用户名和密码正确,因为我从另一个成功连接到数据库的应用程序中复制并粘贴了它。

Edit 编辑

I've looked at the log.xml file (in C:\\oracle\\product\\11.2.0\\diag\\tnslsnr\\test\\listener\\alert\\log.xml ), and found that there a few entries that show I'm talking to the correct listener. 我查看了log.xml文件(在C:\\oracle\\product\\11.2.0\\diag\\tnslsnr\\test\\listener\\alert\\log.xml ),发现有一些条目显示我是与正确的倾听者交谈。 Here's an example of the log entry, but obfuscated for possibly sensitive info: 以下是日志条目的示例,但对于可能的敏感信息进行了模糊处理:

<msg time='2013-11-25T09:54:08.530-07:00' org_id='oracle' comp_id='tnslsnr'
 type='UNKNOWN' level='16' host_id='PSTEST100-50'
 host_addr='*my address*'>
 <txt>25-NOV-2013 09:54:08 * (CONNECT_DATA=(SERVICE_NAME=PSPRODDB)(CID=(PROGRAM=sqlplus)(HOST=*localhost*)(USER=njones))) * (ADDRESS=(PROTOCOL=tcp)(HOST=*addr*)(PORT=38906)) * establish * PSPRODDB * 0
 </txt>
</msg>

I've also since tried changing the *SERVICE_NAME* element in my tnsnames.ora file to SID , with no difference. 我也尝试将tnsnames.ora文件中的* SERVICE_NAME *元素更改为SID ,没有区别。

Surrounding my password with quotes didn't fix the problem either. 用引号括起我的密码也没有解决问题。

Could there be a version problem? 可能有版本问题吗? I'm using instantclient and sqlplus version 12.1, but the database is version 11.2. 我正在使用instantclient和sqlplus版本12.1,但数据库是版本11.2。

Edit 2 编辑2

Well, it's official. 嗯,这是正式的。 I'm an idiot, and that's what caused the error. 我是个白痴,这就是造成错误的原因。 I was typing in the wrong password, and I guess whatever I was copy-pasting was wrong too. 我输入了错误的密码,我猜我复制粘贴也是错误的。

ORA-01017 is pretty clear. ORA-01017非常清楚。 It means that you got either the username or password wrong, or possibly that you're not really connecting to the database that you think you're connecting to. 这意味着您输入的用户名或密码错误,或者您可能没有真正连接到您认为正在连接的数据库。

There's really not much more to say. 真的没什么好说的了。 Double check your connect descriptor, and make sure you didn't mistype the username or password. 仔细检查您的连接描述符,并确保您没有错误输入用户名或密码。

Couple ideas, in order of likelihood of causing this problem: 按可能导致此问题的顺序结合思想:

1) If your password starts with a non-alphabetic character, surround password with quotes: user/"password"@service (note, GUI apps eg TOAD and SQLDeveloper don't require quotes). 1)如果您的密码以非字母字符开头,则带引号的密码: user/"password"@service (注意,GUI应用程序,例如TOAD和SQLDeveloper不需要引号)。

2) Run 2)跑

 
 
 
  
  > tnsping service
 
  

And confirm your output matches the tnsnames.ora entry you think you are using 并确认您的输出与您认为正在使用的tnsnames.ora条目匹配

3) On server, run (or ask dba to run) 3)在服务器上运行(或要求dba运行)

> lsnrctl status

Confirm that the service listed in your tnsnames.ora is being directed to the proper database. 确认tnsnames.ora中列出的服务已定向到正确的数据库。

EDIT: Saw Nathan's question, thought, "hmm - weird, I use tnsping all the time to validate client installs, why the heck wouldn't it be included in instantclients???" 编辑:看到内森的问题,想,“嗯 - 很奇怪,我一直用tnsping验证客户端安装,为什么它不会被包含在即时客户端?” Asked Google, and lo-and-behold, it turns out TNSPING is pretty much useless. 问谷歌,而且看来TNSPING几乎没用。 The ONLY think it checks is that host is reachable and that a tnslistener is running on the specified port (which you could easily check with telnet). 唯一认为它检查的是主机是否可达,并且tnslistener正在指定的端口上运行(您可以使用telnet轻松检查)。 H/T to "BillyVerreynne" on Oracle forums: https://forums.oracle.com/message/10561771 Oracle论坛上的“BillyVerreynne”的H / T: https ://forums.oracle.com/message/10561771

Yay, I learned something today! 是的,我今天学到了一些东西! :-) On that note, I'll personally be switching to SQLPlus for deep-dive checking of TNS specifications, and recommend everyone reading this do the same. :-)就此而言,我将亲自切换到SQLPlus深入检查TNS规范,并建议每个阅读此内容的人都这样做。 As Nathan already posted above, issues with SQLPlus connection attempts can be reviewed in $ORACLE_BASE/diag/tnslsnr/test/listener/alert/log.xml. 正如Nathan上面发布的那样,可以在$ ORACLE_BASE / diag / tnslsnr / test / listener / alert / log.xml中查看SQLPlus连接尝试的问题。

In your sqlnet.ora set 在你的sqlnet.ora集中

TRACE_LEVEL_CLIENT = support

See the docs for descriptions of what these do. 有关这些内容的描述,请参阅文档 You'll get files in $ORACLE_HOME/network/trace that include information on the client connections. 您将获得$ ORACLE_HOME / network / trace中包含客户端连接信息的文件。 My guess is that you're having trouble talking to the TNS listener from your client machine, or something like that. 我的猜测是你在客户端机器上与TNS监听器交谈时遇到了麻烦,或类似的事情。

Unfortunately, if the problem is too close to the server, the client tracing may not help so much. 不幸的是,如果问题太靠近服务器,客户端跟踪可能没那么多帮助。 Since this is a prod database that may be a bit tricky to diagnose. 由于这是一个prod数据库,诊断可能有点棘手。 If you do have an Oracle support contract, they're really good at resolving this sort of thing. 如果你有Oracle支持合同,他们真的很擅长解决这类问题。

I realize this is not a complete answer, but I suspect from that trace you'll find other more interesting errors. 我意识到这不是一个完整的答案,但我怀疑从那个痕迹你会发现其他更有趣的错误。 ORA-01017 tends to be the generic error that the networking layer passes up to the higher layer, and the useful errors are a layer down in the trace. ORA-01017往往是网络层传递到更高层的一般错误,有用的错误是跟踪中的一层。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM