use SQLcl with EZconnect and multiple hostnames (ADDRESS_LIST=)
EZconnect was not meant for things like that.

SQLcl can use tnsnames.ora as well. Just create one and use it:

sql -nohistory -noupdates -S $username/$password@test1 ...


Or you can do this, if you really want to provide all that stuff as a commandline argument:

sql -nohistory -noupdates -S $username/$password@"(DESCRIPTION= (CONNECT_TIMEOUT=4) (TRANSPORT_CONNECT_TIMEOUT=3) (ENABLE=BROKEN) (ADDRESS_LIST= (ADDRESS=(PROTOCOL=TCP)(HOST=example1.example.com)(PORT=1521)) (ADDRESS=(PROTOCOL=TCP)(HOST=example2.example.com)(PORT=1521))) (CONNECT_DATA= (SERVER=DEDICATED) (SERVICE_NAME=EXAMPLE.EXAMPLE.DBS)))" ...


Using tnsnames.ora:

[oracle@o71 ~]$ export JAVA_HOME=/u01/app/oracle/product/19.0.0/dbhome_1/jdk
[oracle@o71 ~]$ export PATH=/home/oracle/sqlcl/bin:$JAVA_HOME/bin:$PATH
[oracle@o71 ~]$ export TNS_ADMIN=/u01/app/oracle/product/19.0.0/dbhome_1/network/admin
[oracle@o71 ~]$ cat /u01/app/oracle/product/19.0.0/dbhome_1/network/admin/tnsnames.ora
MIN19=
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.71)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME =  min19_o71)
    )
  )

[oracle@o71 ~]$ sql bp/bp@min19

SQLcl: Release 18.4 Production on Tue Mar 26 09:28:11 2019

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

Last Successful login time: Tue Mar 26 2019 09:28:12 +01:00

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


SQL&gt;