Oracle SQLPlus ORA-01017 invalid credentials when specifying schema

匿名 (未验证) 提交于 2019-12-03 01:42:02

问题:

On an Oracle11g database, this works:

SQL> connect USER/pass Connected. 

However, this doesn't:

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

I have executed:

SQL> grant connect to USER; Grant succeeded. 

What am I missing?

tnsnames.ora:

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

EDIT:

:> 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 

The other two don't.

:> 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 

This one produces identifier error:

:> 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 

I have verified tnsnames.ora entry and I am spelling service correctly.

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 

回答1:

If you do not include the @db it will connect either via the TWO_TASk environment variable or do a local connection to the database on the machine you are connected to. the @db will lookup the connection information via the tnsnames.ora and then connect. I am guessing that you are connecting to two different databases. One you have the username/password combination and the other you do not.



标签
易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!