ORA-01017:invalid username/password; logon denied

jackson198574發表於2014-05-04
ORA-01017:invalid username/password; logon denied  

現象:

客戶應用的開發人員反映使用plsql developer登入test使用者的時候報錯:ORA-01017:invalid username/password; logon denied,使用system和sys在pl/sql developer登入就沒問題。


在伺服器本機測試:

sqlplus /nolog


SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 24 10:30:50 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


SQL> conn test/test
ERROR:
ORA-01017: invalid username/password; logon denied




SQL> show parameter remote_login_passwordfile


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_login_passwordfile            string      EXCLUSIVE   ------------------此處為Oracle預設的值,沒問題。



嘗試:




export ORACLE_SID=test
sqlplus / as sysdba


SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 24 11:28:23 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.




Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> select open_mode from v$database;


OPEN_MODE
----------
READ WRITE


其中還懷疑是因為開發人員未給使用者賦許可權:

SQL> GRANT CREATE SESSION TO test;


Grant succeeded.


SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
sqlplus /nolog


SQL*Plus: Release 10.2.0.4.0 - Production on Thu Apr 24 11:28:48 2014


Copyright (c) 1982, 2007, Oracle.  All Rights Reserved.


SQL> conn test/test
ERROR:
ORA-01017: invalid username/password; logon denied   ------------看來不是許可權問題。




SQL> conn / as sysdba
Connected.
SQL> show parameter service;


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      test


SQL> alter user test identified by test;


User altered.

該方案成功!


SQL> conn test/test
Connected.


最後找開發人員獲取建使用者的指令碼,發現確實是建立使用者時設定密碼有問題:



CREATE USER test
  IDENTIFIED BY VALUES 'test' -----------------------此行導致的,一般使用 identified by 直接加密碼即可!!,
  DEFAULT TABLESPACE  TEST_DATA                      identied by values適用於加密方式指定密碼的,一般為
  TEMPORARY TABLESPACE TEMP                          一串16禁止無可讀性的字元,如果明文指定密碼的話,使用
  PROFILE DEFAULT                                    identied by password即可。
  ACCOUNT UNLOCK; 
  -- 3 Roles for test 
  GRANT CONNECT TO test;
  GRANT DBA TO test;
  GRANT RESOURCE TO test;
  ALTER USER test DEFAULT ROLE ALL;
  -- 2 System Privileges for test
  GRANT CREATE ANY TABLE TO test;
  GRANT UNLIMITED TABLESPACE TO test;

來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/20802110/viewspace-1153323/,如需轉載,請註明出處,否則將追究法律責任。

相關文章