HELP! * GREY=local Full HTML for

LOCAL foilset Basic Discussion of Oracle 7 Relational Database

Given by Gang Cheng, C.W. Ou, Geoffrey C. Fox at CPS616 Basic Information Track for Computational Science on Winter-Spring Semester 96. Foils prepared 4 April 1996
Abstract * Foil Index for this file

See also color IMAGE
This starts with a summary of four major modules (this is first one of the four)
What is a Relational Database
A Phone-List Example for Motivation and Illustration of Concept
Major Schema Objects and Structures in Oracle with examples
Data Integrity and Data Types in Oracle
Data Concurrency and Consistency in Oracle

Table of Contents for full HTML of Basic Discussion of Oracle 7 Relational Database


1 CPS 616 January-April 1996 Computational Science Track on Base Technology for the Information Age:
Oracle RDBMS and Web Integration
Module 1 - A Technical Introduction to Oracle RDBMS

2 Abstract of: Module 1 - A Technical Introduction to Oracle RDBMS
3 Full Summary of CPS616 Oracle/Web Presentation - I
4 Full Summary of CPS616 Oracle/Web Presentation - II
5 A Technical Introduction to Oracle RDBMS
6 Example Problem Description -I
7 Example Problem Description -II
8 Example problem description -III
9 Example problem description -IV
10 The Relational Database Model
11 Examples of Attribute and Entity Relationship Tables
12 Relational Rules -- 1
13 Relational Rules - 2
14 Relational Rules - 3
15 Relational Algebra
16 Database Structure and Space Management in Oracle
17 Major Schema Objects in Oracle - Tablespace I
18 Major Schema Objects in Oracle - Tablespace II
19 Major Schema Objects in Oracle - III -- Table
20 Define A Table Structure in Oracle - An Example
21 Major Schema Objects in Oracle -IV- View
22 Major Use of Views in a Database I
23 Major Use of Views in a Database II
24 Define a View in Oracle - An Example
25 Major Schema Objects in Oracle -V -- Sequences
26 Major Schema Objects in Oracle -VI - Procedures etc.
27 Major Schema Objects in Oracle -VI- Synonym
28 Major Schema Objects in Oracle -VII-Synonym
29 Major Schema Objects in Oracle -VIII - Indices
30 When Should one Create Indices ?
31 How to Choose Columns to be Indexed
32 Major Schema Objects in Oracle - IX
33 Data Integrity in Oracle -I
34 Data Integrity in Oracle -II
35 Data Integrity in Oracle -III
36 Datatypes in Oracle -I
37 Datatypes in Oracle -II
38 Datatypes in Oracle -III
39 Data Concurrency and Consistency in Oracle -I
40 Data Concurrency and Consistency in Oracle -II
41 Oracle RDBMS Supports Read-Consistency -I
42 Oracle RDBMS Supports Read-Consistency -II
43 Data Concurrency and Consistency in Oracle -I
44 Data Concurrency and Consistency in Oracle -II

This table of Contents Abstract



HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 1 CPS 616 January-April 1996 Computational Science Track on Base Technology for the Information Age:
Oracle RDBMS and Web Integration
Module 1 - A Technical Introduction to Oracle RDBMS

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index Addon
Instructor: Geoffrey Fox
Version 13 March 96
teamed with Gang Cheng, Chao-Wei Ou
Syracuse University
111 College Place
Syracuse
New York 13244-4100

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 2 Abstract of: Module 1 - A Technical Introduction to Oracle RDBMS

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index Addon(need password etc)
This starts with a summary of four major modules (this is first one of the four)
What is a Relational Database
A Phone-List Example for Motivation and Illustration of Concept
Major Schema Objects and Structures in Oracle with examples
Data Integrity and Data Types in Oracle
Data Concurrency and Consistency in Oracle

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 3 Full Summary of CPS616 Oracle/Web Presentation - I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
The Oracle/web part of CPS616 consists of three presentation Sub-modules and One Lab Session with a Hands-on Tutorial
Module 1 - A Technical Introduction to Oracle RDBMS
  • A Phone-List Example for Motivation and Illustration of Concept
  • Major Schema Objects and Structures in Oracle
  • Data Integrity and Data Types in Oracle
  • Data Concurrency and Consistency in Oracle
Module 2 - Data Access and Database Programming in Oracle
  • Oracle SQL and Examples
  • Programming in PL/SQL
  • Oraperl - Access Oracle RDBMS from Perl

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 4 Full Summary of CPS616 Oracle/Web Presentation - II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index Addon
Module 3 - Integration of Web and Oracle RDBMS
  • The Synergy of Web and Database Technologies
  • Architectures of Web and Oracle RDBMS Integration
  • A Technical Overview of The Oracle-Web Integration
  • Examples of a Web-based Search Interface for the Phone List Database
Module 4 - Hands-on Lab Session
  • Basic Steps in Using Oracle
  • Procedures to Build an Oracle Database
  • Build the Web/Oracle Phone List Database Example By Yourself
  • Practice Examples in the Lectures on An Oracle RDBMS Server
Handout Materials are also Associated with Each Module for Details

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 5 A Technical Introduction to Oracle RDBMS

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Major features in database and information management
large databases and space management control
many concurrent database users
high transaction processing performance
high availability
controlled availability
industry accepted standards
manageable security
database enforced integrity
client/server (distributed processing) environments
distributed database systems
portability, compatibility and connectability

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 6 Example Problem Description -I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Through out the lectures, we use a simple example to illustrate important concepts, features and syntax in Oracle7
This example will also be used to demonstrate the Oracle/Web integration and in the lab session to build a web application with Oracle server
This simple application is a phone list database, such as NPAC phone list
Basic requirement is to build such a database so as to locate a person's phone number with different query criteria

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 7 Example Problem Description -II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * Critical Information in IMAGE
Full HTML Index
Database design is a major area in RDBMS and system analysis. We will not discuss this key database issue, and assume that the phone list database is represented in two tables which represent two entities in the modeled application: person entity and phone entity
Table 1 - personal information.
Table name : person_info_table

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 8 Example problem description -III

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * Critical Information in IMAGE
Full HTML Index Addon
Table 2 - phone number information.
Table name : phone_list_table

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 9 Example problem description -IV

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Basic Assumptions in the Entity-Relationship (E-R) Model:
  • The pid is unique in person_info_table (can be viewed as SSN)
  • One person may have multiple phone numbers of the same or different type
  • A phone number can be shared by more than one persons

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 10 The Relational Database Model

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index Addon
A database model is a set of definitions describing how real-world data is conceptually represented as information in the computer
The relational model - database collects related information in a set of tables.
  • A table either contains the attributes of an entity or the relationships between entities
In the example problem, people and phone numbers are entities;
Title, uid etc. are attributes of the person entity; type is attribute of phone number entity
pid is used to set up relationships between entities

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 11 Examples of Attribute and Entity Relationship Tables

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * Critical Information in IMAGE
Full HTML Index
Simple Attribute Tables for:
Person Phone Room
While a set of Tables could describe Many:Many(1) relationships

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 12 Relational Rules -- 1

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Rule 1: First Normal Form Rule - a table must have no multi-valued columns
example: in phone_list_table
pid phone no type
3,4 315-443-9209 office
  • such a row is not allowed in RDBMS

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 13 Relational Rules - 2

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Rule 2: Access rows by content only rule - we can only retrieve rows/columns by their content (attribute values that exist), i.e., there is no order defined for the rows or columns
  • Example: you cannot issue the query 'get the 2nd row in the person_info_table',
    • or 'get the 1st column in all the rows of phone_list_table'.
  • You can only do 'get the row from person_info_table whose pid equals to 2 ',
    • or 'get the column values of all the rows in phone_list_table where the column is named as phone no '

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 14 Relational Rules - 3

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Rule 3: The uniqueness rule - two rows in a table cannot be identical in all column values at once
Example: the two rows are not allowed to coexist in the phone_list_table
pid phone no type
3 315-443-9209 office
3 315-443-9209 office

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 15 Relational Algebra

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
All base RDBMS operations and SQL operators are built on relational algebra theory
Set operations - union, intersection, difference, product
Native relational operations - project, select, join (outer join, left outer join, right outer join, theta join), division

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 16 Database Structure and Space Management in Oracle

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Database Structures - well-defined objects represented as tablespace and other schema objects that store the data of a database
Database Operations - actions to manipulate the data and their structures
Integrity Rules - relational rules to govern proper operations on data and their structures

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 17 Major Schema Objects in Oracle - Tablespace I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index Addon
Tablespace - a database is divided into logical storage units called tablespace
A tablespace is used to group related logical structure together
Tablespaces commonly group all of an application's objects to simplify certain administrative operations
It is Database Administrator (DBA)'s job to define tablespaces and assign them to users

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 18 Major Schema Objects in Oracle - Tablespace II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * Critical Information in IMAGE
Full HTML Index Addon
This figure illustrates
Each Oracle DB is logically divided into one or more tablespaces
One or more data files are explicitly created for each tablespace to physically store the data of all logical structures in a tablespace
The combined size of a tablespace's data files is the total storage capacity of the tablespace (SYSTEMS has 2M while USERS has 4M)
The combined storage capacity of a database's tablespaces is the total storage capacity of the database (6M in example above)

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 19 Major Schema Objects in Oracle - III -- Table

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Table - the basic unit of data storage in Oracle. The tables of a database hold all of the user-accessible data
Each table is defined with a table name and set of columns
Each column is given a column name, a datatype (CHAR, VARCHAR2, DATE or NUMBER), and a width
Once a table is created, valid rows of data can be inserted into it. The table's rows can then be queried, deleted, or updated

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 20 Define A Table Structure in Oracle - An Example

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * Critical Information in IMAGE
Full HTML Index Addon
To create the two tables for the phone-list database, we would have

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 21 Major Schema Objects in Oracle -IV- View

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
View - customized presentation of the data in one or more tables
Views do not actually contain or store data
They derive their data from the tables on which they are based, referred to as the base table
Like tables, views can be queried, updated, inserted into, and deleted from, but with some restrictions
All operations performed on a view actually affect the base tables of the view

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 22 Major Use of Views in a Database I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Provide an additional level of table security by restricting access to a predetermined set of rows and columns of a table.
For example, a view of a table can be created so that columns with sensitive data (for example, SSN) are not included in the definition of the view
Hide data complexity.
For example, a single view can be used to create a join, which is a display of related columns or rows in multiple tables.
However, the view hides the fact that this fact that this data actually originates from several tables

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 23 Major Use of Views in a Database II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Simplify commands for the user.
  • For example, views allow users to select information from multiple tables without requiring the users to actually know how to perform a correlated subquery
Present the data in a different perspective from that of the base table.
  • For example, views provide a means to rename columns without affecting the tables on which the view is based
Store complex queries.
  • For example, a query might perform extensive calculations with table information.
  • By saving this query as a view, the calculations are performed only when the view is queried

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 24 Define a View in Oracle - An Example

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * Critical Information in IMAGE
Full HTML Index
Suppose we'd like to create a view (virtual table) called staff_info_table which has all the personal information of NPAC staff.
This view will use the base table person_info_table with the position column has only staff related value

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 25 Major Schema Objects in Oracle -V -- Sequences

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Sequence - a sequence generates a serial list of unique numbers within a single numeric column of a database's tables
Sequences simplify application programming by automatically generating unique numerical "labels" for the rows of tables
Use them for attributes such as pid -- person ID in phone list where must generate a unique label for every row

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 26 Major Schema Objects in Oracle -VI - Procedures etc.

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Procedure or Function - a set of SQL and PL/SQL statements grouped together as an executable unit to perform a specific task
Procedures and functions allow user to combine the ease and flexibility of SQL with the procedural functionality of a structured programming language
Using PL/SQL, such procedures and functions can be defined and stored in the database for reuse
Package - provides a method of encapsulating and storing related procedures, functions, and other package constructs together as a unit in the database.
  • Packages provide DBA or developer organizational benefits, as well as increased functionality and database performance
more details about procedure/function/package will be covered in 'PL/SQL' section in second module

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 27 Major Schema Objects in Oracle -VI- Synonym

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Synonym - an alias for a table, view, sequence, or program unit
A synonym is not actually an object itself, but instead is a direct reference to an object
A synonym can be public or private.
  • A Private synonym is only visible to the user who created it.
  • DBA most often create public synonyms that make the base schema object available for general, system-wide use by any database user

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 28 Major Schema Objects in Oracle -VII-Synonym

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Synonyms are used to
  • mask the real name and owner of an object
  • provide public access to an object
  • provide location transparency for tables, views, or program units of a remote database
  • simplify the SQL statements for database users
For example, to allow all users to share the WOW PL/SQL package called htp which is currently owned by a user 'cps616'. A public synonym must be created and certain permissions must be granted:
  • CREATE PUBLIC SYNONYM htp for cps616.htp
  • GRANT execute on htp to public

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 29 Major Schema Objects in Oracle -VIII - Indices

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Index, Cluster (described later) - are optional structures associated with tables, which can be created to increase the performance of data retrieval
Indices are created on one or more columns of a table. An Oracle index provides a faster access path to efficiently locate requested rows
Create an index in Oracle - An Example
  • We knew that Last name may be the most frequently used column in query.
  • An index on this column would improve most queries using this field, in particular when there are many rows in the person_info_table and most of them have distinct values on this column
  • CREATE INDEX last_name_index ON person_info_table(last_name);

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 30 When Should one Create Indices ?

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
An Index can improve the performance of queries that select a small percentage of rows from a table. A general guideline is to create indexes on tables that are queried for less than 2% - 4% of the table's rows, with the following assumptions:
  • Rows with the same value for the column on which the query is based are uniformly distributed throughout the data blocks allocated to the table
  • Rows in the table are randomly ordered with respect to the column on which the query is based
  • Each data block allocated to the table contains at least 10 rows
  • The table contains a relatively small number of columns
  • Most queries on the table have relatively simple WHERE clauses

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 31 How to Choose Columns to be Indexed

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Consider indexing columns that are used frequently in WHERE clauses
Consider indexing columns that are used frequently to join tables in SQL statements
Only index columns when only a few rows have the same value in the columns indexed
Do not index columns with few distinct values
Do not index columns that are frequently modified
Do not index columns that only appear in WHERE clauses with functions or operator
Consider indexing foreign keys (see later) of referential integrity constraints in cases in which a large number of concurrent INSERT, UPDATE, and DELETE statement access the parent and child tables
When choosing whether to index a column, consider whether the performance gain for queries is worth the performance loss for INSERT, UPDATE, and DELETE statements and use of the space required to store the index

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 32 Major Schema Objects in Oracle - IX

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Clusters are groups of one or more tables physically stored together because they share common columns and are often used together.
  • Because related rows are physically stored together, disk access time improve
Data Dictionary - each Oracle server has a data dictionary which is a set of tables and views that are used as a read-only reference about the database (meta-data),
  • such as logical and physical structure of the database, users, tables definition, integrity constraints, etc.
For example, you can see your disk space quota: select * from user_ts_quotas;

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 33 Data Integrity in Oracle -I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
It is very important to guarantee that data adheres to certain rules which are determined by application
For example, assume that a business rule says that no row in the phone_list_table should be allowed unless its person_id value found in the person_id column in the person_info_table (this is to ensure that a person's entity must exist first before the phone number information can be established)
If an insert or update statement attempts to violate this integrity rule, Oracle must roll back the invalid statement and return an error to the application
In order to achieve this protection, Oracle provides integrity constraints
For example, a foreign key (see later) can be defined on the column person_id of phone_list_table which references to the primary key person_id of the person_info_table

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 34 Data Integrity in Oracle -II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Integrity Constraints - a declarative way to define a business rule for a column of a table.
  • They are defined with a table and are stored as part of the table's definition
Following integrity constraints are supported by Oracle:
  • NOT NULL - disallow nulls (empty entries) in a table's column
  • UNIQUE - disallow duplicate values in a column or set of columns
  • PRIMARY KEY - disallow duplicate values and nulls in a column or set of columns
  • FOREIGN KEY - requires each value in a column or set of columns match a value in a related table's UNIQUE or PRIMARY KEY (FOREIGN KEY integrity constraints also define referential integrity actions that dictate what Oracle should do with dependent data if the data it references is altered)
  • CHECK - disallows values that do not satisfy the logical expression of the constraint

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 35 Data Integrity in Oracle -III

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * Critical Information in IMAGE
Full HTML Index
For example, to enable necessary Integrity constraints, we should redefine the two tables in our example as follows :

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 36 Datatypes in Oracle -I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
CHAR - stores fixed length character strings. 1 - 255 chars
  • When a row is inserted into or updated in the table, the value for the CHAR column has a fixed length
  • If a shorter value is given, the value is blank-padded to the fixed length
  • If a longer value with trailing blanks is given, blanks are trimmed from the value to the fixed length
  • If a value is too large, Oracle returns an error
VARCHAR2 - stores variable-length character strings. 1 - 2000 chars
  • For example, assume a column is declared VARCHAR2 with a maximum size of 50. If only 10 chars are given for the column in a particular row, the column in the row's row piece only stores the 10 chars (10 bytes), not 50
CHAR and VARCHAR2 have different comparison semantics in string comparisons

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 37 Datatypes in Oracle -II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
NUMBER - stores fixed and floating point numbers. Numbers of virtually any magnitude can be stored and are guaranteed portable among different systems operating Oracle, up to 38 digits of precision
  • positive or negative numbers in the range 1 x 10 -130 to 9.99..9 x 10 125
DATE - stores point-in-time values (e.g. dates and times) in a table. It stores the year (including the century), the month, the day, the hours, the minutes, and the seconds.
  • Julian dates are allowed for continuous dating from a common reference
  • Oracle date arithmetic takes account the anomalies of the calendars used throughout history
ROWID - every row in a non-clustered table is assigned a unique ROWID that corresponds to the physical address of a row's row piece
  • ROWIDs are the fastest means of accessing particular rows
  • can be used to see how a table is physically organized
  • they are unique identifiers for rows in a given table

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 38 Datatypes in Oracle -III

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index Addon
LONG - store variable-length character data containing up to 2 GB
  • non-searchable, i.e., can not be queried as in where, like clause
  • used mostly for text data to be converted when moving among different systems
  • used in data dictionary to store the text of view definitions
  • can be used in SELECT lists, SET clause of UPDATE, and VALUES clause of INSERT
  • some restrictions in SQL statements
RAW and LONG RAW - for data that is not to be interpreted by Oracle. Intended for binary data or byte strings
Oracle allows some restricted implicit datatype conversions and provides a set of SQL functions for explicitly datatype conversions
See associated resources for more details on Oracle datatypes

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 39 Data Concurrency and Consistency in Oracle -I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index Addon
Any RDBMS must have the software mechanisms to achieve the following important requirements of an information management system :
  • Data must be read and modified in a consistent fashion
  • Data concurrency of a multi-user system must be maximized
  • High performance is required for maximum productivity from the many users of the database system
Concurrency control - simultaneous access of the same data by many users
  • must ensure data integrity for concurrent updates, inserts, deletes and queries of the same data from many users
  • as little interference as possible among concurrent transactions must be achieved and destructive interactions must be prevented.
Oracle resolves such issues by using various types of locks and a multi-version consistency model based on the concept of a transaction

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 40 Data Concurrency and Consistency in Oracle -II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index Addon
Transaction - a logical unit of work that comprises one or more SQL statements executed by a single user
A transaction begins with the user's first executable SQL statement
A transaction ends when it is explicitly committed or rolled back
Transactions provide the database user or application developer with the capability of guaranteeing consistent changes to data, as long as the SQL statements within a transaction are grouped logically
A transaction should consist of all of the necessary parts for one logical unit of work - no more and no less
Data in all referenced tables are in a consistent state before the transaction begins and after it ends.
Transactions should consist of only the SQL statements that comprise one consistent change to the data

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 41 Oracle RDBMS Supports Read-Consistency -I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Guarantees that the set of data seen by a statement is consistent with respect to a single point-in-time and does not change during statement execution (atomic operations or statement-level read consistency)
Ensure that readers of database data do not wait for writers or other readers of the same data
Ensure that writers of database data do not wait for readers of the same data
Ensure that writers only wait for other writers if they attempt to update identical rows in concurrent transactions
The simplest way to think of Oracle's implementation of read-consistency is to imagine each user operating a private copy of the database, hence called the multi-version consistency model

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 42 Oracle RDBMS Supports Read-Consistency -II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
When an update (written) occurs, the original data values changed by the update remains part of an uncommitted transaction, any user that later queries the modified data views the original data values
Only when a transaction is committed are the changes of the transaction made permanent
Only statements that start after another user's transaction is committed see the changes made by the committed transaction
A transaction is key to Oracle's RDBMS for providing read-consistency. This unit of committed (or uncommitted) SQL statements :
  • dictates the start point for read-consistent views generated on behalf of readers
  • controls when modified data can be seen by other transactions of the database for reading or updating

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 43 Data Concurrency and Consistency in Oracle -I

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Locking - control concurrent access to data
Intended to prevent destructive interaction between users accessing table data
Locks are used to achieve two important database goals
  • Consistency - ensure that the data a user is viewing or changing is not changed (by other users) until the user is finished with the data
  • Integrity - ensures that the database's data and structures reflect all changes made to them in the correct sequence

HELP! * GREY=local HTML version of LOCAL Foils prepared 4 April 1996

Foil 44 Data Concurrency and Consistency in Oracle -II

From Basic Discussion of Oracle 7 Relational Database CPS616 Basic Information Track for Computational Science -- Winter-Spring Semester 96. * See also color IMAGE
Full HTML Index
Oracle provides automatic (implicit) locking and manual (explicit) locking
  • Automatic locking - locking is performed automatically and requires no user action
    • depending on the action requested, implicit locking occurs for SQL statements as necessary
    • Row-level locking and table-level locking
    • One or more Oracle lock managers maintain locks
    • Two general types of locks - exclusive locks and shared locks
  • Manual locking - explicitly issued locks by a user on certain resources
    • override default locking
    • can be at either row-level or table-level
    • can be either exclusive or shared

Northeast Parallel Architectures Center, Syracuse University, npac@npac.syr.edu

If you have any comments about this server, send e-mail to webmaster@npac.syr.edu.

Page produced by wwwfoil on Sat May 24 1997