SQLPlus and Easy Connect without password on the command line

The Easy Connect Naming Method allows you to connect to a database service without having to configure Net Service Names.

The most found example on internet is the one with typing the password at the command prompt when starting sqlplus:

sqlplus username/password@[//]host[:port][/service_name]
$> sqlplus system/manager@db_machine:1521/db_servicename

However, this means that the password will be stored in you history of commands (linux). This is not really secure… but sqlplus does not accept it when no password is supplied when using easy connect.

Two solutions

If you want to login with easy connect without typing the password on the command line, you have two options:

1. Start sqlplus with the /nolog option and connect with easy connect on the sqlplus prompt:

$> sqlplus /nolog
SQL> conn system/manager@db_machine:1521/db_servicename

SQL> conn system@"db_machine:1521/db_servicename"
Enter password:

2. Start sqlplus on the command line with the following easy connect syntax in order to be prompted for a password:

$> sqlplus system@\"db_machine:1521/db_servicename\"
Enter password:
Connected to:

Important: The  \”  in the beginning and end of the server:port/service is part of the syntax!
This last option is documented at Oracle Support Note [ID 274757.1].


If there is no SQLNET.ORA present or NAMES.DIRECTORY_PATH is not defined, EZCONNECT is enabled by default (as is TNSNAMES and HOSTNAME). Otherwise add the following to SQLNET.ORA:


Happy connecting!

Tagged , , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published.