从Windows客户端SQLplus 11c连接Oracle Server 12c

时间:2018-01-19 11:58:25

标签: oracle

我有一个oracle服务器12c,并希望从带有sqlplus的Windows机器连接。

服务器版本是12.2.0.1 SQLPlus是11.2.0.1

当我连接到服务器时,如“sqlplus user / pass @ ORCL”我收到了错误

ORA-01017: invalid username/password; logon denied

凭据是正确的。使用SQLPlus 12.2,它可以正常工作。

通过检查支持矩阵,它也适用于11.2.0

所以这是来自windowsclient的tnsnames.ora

ORCL =
      (DESCRIPTION=
        (ADDRESS=
            (PROTOCOL=TCP)
            (HOST=10.162.6.52)
            (PORT=1521)
        )
        (CONNECT_DATA=
            (SERVER = DEDICATED)
            (SID=orcltok)
        )
    )

用户的PASSWORD_VERSION是11g和12c。 我从dba_users检查过。

我希望有人给我一个提示。

祝福 奥利弗

1 个答案:

答案 0 :(得分:0)

我对你的任务很感兴趣,我在oracle XE 11g和即时客户端11上做了一个实验。

 1. USER SCOTT password  Tiger 
 2. USER Scott password  TigeR

C:\app\oracle\product\11.2.0\client_1>sqlplus.exe system/password@aws

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 19 22:05:00 2018

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production


SQL> alter user SCOTT identified by Tiger;

SQL> select * from all_users;

USERNAME                          USER_ID CREATED
------------------------------ ---------- ---------
XS$NULL                        2147483638 28-AUG-11
SCOTT                                  48 19-JAN-18
APEX_040000                            47 28-AUG-11
APEX_PUBLIC_USER                       45 28-AUG-11
FLOWS_FILES                            44 28-AUG-11
HR                                     43 28-AUG-11
MDSYS                                  42 28-AUG-11
ANONYMOUS                              35 28-AUG-11
XDB                                    34 28-AUG-11
CTXSYS                                 32 28-AUG-11
OUTLN                                   9 28-AUG-11

USERNAME                          USER_ID CREATED
------------------------------ ---------- ---------
SYSTEM                                  5 28-AUG-11
SYS                                     0 28-AUG-11

13 rows selected.
SQL> create user "Scott" identified by TigeR ;

User created.

SQL> grant connect to "Scott";

Grant succeeded.
SQL> select * from all_users;

USERNAME                          USER_ID CREATED
------------------------------ ---------- ---------
XS$NULL                        2147483638 28-AUG-11
Scott                                  51 19-JAN-18
SCOTT                                  48 19-JAN-18
APEX_040000                            47 28-AUG-11
APEX_PUBLIC_USER                       45 28-AUG-11
FLOWS_FILES                            44 28-AUG-11
HR                                     43 28-AUG-11
MDSYS                                  42 28-AUG-11
ANONYMOUS                              35 28-AUG-11
XDB                                    34 28-AUG-11
CTXSYS                                 32 28-AUG-11

USERNAME                          USER_ID CREATED
------------------------------ ---------- ---------
OUTLN                                   9 28-AUG-11
SYSTEM                                  5 28-AUG-11
SYS                                     0 28-AUG-11

14 rows selected.

C:\app\oracle\product\11.2.0\client_1>sqlplus.exe "Scott"/Tiger@aws

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 19 22:10:31 2018

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Express Edition Release 11.2.0.2.0 - 64bit Production

SQL> show user
USER is "SCOTT"
SQL>

C:\app\oracle\product\11.2.0\client_1>sqlplus.exe "Scott"/TigeR@aws

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 19 22:14:41 2018

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

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

C:\app\oracle\product\11.2.0\client_1>sqlplus.exe /nolog

SQL*Plus: Release 11.2.0.1.0 Production on Fri Jan 19 22:15:22 2018

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

SQL> connect Scott/TigeR@aws
ERROR:
ORA-01017: invalid username/password; logon denied


SQL> connect "Scott"/TigeR@aws
Connected.
SQL> show user
USER is "Scott"
SQL>

示例2. sqlplus 12.2.0即时客户端12.2.0.1

C:\oracle\instantclient_12_2>sqlplus.exe Scott/Tiger@aws

SQL*Plus: Release 12.2.0.1.0 Production on Mon Jan 22 09:42:08 2018

Copyright (c) 1982, 2017, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production

SQL> show user
USER is "SCOTT"
SQL>


C:\oracle\instantclient_12_2>sqlplus.exe "Scott"/"Tiger"@aws

SQL*Plus: Release 12.2.0.1.0 Production on Mon Jan 22 09:44:46 2018

Copyright (c) 1982, 2017, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Release 11.2.0.3.0 - 64bit Production

SQL> show user
USER is "SCOTT"
SQL> exit
Disconnected from Oracle Database 11g Release 11.2.0.3.0 - 64bit Production

C:\oracle\instantclient_12_2>sqlplus.exe /nolog

SQL*Plus: Release 12.2.0.1.0 Production on Mon Jan 22 09:45:48 2018

Copyright (c) 1982, 2017, Oracle.  All rights reserved.

SQL> conn Scott/TigeR@aws
ERROR:
ORA-01017: invalid username/password; logon denied


SQL> conn "Scott"/TigeR@aws
Connected.
SQL> show user
USER is "Scott"
SQL>

如果用户名包含不同寄存器中的字母,则sqlplus 11和12始终将用户名转换为大写。如果你像这样运行它 sqlpus "Scott"/TigeR@aws这相当于sqlpus "SCOTT"/TigeR@aws。 如果您首先运行sqlplus /nolog命令 然后是connect "Scott"/TigeR@aws。这一切都联系在一起。