The first several chapters of this course use a proprietary set of
example tables, and the remaining chapters make extensive use of the
Oracle-supplied Sample Schemas, including the HR, OE, and SH schemas.
These must be installed in the database before class starts.  The sample
schemas need to be unlocked and provided with known passwords.  Also,
the SYS user must create trace tables needed by DBMS_TRACE, and create
the PLUSTRACE role needed by the SQL*Plus AUTOTRACE option before creating
any student accounts.  The accompanying script, setup_sample_schemas.sql,
unlocks and sets passwords for the sample schemas, and creates the trace
tables and PLUSTRACE role.  Run this script before creating any student
accounts.

Each student needs:

- An oracle account, with appropriate privileges.  The account name doesn't
  matter.  If each student has their own Oracle server (that is, Oracle
  Database is installed on each student's classroom PC), then 'STUDENT'
  works fine.  If multiple students will connect to a single Oracle
  instance, then each Oracle account must have a unique name: 'S1',
  'S2', 'S3', etc.

  The accompanying script, create_oracle_user.sql, contains the syntax
  to create the account.  Run the script as the Oracle SYS user with
  SYSDBA privilege.  You must pass the account name on the command line:

    sqlplus sys/syspassword as sysdba @create_oracle_user.sql STUDENT
    sqlplus sys/syspassword as sysdba @create_oracle_user.sql S1
    sqlplus sys/syspassword as sysdba @create_oracle_user.sql S2
    ...

  In addition to such normal privileges as CREATE SESSION, CREATE TABLE,
  etc., the student account needs several higher privileges, including:

    ALTER SESSION
    SELECT_CATALOG_ROLE
    SELECT ANY DICTIONARY
    SELECT ANY TABLE
    CREATE ANY INDEX
    CREATE ANY TRIGGER
    EXECUTE ANY PROCEDURE
    EXECUTE ANY TYPE
    ANALYZE ANY
    CREATE EXTERNAL JOB
    CREATE PROCEDURE
    CREATE SEQUENCE
    CREATE TRIGGER
    CREATE TYPE
    CREATE VIEW
    CREATE ANY DIRECTORY
    DROP ANY DIRECTORY

  These and other permissions can be seen in the provided script,
  create_oracle_user.sql.

- A copy of the student files, extracted to a directory accessible from
  the student's database client.  Usually, the student files are
  distributed as a ZIP file.  In a UNIX environment, this ZIP should be
  extracted into each student's home directory.  On Windows, it can be
  extracted to the C: drive.  The name of the ZIP, and the directory
  into which it extracts, depends on the specific course being set up.

  The student files include online examples, lab solutions, and the
  database setup scripts to create the student's sample tables for use
  during class.

- The proprietary example tables created and loaded with the accompanying
  data.  Each student's Oracle account has a separate copy of the tables
  and data.

  There are two ways to load the tables.  Which one you choose depends on
  your own preference:

  - As SYSTEM, use Oracle's 'imp' utility to import the tables and data
    from the exp dump provided, student.dmp.  Be sure to load the data
    into the student's Oracle account schema.  The dump file was created
    from an Oracle account named 'STUDENT':

      imp system/systempw file=student.dmp fromuser=STUDENT touser=STUDENT
      imp system/systempw file=student.dmp fromuser=STUDENT touser=S1
      imp system/systempw file=student.dmp fromuser=STUDENT touser=S2
      ...

  - OR, as the student's Oracle user, run the accompanying SQL script
    (in SQL*Plus or another client application), create_student_tabs.sql:

      sqlplus student/student @create_student_tabs.sql
      sqlplus s1/s1 @create_student_tabs.sql
      sqlplus s2/s2 @create_student_tabs.sql
      ...

  Either method creates the following objects in the student's schema:

    SEQUENCE PERSON_ID_SEQ
    TABLE ACCOUNT
    TABLE ACCOUNT_TYPE
    TABLE EMPLOYEE
    TABLE INVENTORY
    TABLE ORDER_HEADER
    TABLE ORDER_ITEM
    TABLE PAY_TYPE
    TABLE PERSON
    TABLE PO_HEADER
    TABLE PO_ITEM
    TABLE PRODUCT
    TABLE PRODUCT_CATEGORY
    TABLE STORE
    TABLE VENDOR

  The accompanying script drop_student_tabs.sql is provided, in case
  you wish to drop and reload the tables for any reason.  Or, you can
  drop the student's Oracle account and start over.

  In addition to executing the above create_oracle_user.sql script,
  the following commands need to be executed to create the proprietary
  schema and setup the plan tables for EXPLAIN PLAN:


NOTE FOR LINUX ADMINISTRATORS:
  The script setup_linux_accounts.sh is provided as an example of how one
  might automate classroom setup for single or multiple accounts on a
  Linux Oracle Database host system.  It is provided as is, for use or
  adaptation at your own risk.

