Jul 30, 2016

Unable to login as sysdba remotely

While connecting to remote database with sysdba privilege, we might encounter below error:-

[oracle@aqua dbs]$ sqlplus sys/Welcome123@aqua as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 18:33:40 2016

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

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


Enter user-name:

This is because, the password file might have a different password.


If sys user's password and "password file's" password is same, we can connect as sysdba privilege locally as well as remotely.

[oracle@aqua dbs]$ orapwd file=orapwaqua password=Welcome123 entries=5 force=y

Local connection:-

[oracle@aqua dbs]$ sqlplus sys/Welcome123 as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 19:01:05 2016

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


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

SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
AQUA      READ WRITE

Remote connection:-

[oracle@aqua dbs]$ sqlplus sys/Welcome123@aqua as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 19:00:32 2016

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


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

SQL> select name, open_mode from v$database;

NAME      OPEN_MODE
--------- --------------------
AQUA      READ WRITE

However, if "password file" is created using separate password, we need to know it in order to login remotely with sysdba privilege using sys user, orelse, will encounter ORA - 01017.

Created new password file:-

[oracle@aqua dbs]$ orapwd file=orapwaqua password=test123 entries=5 force=y

Remote connection:-

[oracle@aqua dbs]$ sqlplus sys/Welcome123@aqua as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 19:06:55 2016

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

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


Enter user-name:

Interestingly, with local connection Oracle will acknowledge both the passwords for sys user.
Local Connection:-
[oracle@aqua dbs]$ sqlplus sys/Welcome123 as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 19:11:51 2016

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


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

SQL>



 [oracle@aqua dbs]$ sqlplus sys/test123 as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 19:12:10 2016

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


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

SQL>


By the way, this is not the same with other users. SYS is just special!!!

[oracle@aqua dbs]$ sqlplus hr/hr@aqua as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 19:20:45 2016

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


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

SQL>


Now, if we alter SYS user's password, it will sync up with "password file".

SQL> alter user sys identified by blog123;

Now, test123 password will be invalid.

Local connection:-
[oracle@aqua dbs]$ sqlplus sys/blog123 as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 19:27:42 2016

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


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

SQL>

Remote connection:-
[oracle@aqua dbs]$ sqlplus sys/
blog123@aqua as sysdba

SQL*Plus: Release 11.2.0.3.0 Production on Sat Jul 30 19:27:53 2016

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


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

SQL>

No comments:

Post a Comment