0. Notation
In the following text, you will be expected to type everything between the brackets <> exactly as written. The exception is your username and password, which you need to provide. For example if you are asked to type < sqlplus username/password > , and your username is scott and password is tiger, then you would type: sqlplus scott/tiger
1. Login
Before you can use Oracle you need to have an account on the Oracle system. If you have provided your login name your oracle account should already have been set up. Otherwise, the default oracle account name will be s followed by your SID, e.g. s1234567.
Notice that to use Oracle, you need to log in the Oracle system with a separate username and password. Initially they have been set to your account’s username. That is, for account s2134567, both the username and password for Oracle are set to s2134567.
The Oracle system is installed at a server machine called dingo. So you need to telnet to dingo from the workstation you are currently using before you can run Oracle. Also, there are environment variables like PATH and ORACLE_HOME which need to be set. There are scripts to handle this, which you need to run every time you telnet to dingo. (You can include these environment variables in your default login script, then you don’t need to run the Oracle setup script each time). In Summary, we need to do things as follows to run ORACLE
All the oracle manuals are available on line, and you can use the tool oracle book to read each of these manuals. For your information, Oracle book is a hypertext product which provides hypertext links between documents and bookmarks etc. Documents under Oracle Book can be grouped into a set called a bookshelf . For instance, there are 3 separate manuals about Oracle Browser, each of these manuals corresponds to a separate document in oracle book. You can open an individual manual or open the bookshelf that contains references to these three manuals.
To look at the individual manual, double click at the manual item.
Then click at the < Contents > option at the tool bar to look at the content page.
3. A Suggested Lab Schedule
4. SQL*Plus
It is important that you learn about SQL. Though there are front-end tools like Oracle Browser which makes writing SQL a breeze, there still occasions that you need to study the SQL statements generated by these tools to have an understanding of what are actually being executed.
Oracle SQL conforms to ANSI's SQL-92 Entry Level. What this actually means is that Oracle SQL provides the functionality as specified by SQL-92 Entry Level plus some other features that satisfy the Intermediate and Full Level Compliance. The full set of SQL commands can be found at the "Oracle7 Server SQL Reference Manual"
SQL is a database language, and it needs an interface to work in practice. Oracle provides an environment called SQL*Plus that can be used to write SQL and PL/SQL commands (PL/SQL is a separate database language specific to Oracle, it extends the SQL language to include procedural features).
With SQL*Plus, you can
· format, perform calculations on, store, and print query results in the form of reports
· list column definitions for any table
· access and copy data between SQL databases
· send messages to and accept responses from an end user
The useful chapters are Learning SQL*Plus Basics, Manipulating Commands, Formatting Query Results and Accessing SQL Databases. Because of the time limit in this tutorial, spend about 1/2 hour on the chapter "Learning SQL*Plus Basics" and come back to the lab at other time to finish the other chapters
To invoke SQL*Plus, type
· When you have finished the exercise, these tables can be dropped by typing < demodrop usename password > at the unix shell. -- Use Oracle username and password
5. PL/SQL
PL/SQL extends the SQL with procedural features. A quick way to learn PL/SQL is to follow some useful examples at the APPENDIX B SAMPLE-PROGRAMS of the manual Oracle Server v.7.0 --- PL/SQL User's Guide and Reference. /home/oracle/app/oracle/product/oracle/7.3.2/plsql/demo/ has text files of these examples.
(You should spend about 1/2 hour on this part, and finish the exercise
at some other time)
Run the exambld script to create tables; the start command loads and executes SQL scripts.
2 x NUMBER := 100;
3 BEGIN
4 FOR i IN 1..10 LOOP
5 IF MOD(i,2) = 0 THEN -- i is even
6 INSERT INTO temp VALUES (i, x, 'i is even');
7 ELSE
8 INSERT INTO temp VALUES (i, x, 'i is odd');
9 END IF;
10 x := x + 100;
11 END LOOP;
12 COMMIT;
13 END;
14 /
Oracle Browser facilitates the writing of ad-hoc queries. Also it can be used to create and re-structure tables. It can also be used for quick data entry that do not need much sophisticated checking. Though it is not absolutely necessary for your project which SQL and PL/SQL can be used to create tables, enter data and query results. The use of Browser certainly can make the work of data entry easier.
There are 3 manuals for the Browser, Oracle Browser v.2.0 --- User's Guide, System Administrator's Guide and Reference Guide. It is advisable to go through the User's Guide only. Pay attention in particular to the use of Data Editor for data entry, and Schema Editor for defining table structure.
In this tutorial, spend about 1/2 hour on the chapter 4 "Taking a Test Drive" of the User's Guide. After you have finished the exercise, you should be able to use the Browser to create tables and input data into the tables. (For sophisticated data entry form, oracle has a separate product called FORMS in the Developer 2000)
b) Create sample tables with the SQL script brwbld20
d) Now you should be at the unix shell, invoke the Browser with the command < browser20em >
e) A login window should appear, log in the Browser with your Oracle username and password.
f) Follow the chapter "Taking a Test Drive" of the User's Guide.
Oracle has 2 major development environments, Power Object for the "lite" development and Developer 2000 for the more complex applications.
Developer 2000 includes many features that help you build sophisticated applications. It has a canvas tool for building the user interface, an object navigator for repository management and a PL/SQL editor to write procedures, functions and packages. Besides its main use for building a sophisticated form that can be used to input data, check integrity constraint and display output, the Developer 2000 environment also supports the building of application that integrates forms, graphic and report.
There are 3 commands to invoke different executables of Oracle Forms; you probably will use the f45desm most of the time.
- f45desm (for designing form which also includes code generation and runtime)
- f45genm (for generating executable)
- f45runm (for running a form executable)
The development environment is very rich in features, and it is advisable to have an overview by following some of the examples at the manual "Getting Started with Forms"; the other useful manual to study is "Forms Developer Guide".
% cp /home/oracle/TUTORIAL/forms/sample.fmx .
% cp /home/oracle/TUTORIAL/forms/sample.fmb .
· <start /home/oracle/TUTORIAL/forms/summit2>
e) When you finish the exercise, the sample tables can be dropped by
running the script
There is also a rather involved demonstration about the integrated ability of Oracle Forms, Graphics, Reports at the directory /home/oracle/app/oracle/product/7.3.2/forms45/demos/start. Your environment should already be set up to run this demo, if you have time and would like to have a look, type <f45runm> and at the file prompt, type <start>; you need to log in as scott/tiger who owns the demonstration tables. Do not update, insert or delete data as other students may want to have a look as well.