Wednesday, 29 April 2015

Command Line: sqlcl startup shutdown of pdb and non pdb databases (Should even work from a Mac - pure Java)

Tested against release 16th April 2015 drop.

Startup and shutdown of pluggable and non pluggable datbases.

bash-4.1$ ./sql sys@_non_pluggable__

SQLcl: Release 4.1.0 Release Candidate on

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

Connected to an Idle instance, startup command available.
SQL> startup
Started up
Database Mounted
Database Open

Total System Global Area   12345 bytes    
Fixed Size                    54321 bytes    
Variable Size               12345 bytes    
Database Buffers            54321 bytes    
Redo Buffers                 12345 bytes    
SQL> shutdown
Instance stopped
Database closed.
Database dismounted.
Database shutdown.
SQL> connect sys@__pluggable__ as sysdba

SQL> shutdown
Pluggable database closed
SQL> startup
Pluggable database opened

One point to remember - configure your listener for remote (or loopback) startup/shutdown if you are not using thick/bequeath Oracle client 'C' code, so the listener can find the database when the database is down.

listener.ora entry:


Should even work from a Mac - pure Java..

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.