Oracle From the Unix Command Line

The tool used most commonly from the unix command line to access oracle is sqlplus. When you obtain an Oracle account you are given a username and a password.

For the sake of this demonstration lets assume your Oracle username is scott and your oracle password is tiger and you have obtained an account on server cdf_dev3.

This demonstration also assumes that you are familiar with Fermilabs ups/upd commands, which we will use to test that the client software is accessible on our unix account.


cdfsga% ups list -a | grep -i oracle
        Product=oracle_client   Version=v8_0_4_1        Flavor=IRIX+6
cdfsga% setup oracle_client
cdfsga% which sqlplus
/data64/upgrade/oracle/v8_0_4_1/bin/sqlplus
cdfsga%sqlplus scott/tiger@cdf_dev3

SQL*Plus: Release 8.0.4.0.0 - Production on Mon Jan 4 19:30:54 1999

(c) Copyright 1997 Oracle Corporation.  All rights reserved.


Connected to:
Oracle8 Enterprise Edition Release 8.0.4.1.0 - Production
PL/SQL Release 8.0.4.1.0 - Production

SQL> 

You are now connected to the sql server on cdf_dev3, if you know SQL you are ready to perform data manipulation and retrieval.

The Oracle flavor of SQL is terminated with a ';' if you are experienced with other vendors you may be used to a '\g' or 'go'. The online documentation for Oracles version of SQL can be found at http://misdev.fnal.gov/oracledoc.

Here is an example of creating a new table on the server:


SQL> create table foo(
  2  bar integer,
  3  boing char(5));

Table created.

SQL> 

Dennis Box
Last modified: Mon Jan 4 19:43:36 CST