Wednesday, February 29, 2012

DISCONNECT

You can return from SQL*Plus to the operating system using exit or quit:
 
SQL> exit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
UNIX>
 
SQL> quit
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
UNIX>
 
You can also use disconnect, which terminates your database session but leaves you in SQL*Plus:
 
SQL> show user
USER is "ORACLE"
SQL> disconnect
Disconnected from Oracle9i Enterprise Edition Release 9.2.0.7.0 - Production
With the Partitioning, OLAP and Oracle Data Mining options
JServer Release 9.2.0.7.0 - Production
SQL> show user
USER is ""
SQL>
 
This lets you enter and/or modify SQL*Plus commands but does not allow you to run them:
 
SQL> select sysdate from dual
  2  /
SP2-0640: Not connected
SQL> c/sysdate/sysdate + 1/
  1* select sysdate + 1 from dual
SQL> /
SP2-0640: Not connected
SQL>
 
To do that, you have to reconnect to the database:
 
SQL> show user
USER is ""
SQL> conn /
Connected.
SQL> show user
USER is "ORACLE"
SQL> l
  1* select sysdate + 1 from dual
SQL> /
 
SYSDATE+1
---------
17-FEB-12
 
SQL>

No comments: