【问题标题】:Oracle SQLPlus ORA-01017 invalid credentials when specifying schemaOracle SQLPlus ORA-01017 指定架构时凭据无效
【发布时间】:2013-02-27 02:24:14
【问题描述】:

在 Oracle11g 数据库上,这是可行的:

SQL> connect USER/pass
Connected.

但是,这不是:

SQL> connect USER/pass@db
ERROR:
ORA-01017: invalid username/password; logon denied

我已经执行了:

SQL> grant connect to USER;
Grant succeeded.

我错过了什么?

tnsnames.ora:

DB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = a.dom.b.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = db)
    )
  )

编辑:

:> sqlplus USER/pass
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar 11 15
Copyright (c) 1982, 2008, Oracle.  All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.7.0 - 64bit Production

另外两个没有。

:> sqlplus USER/pass@db
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar 11 15:04:44 2013
Copyright (c) 1982, 2008, Oracle.  All rights reserved.

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

这会产生标识符错误:

:> sqlplus USER/pass@db//localhost:1521
SQL*Plus: Release 11.1.0.7.0 - Production on Mon Mar 11 15:10:38 2013
Copyright (c) 1982, 2008, Oracle.  All rights reserved.

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

我已经验证了 tnsnames.ora 条目,并且我的 service 拼写正确。

EDIT2:

:> lsnrctl status

LSNRCTL for 64-bit Windows: Version 11.1.0.7.0 - Production on 11-MAR-2013 15:14:19

Copyright (c) 1991, 2008, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=a.dom.b.com)(PORT=1521
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for 64-bit Windows: Version 11.1.0.7.0 - Production
Start Date                01-MAR-2013 16:15:25
Uptime                    9 days 21 hr. 59 min. 8 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   d:\oracle\product\11.1.0\db_1\network\admin\listener.ora
Listener Log File         d:\oracle\diag\tnslsnr\TMDEV100\listener\alert\log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=a.dom.b.com)(PORT=1521)))
Services Summary...
Service "db" has 1 instance(s).
  Instance "db", status READY, has 1 handler(s) for this service...
...
...
The command completed successfully

【问题讨论】:

  • 您的db 是有效的 TNS 名称吗?
  • 是的,我添加了清除的 tnsnames 条目。
  • USER 在两个数据库上的密码是否相同?你可以简单地输入一个无效的密码......
  • 每次输入的密码都是一样的。
  • @mdobrinin - sqlplus 是否接受来自命令行的连接参数?示例:sqlplus user/pwd@dbsqlplus user/pwd@//host:1521/servicename

标签: oracle oracle11g sqlplus


【解决方案1】:

如果您不包含@db,它将通过 TWO_TASk 环境变量进行连接,或者与您连接的计算机上的数据库进行本地连接。 @db 将通过 tnsnames.ora 查找连接信息,然后进行连接。我猜你正在连接到两个不同的数据库。一个你有用户名/密码组合,另一个你没有。

【讨论】:

    猜你喜欢
    • 2012-01-16
    • 2020-09-13
    • 1970-01-01
    • 1970-01-01
    • 2018-10-13
    • 1970-01-01
    • 1970-01-01
    • 2023-03-25
    • 1970-01-01
    相关资源
    最近更新 更多