7.16.2. USING ORACLE

7.16.2.1. ORACLE

Oracle is available on many different computer platforms. Here, in the Department of Computer Science, we are using Oracle 7 running on a Silicon Graphics computer consisting of 12 150MHz R4400 processors running IRIX 5.3. This computer is named "zeus.cas.uregina.ca", and if you have an account on it you can telnet in just like any other computer. For example, to log into zeus from your hercules account:

hercules=> telnet zeus.cas.uregina.ca

Trying 142.3.100.20...

Connected to zeus.cas.uregina.ca.

Escape character is '^]'.

IRIX (zeus)

Access to this system is provided to U of R Centre for Advanced Systems

users in support of research activities.

Unauthorized access is prohibited.

login: smith

Password:

IRIX Release 5.3 IP19 zeus

Copyright 1987-1994 Silicon Graphics, Inc. All Rights Reserved.

Last login: Fri Apr 26 09:17:57 CST 1996 by smith@HERCULES.CS.UREGINA.CA

zeus=>

Using telnet to log into zeus.

Important Notes:

You can also log into zeus directly from a dumb terminal or from a PC (Windows or OS/2) with telnet.

To get an account on zeus, you will have to be registered in an appropriate class or otherwise have some type of special permission.

7.16.2.2. STARTING ORACLE

To start Oracle, issue the following command at the command prompt:

sqlplus

You will be prompted for a user name and password. You should type these in accordingly. You can shorten the login process a bit by typing your username and password, separated by a "/" character, on the command line:

sqlplus username/password

7.16.2.2.1. SETTING UP YOUR ACCOUNT

You may need to make some modifications to your Unix account before using Oracle. These changes include the following modifications to your ".login" file:

if ( `hostname` == "zeus" ) then

setenv ORACLE_SID database_name

setenv ORAENV_ASK NO

source /usr/local/bin/coraenv

endif

Required modifications to ".login" file.

You have to set your ORACLE_SID environment variable to the name of the database you will be using. A database will exist for each course that requires one. To find out the name of your database you should ask your instructor or consult your account information sheet.

Important Notes:

Each user will have their own tablespace (see section 7.16.2.3. The Oracle Hierarchy) within the course database. This will prevent other users from being able to access other users' tables.

If you set the environment variable ORAENV_ASK to YES instead of NO, you will prompted for the name of the database to which you wish to connect when you first log in.

Important Notes:

All this assumes you are using the "csh" or "tcsh" shells. If you are using some other shell you will need to modify the syntax of the above commands accordingly. If you are using the "bash" shell, you will need to substitute the directory "oraenv" for "coraenv".

If you have any problems with the set-up procedures, you should first consult with your instructor. If the problems can not be resolved in this manner you should consult with the database administrator.

Once you have logged in properly, a short information screen will be displayed. Here is an example of a successful login attempt:

zeus=> sqlplus

SQL*Plus: Release 3.2.3.0.0 - Production on Wed Apr 24 10:41:37 1996

Copyright (c) Oracle Corporation 1979, 1994. All rights reserved.

Enter user-name: smith

Enter password:

Connected to:

Oracle7 Server Release 7.2.3.0.1 - Production Release

With the distributed, replication and parallel query options

PL/SQL Release 2.2.3.0.0 - Production

SQL> quit

Disconnected from Oracle7 Server Release 7.2.3.0.1 - Production Release

With the distributed, replication and parallel query options

PL/SQL Release 2.2.3.0.0 - Production

zeus=>

Logging into Oracle.

In the above example user "smith" logged in successfully. If the password is typed in interactively, instead of on the command line, it is not echoed to the screen. Finally, the actual Oracle prompt is the "SQL>" line. The "quit" command exits from Oracle.

Important Notes:

To use Oracle you will need a special username and password. Usually the Oracle username is the same as your regular Computer Science username. Your password will be assigned when your Oracle accounts are created so please consult your Oracle Account Sheet. By the way, it is a good idea to change your Oracle password. You can do this with the following sqlplus command:

alter user <USERNAME> identified by <NEWPASSWORD>;

7.16.2.3. THE ORACLE HIERARCHY

When you are logged into Oracle you are logged into your tablespace. The database administrator (the person who creates databases, tablespaces, users, etc.) will have set up a tablespace for you to use. Usually the tablespace will have the same name as your username.

Within a tablespace you can create your own tables. Tables are the functional core of any relational database. They define the data and the relationships between the data. More information on creating and manipulating tables will be provided later on (see section 7.16.3. Creating And Maintaining Tables).

There is one other hierarchy level in an Oracle database. So far we know that tables are stored within a tablespace. The tablespaces are stored within the actual database. A database may contain one or more tablespaces -- for different users, projects, etc.

This hierarchy can be broken down even further, but for our purposes the above description will suffice. Following is a graphical representation of the Oracle hierarchy:

Oracle Database

[User Tablespace [User Tables]]

[User Tablespace [User Tables]]

...

[User Tablespace [User Tables]]

Oracle hierarchy.

As well as the user tablespaces an Oracle database may also contain other tablespaces as well. Here are some common ones:

* system tablespace - contains information Oracle needs to manage itself and your data

* temporary tablespace - Oracle's scratch area

* tools tablespace - stores objects need by tools that run against an Oracle database

* rollback tablespace - database rollback information

* data/index tablespace - store application data and information for user tablespaces