SQLcl not connecting as sysdba

SQLcl is the modern SQL Plus. It was developed my the same team who created the SQL Developer and is java based, with a lot of features that SQL Plus was lacking for years.

One problem that I was having after a fresh installation was some error when trying to connect as sysdba:

[oracle@myserver ~:orcl]$ sql / as sysdba

SQLcl: Release 4.1.0 Release Candidate on Mon Jun 06 10:33:50 2016

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


  USER          =
  URL           = jdbc:oracle:oci8:@
  Error Message = no ocijdbc12 in java.library.path
  USER          =
  URL           = jdbc:oracle:thin:@127.0.0.1:1521:orcl
  Error Message = ORA-01017: invalid username/password; logon denied
  USER          =
  URL           = jdbc:oracle:thin:@localhost:1521/orcl
  Error Message = Listener refused the connection with the following error:
ORA-12514, TNS:listener does not currently know of service requested in connect descriptor

Warning: You are no longer connected to ORACLE.
[oracle@myserver ~:orcl]$

I tried first to Google without checking the "Error Message" column, that was very clear about the error: "no ocijdbc12 in java.library.path".

So, it seemed my $LD_LIBRARY_PATH variable was not including all the necessary lib files. To solve, I had to simply scan what folder was missing and added it:

[oracle@myserver ~:orcl]$ find / -name *ocijdbc12* 2>&-
/u01/app/12.1.2/grid/lib/libocijdbc12.so
[oracle@myserver ~:orcl]$ export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/u01/app/12.1.2/grid/lib
[oracle@myserver ~:orcl]$

And testing again:

[oracle@myserver ~:orcl]$ sql / as sysdba

SQLcl: Release 4.1.0 Release Candidate on Mon Jun 06 10:34:26 2016

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
Data Mining, Oracle Database Vault and Real Application Testing options

SQL> show user
USER is "SYS"
SQL> exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
With the Partitioning, Automatic Storage Management, Oracle Label Security, OLAP,
Data Mining, Oracle Database Vault and Real Application Testing options
[oracle@myserver ~:orcl]$

Great, everything solved for now.

Check if you have the same issue and let me know if the error is different.

Have you enjoyed? Please leave a comment or give a 👍!

1 comments

    • jose on April 30, 2020 at 22:10
    • Reply

    I'm working on 'AIX' so my problem was similar when trying to logging '/ as sysdba'
    but different error message (Error: Could not find or load main class oracle.dbtools.raptor.scriptrunner.cmdline.SqlCli)

    so I have to create this alias and problem solved.

    sql='cd /home/oracle/scripts/sql/sqlcl/bin/ && sh sql / as sysdba'

Leave a Reply

Your email address will not be published.