ORA-01017 when connecting remotely as sysdba

oracleoracle-12c

Good morning,

While installing a database for Oracle Entreprise Manager Cloud Control (OEMCC) I can't login as sysdba, neither localy using sqlplus SYS@MYSID as sysdba nor remotely using the OEMCC installer :

[oracle@myserver ~]$ sqlplus SYS@MYSID as sysdba

SQL*Plus: Release 12.2.0.1.0 Production on Wed May 29 10:14:28 2019

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

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

I did some research :

Here : “ORA-01017: invalid username/password” while connecting to an instance remotely as sysdba
On oracle support : Troubleshooting ORA-1031 or ORA-1017 Errors When Connecting As SYSDBA (Doc ID 730067.1)

It seems to be a different case :

  • Localy I can connect using the system user (not as sysdba) : sqlplus system@MYSID then enter password, it works. So tnsnames.ora is correct. (Either localy and remotely)
  • The password file is correctly created, using : ${ORACLE_HOME}/bin/orapwd file=${ORACLE_HOME}/dbs/orapwmysid password="*********" force=y (just to be sure I connected using sqlplus / as sysdba then did alter user sys identified by "*********" account unlock;)
  • The parameter remote_login_passwordfile is set to EXCLUSIVE :
    SQL> show parameter remote_login_passwordfile;

    NAME                       TYPE    VALUE
    -------------------------  ------  --------- 
    remote_login_passwordfile  string  EXCLUSIVE
  • The orapw file rights are correct :
    [oracle@myserver ~]$ ls -l $ORACLE_HOME/dbs/orapwmysid 
    -rw-r-----. 1 oracle dba 6144 May 29 10:14 /opt/oracle/product/12.2.0/dbhome_1/dbs/orapwmysid
  • Remote login using system works :
[oracle@anotherserver ~]$ sqlplus system@MYSID

SQL*Plus: Release 12.2.0.1.0 Production on Wed May 29 13:18:52 2019

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

Enter password: 
Last Successful login time: Tue May 28 2019 15:41:20 +02:00

Connected to:
Oracle Database 12c Enterprise Edition Release 12.2.0.1.0 - 64bit Production

SQL> 

Do you have an idea, something I could investigate ?

Best Answer

Filenames (and Oracle instance names) on Linux are case sensitive. You keep using MYSID but you created the password file as orapwmysid. MYSID as a TNS alias is not case sensitive. MYSID as an instance name is case sensitive and having the password file named lowercase will prevent logging in using SYS with the above error.

[oracle@o71 ~]$ ps -ef | grep smon
oracle     923 31725  0 16:56 pts/0    00:00:00 grep --color=auto smon
oracle   31761     1  0 May15 ?        00:00:37 ora_smon_MIN18
oracle   32529     1  0 16:49 ?        00:00:00 ora_smon_MIN19
[oracle@o71 ~]$ ls -l $ORACLE_HOME/dbs/orapwMIN19
-rw-r-----. 1 oracle oinstall 2048 Apr 30 00:17 /u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwMIN19
[oracle@o71 ~]$ sqlplus sys/Oracle123@min19 as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 29 16:56:37 2019
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> exit
Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@o71 ~]$ mv /u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwMIN19 /u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwmin19
[oracle@o71 ~]$ sqlplus sys/Oracle123@min19 as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 29 16:56:45 2019
Version 19.3.0.0.0

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

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


Enter user-name:

Even if you change the SYS password with ALTER USER..., the password file will not be generated correctly in this case:

[oracle@o71 ~]$ sqlplus / as sysdba

SQL*Plus: Release 19.0.0.0.0 - Production on Wed May 29 16:58:19 2019
Version 19.3.0.0.0

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


Connected to:
Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0

SQL> alter user sys identified by Oracle123;

User altered.

SQL> Disconnected from Oracle Database 19c Enterprise Edition Release 19.0.0.0.0 - Production
Version 19.3.0.0.0
[oracle@o71 ~]$ ls -l /u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapw*
-rw-r-----. 1 oracle oinstall 2048 Apr 30 00:17 /u01/app/oracle/product/19.0.0/dbhome_1/dbs/orapwmin19
[oracle@o71 ~]$