Wednesday, 29 April 2015

NET Command - persistently store network details with tab completion

Example using tab completion: (need to be in sql for tab complete to work e.g. ./sql /nolog)

SQL> net unique=localhost:1521/mysid;
SQL> net list
SQL> net list unique
SQL> connect username/password@uni__TAB_FOR_COMPLETION__
SQL> connect username/password@unique

tab completion works for net shortcuts and tnsnames.ora details.

Behind the scenes net is very similar to the alias command.

If anyone has useful alias command uses or wanted extensions
to alias command I would be interested to know. 
(Jeff Smith is the Product Manager if you want to go through official channels).


The Net help page:

>help net

Command line only - not for sqldeveloper.

NET is a command which allows you to save a network details and assign it a shortcut command.
"net" - print a list of net short cuts
"net list " - list the contents of the short cut
"net name=localhost:1521/XE;" simple net command
"net drop name" - delete the short cut called name

net is single line terminated by newline
net ..=.. is terminated by ';'
net on its own gives a list of existing short cuts.

controlled by
set net on|off|readonly - default ON
   readonly means only do try to enter a net shortcut on successful connect command
set noverwrite on|off|warn - default WARN
   net overwrite: warn prints a warning if an override would otherwise happen.

1 comment:

Connor McDonald said...

In a similar vein, it would be nice to use "user@db" for the username once in sqlcl. That is, in the example below, it should not ask for the database because I provided it within the username


SQLcl: Release 4.1.0 Release Candidate on Fri May 01 13:04:24 2015

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

Username? (''?) scott@dorabetc
Password? (**********?) *****
Database? (''?)

The product is looking very nice