SQLcl Local Connect As Sysdba Fails After Remote Connect

(Doc ID 2409898.1)

Last updated on JUNE 12, 2018

Applies to:

Oracle SQL Developer - Version 17.4 and later
Information in this document applies to any platform.

Symptoms

In SQLcl when connected to remote database as sysdba, and then attempt to connect to local as sysdba, it fails the first time with either of the following errors:

ORA-1017: invalid username/password; logon denied
ORA-1031: insufficient privileges

However, the second attempt is okay.

This problem is not reproducible with SQL*Plus.

EXPECTED BEHAVIOR
While already connected to remote database, attempt to execute:

SQL> connect / as sysdba
Error Message = ORA-01017: invalid username/password; logon denied

Expect to connect to local database on first attempt, instead it attempts to connect to remote database and fails.  It succeeds after the second attempt:

SQL> connect / as sysdba
Connected.


STEPS
The issue can be reproduced at will with the following steps:

Example:

SQL> connect sys/oracle@remote as sysdba
Connected.

SQL> connect / as sysdba
Connection Failed
USER =
URL = jdbc:oracle:oci8:@remote
Error Message = ORA-01017: invalid username/password; logon denied
Commit

SQL> connect / as sysdba
Connected.

Now connected to local database.



Risk:
Due to this issue, users may connect to wrong database without realizing, posing risk.

Cause

Sign In with your My Oracle Support account

Don't have a My Oracle Support account? Click to get started

My Oracle Support provides customers with access to over a
Million Knowledge Articles and hundreds of Community platforms