Directory listing of http: uap.unnes.ac.id ebook biblebook Visual Basic 6 com & Library Books

26
C H A P T E R

Overview of
Oracle8i









In This Cha pter

I

n this c hapter, I’ll intro duc e yo u to Orac le8i. I’ll c o ver the
key fac ilities inc luded with the pro duc t, its arc hitec ture,
and ho w sec urity wo rks. Then I’ll c o ver ho w to use Visual

Basic and ADO 2.5 with Orac le8i, inc luding ho w to build a
c o nnec tio n string and ho w Orac le’s data types map into
Visual Basic .

Overview
Orac le8i is the mo st widely used relatio nal database management system (RDBMS) in the wo rld. It’s well kno wn fo r its high
perfo rmanc e and stability. It runs o n mo st c o mputer systems,
inc luding mo st Unix variants suc h as Sun’s So laris, HewlettPac kard’s HP-UX, IBM’s AIX and OS/ 390 (MVS/ ESA/ XA), and
even Linux. Of c o urse it will also run o n Mic ro so ft Windo ws
2000/ NT Server o perating systems.
Orac le8i inc ludes these key features:

✦ High perfo rmanc e
✦ Integrated Internet c apabilities
✦ High availability with auto mated standby database
✦ Extensive Java and XML suppo rt
✦ Suppo rt fo r OLE DB and ODBC
✦ Suppo rt fo r data wareho using and Very Large Databases
(VLDB)


✦ Integratio n with Windo ws 2000 servic es and to o ls

Intro ducing O racle8 i
editio ns and utilities
Understanding the
Database architecture
Explaining the
Database data types
Co nnecting to
O racle8 i with ADO
Reviewing the
Security mo del










582

Part VII ✦ Oracle8i

Oracle8 i editions
Orac le8i c o mes in fo ur editio ns: Lite, Perso nal, Standard, and Enterprise. Sinc e the
same c o re database engine arc hitec ture is used fo r all o f these editio ns, c o mpatibility is assured thro ugho ut the pro duc t line.

The Lite Edition
Orac le8i Lite is targeted at enviro nments where the smallest po ssible database system is needed, like mo bile lapto p c o mputers, handheld c o mputers, and info rmatio n
applianc es. It inc ludes built-in replic atio n to Orac le8i Standard Editio n and Orac le8i
Enterprise Editio n to fac ilitate easy exc hange o f info rmatio n. While so me features o f
the larger versio ns o f Orac le8i are missing, yo u c an run Orac le8i Lite Editio n with
as little as o ne megabyte o f memo ry and five megabytes o f disk spac e.

The Personal Edition
Orac le8i Perso nal Editio n supplies a single user so lutio n that is targeted at develo pers who want to develo p and test their pro grams in a standalo ne situatio n and then
deplo y them against a Standard Editio n server o r an Enterprise Editio n server. Yo u
c an also use this Editio n in situatio ns where yo ur applic atio n suppo rts o nly a single

user o n a single c o mputer.
Yo u c an run Orac le8i Perso nal Editio n o n Windo ws 98, Windo ws 2000, and Windo ws
NT. It inc ludes all o f the same features and o ptio ns fo und o n Orac le8i Enterprise
Editio n, inc luding Advanc ed Queuing and Orac le Partitio ning. No te that so me features may rely o n fac ilities that aren’t present in Windo ws 98.
Tip

Freebie copy of Oracle8 i (at least for 30 days): You can dow nload a dem o version of the Personal Edition from Oracle’s Web site at technet.oracle.com.
You w ill be required to register before you can access this site, but there are no
charges for registering. This Web site also has a w ealth of inform ation that you w ill
find useful w hen w orking w ith Oracle databases.

The Standard Edition
Orac le8i Standard Editio n inc ludes all o f the to o ls nec essary to build ro bust multiuser applic atio ns. It represents an affo rdable alternative to the Enterprise Editio n
when yo u do n’t require all o f the advanc ed features. So me o f the key features o f the
Standard Editio n inc lude:

✦ Extensive Java support. While no t impo rtant to mo st Visual Basic pro grammers, this feature is useful when develo ping multi-platfo rm applic atio ns.

✦ Windows specific support. Inc ludes native ODBC and OLE DB drivers, suppo rt fo r Mic ro so ft Transac tio n Server, App Wizard fo r Visual Studio , and OLE
Objec ts fo r Orac le.


Chapter 26 ✦ Overview of Oracle8i

The Enterprise Edition
Orac le8i Enterprise Editio n is Orac le’s high-end datab ase management system. It
is targeted at applic atio ns that experienc e high vo lumes o f transac tio ns and that
req uire very high levels o f availab ility. So me o f the key features in the Enterprise
Editio n inc lude:

✦ Transparent Application Failover/ Automated Standby Database — a key to o l
fo r pro viding high availability. It allo ws yo u to have standby database server
that is ready to take o ver in c ase o f a database o r applic atio n failure.

✦ Oracle Parallel Server — a high perfo rmanc e feature that allo ws yo u to divide
yo ur database into multiple c hunks, where eac h c hunk exists o n a separate
physic al c o mputer. This allo ws fo r higher perfo rmanc e, sinc e multiple c o mputers are ac tively pro c essing data. The database servers are c lustered
to gether to fo rm a single view o f the system to make it easy to use.

✦ Oracle Partitioning — a feature that allo ws yo u to break large tables into
smaller, individually-managed tables, whic h c an be spread ac ro ss multiple

servers using Orac le Parallel Server. This feature is extremely useful when
managing data wareho uses.

✦ Internet File System — a feature that makes an Orac le8i database appear as a
shared netwo rk drive. It suppo rts a wide variety o f standard pro to c o ls, inc luding HTML, FTP, and IMAP4, whic h allo ws a large number o f users to sto re and
retrieve data using a platfo rm that o ffers better reliability than a no rmal netwo rked disk drive.

✦ Oracle Time Series and Oracle Spatial — to o ls that are useful when building a
data wareho use. Orac le Time Series allo ws yo u to sto red time stamped data
effic iently in an Orac le database, while Orac le Spatial allo ws yo u to analyze
data suc h as the pro ximity o f a c usto mer to a sto re lo c atio n.
Note

The best things in database aren’t free: Som e of the features available in the
Enterprise Edition are extra cost item s. Check the Oracle Web site for m ore inform ation about w hich item s aren’t standard and how m uch they cost.

Oracle8 i utilities
Orac le8i has the fo llo wing utilities that yo u will use while develo ping yo ur applic atio ns: SQL*Plus, Enterprise Manager, SVRMGR, PL/SQL, Net8, and Orac le Management
Server. The key utility is c alled SQL*Plus and is used fo r a number o f different tasks,
fro m c reating tables to testing sto red pro c edures. Enterprise Manager is a to o l similar

to SQL Server’s Enterprise Manager and is used to help yo u design databases and perfo rm o ther system management-related func tio ns.

583

584

Part VII ✦ Oracle8i

SQL*Plus
SQL*Plus is a general-purpo se query to o l like Mic ro so ft’s Query Analyzer. This to o l
allo ws yo u to enter SQL statements and exec ute them. There are two versio ns o f
this to o l. One o perates in a DOS windo w, while the o ther runs in its o wn windo w
(see Figure 26-1). Bo th versio ns are c o mmand-driven (i.e., yo u type c o mmands
rather than selec ting menu items and/ o r pressing butto ns).

Figure 26-1: Running SQL*Plus Worksheet in a w indow.

Enterprise M anager
The Enterprise Manager utility assists yo u with func tio ns typic ally perfo rmed by a
database administrato r, suc h as c reating databases, c reating users, and mo nito ring

the ac tivity o f yo ur databases (see Figure 26-2). It also inc ludes a number o f to o ls,
suc h as SQL*Plus Wo rksheet, that allo ws yo u to enter, edit, and run SQL c o mmands
in a graphic al enviro nment, as well as DBA Studio , whic h c an help yo u design yo ur
databases.

Chapter 26 ✦ Overview of Oracle8i

Figure 26-2: Running Enterprise Manager.

SVRM GR
The SVRMGR utility allo ws yo u to c o ntro l the databases running o n yo ur server (see
Figure 26-3). Yo u c an use this to o l to start and sto p yo ur database, as well as run
o ther SQL c o mmands. Like SQL*Plus, it has bo th windo wed and DOS-based versio ns.

Figure 26-3: Running SVRMGR in a com m and prom pt.

585

586


Part VII ✦ Oracle8i

Tip

Bigger is better: The norm al DOS w indow displays only 25 lines. You can increase
the num ber of lines displayed to 43 or 50 by right clicking on the icon in the
upper-left corner of the w indow and choosing Properties and then the Screen tab.
You can also enable the scrollbars to display even m ore lines. Both options m ake
it easier to see your results before they scroll off the top of the screen.

PL/ SQL
PL/ SQL is Orac le’s implementatio n o f the SQL standard. It inc ludes a number o f
extensio ns that make it a very po werful language fo r c reating sto red pro c edures. As
yo u might expec t, PL/ SQL is no t c o mpatible with T-SQL in many areas, suc h as pro c edural statements and data definitio n statements. Fo r the mo st part, statements
like Select and Update will wo rk the same as they do in o ther database systems.

Net8
Net8 isn’t really a utility as muc h as it is a c ritic al part o f the netwo rk c o mmunic atio ns required to o perate Orac le8i. It permits yo u to define vario us external c o mmunic atio ns pro to c o ls fo r different types o f c lients and translate them into an internal
database pro to c o l that is independent o f the c lients. On yo ur database server, Net8
is also used to handle database-to -database c o mmunic atio ns fo r things like remo te

database ac c ess and replic atio n. A c o py o f Net8 also runs o n yo ur lo c al c o mputer.
The OLE DB pro vider passes yo ur database requests to Net8, whic h in turn ro utes
them to the appro priate database server.
Note

By any other name: Net8 w as know n as SQL*Net in previous versions of the
Oracle database server.

Oracle M anagement Server
Orac le Management Server is a utility pro c ess that allo ws yo u to manage the vario us c o mpo nents in an Orac le8i database system. It runs as its o wn pro c ess and
maintains its o wn separate sec urity system. It is tightly integrated with Enterprise
Manager and pro vides fac ilities that allo w Enterprise Manager to manage multiple
database instanc es.

Understanding the Database Architecture
Like SQL Server, Orac le8i uses a true c lient/ server arc hitec ture. This means that the
database server runs in a different address spac e fro m the c lient pro gram, and the
c lient and server c an be run o n different c o mputers. Unlike SQL Server, Orac le8i c an
run o n a variety o f hardware platfo rms. This means that so me o f the func tio ns implemented o n Windo ws will lo o k and ac t a little differently than applic atio ns designed
fo r no n-Windo ws o perating systems. Ho wever, the c o re Orac le8i database arc hitec ture is the same no matter whic h o perating system is ho sting the database server.


Chapter 26 ✦ Overview of Oracle8i

Key database objects
Orac le8i c o nsists o f o ne o r mo re databases o n the database server. Eac h database
is kno wn as an instance . Unlike SQL Server, whic h maintains a single database
server with multiple databases beneath it, eac h Orac le8i database server is a
unique instanc e and requires an independent so ftware installatio n.

Tablespaces
Eac h database instanc e c o ntains a series o f o bjec ts kno wn as table space s, whic h
ho ld the data fo r yo ur database. Eac h tablespac e c o ntains o ne o r mo re physic al
files that are used to ho ld a c o llec tio n o f tables and indexes. One tablespac e is
reserved fo r system info rmatio n, while o ther tablespac es are used to ho ld applic atio n data.
A table (o r table partitio n if yo u partitio n the tables) c an’t span mo re than o ne
tablespac e. This means that there must be suffic ient spac e in the tablespac e fo r all
o f the tables in the tablespac e. If yo u run o ut o f disk spac e, yo u c an either inc rease
the spac e available in the existing physic al files o r add additio nal physic al files to
the tablespac e.

Tables
By no w, yo u are familiar with tables, so I wo n’t go into all o f the details abo ut ro ws
and c o lumns, but there are a few unique aspec ts to Orac le’s implementatio n. Eac h
ro w in the database has a unique value kno wn as a ro wid. This value is used to
lo c ate the ro w in the database.
Tables that are o ften ac c essed to gether c an be gro uped to gether to share the same
physic al sto rage. This pro c ess physic ally plac es the ro ws c lo se to gether fo r tables
that are jo ined to gether using Select statements. This arrangement c an make a big
differenc e in perfo rmanc e, bec ause when the data to be jo ined is in c lo se pro ximity,
fewer I/ Os are required. This tec hnique is kno wn as cluste ring.

Schemas
The sche ma represents a view o f the info rmatio n in yo ur database. It represents
a set o f tables and o ther database o bjec ts that c an be ac c essed by a user. As suc h,
a sc hema represents a go o d way to sec ure database o bjec ts. Only the database
administrato r is permitted to see the database o bjec ts in every sc hema in the
database.
It is impo rtant to no te that sc hemas are lo gic al views o f the database and are in no
way c o upled to tablespac es, unless o f c o urse the database administrato r c ho o ses
to assign all o f the tables fo r a partic ular sc hema to a partic ular tablespac e.

587

588

Part VII ✦ Oracle8i

Sequences
A se que nce is an o bjec t that generates numbers ac c o rding to a spec ified o rder. This
allo ws yo u to generate unique values fo r things like c o unters and timestamps to
guarantee that eac h ro w added to a table has a unique value.

Stored Procedures, functions, and packages
Rec all that sto re d pro ce dure s are pre-c o mpiled pro grams written in PL/ SQL that are
c o mpiled and saved in the database server fo r quic k exec utio n. Yo u have yo ur
c ho ic e o f writing pro c edures that do n’t return a value o r functio ns that return a single value. Sto red pro c edures c an also return a rec o rdset c o ntaining a c o llec tio n o f
ro ws selec ted fro m a table o r a view.
CrossReference

See Chapter 25, “Stored Procedures,” for a detailed discussion of stored
procedures.

A package is a way to gro up similar pro c edures, func tio ns, and variab les into a
single Orac le8i o b jec t. This has two primary advantages: first, that b ec ause all o f
the o b jec ts are c o mpiled into a single entity, c alls b etween func tio ns and pro c edures are faster, sinc e there is no need to searc h fo r and lo ad external ro utines;
and sec o nd, that managing o ne pac kage is easier than managing eac h o f the individual ro utines.

Triggers
Trigge rs are o ne way yo u c an enfo rc e referential integrity. Eac h time yo u exec ute a
Delete , Insert, o r Update statement, a sto red pro c edure will be c alled that c an c hec k
the c hanges to ensure that they are being made pro perly. Fo r instanc e, assume that
yo u have two tables with a o ne-to -many relatio nship. Yo u c an c reate a trigger that
will delete all o f the asso c iated ro ws in o ne table when yo u delete a rec o rd in the
o ther table.
Note

In the key of SQL: You can also use foreign keys to enforce referential integrity.

Synonyms
Syno nyms are basic ally just ano ther name fo r a database o bjec t. Suppo se yo u want
to c hange the name o f a table, but yo u’re no t c ertain that yo u’ve updated all o f the
applic atio ns that use the o ld name. Yo u c an c reate a syno nym fo r the table using
the o ld table’s name.

Chapter 26 ✦ Overview of Oracle8i

M emory architecture
One o f the keys to Orac le’s perfo rmanc e is its memo ry arc hitec ture. The key to
database perfo rmanc e is being able to avo id disk I/ O by pro per buffering o f info rmatio n in memo ry.
Tip

A gig here and a gig there makes for good performance: One thing I can’t stress
enough is that you need lots of m em ory to run a database server. A perfect relational database w ould have enough m em ory to hold everything it stores on disk.
In m ost cases, this isn’t possible because you have too m uch data on disk —but it’s
nice to dream .

System Global Area
Eac h instanc e o f an Orac le database has a blo c k o f memo ry c alled the System Glo bal
Area (SGA), whic h is used to ho ld shared reso urc es. All users have ac c ess to this
area. It is used fo r maintaining vario us types o f buffers, inc luding the library c ac he
where the SQL c urso rs are maintained, and the data dic tio nary c ac he, where the
struc tures that desc ribe the o bjec ts in the database are kept. This info rmatio n is
extrac ted fro m system tables, inc luding:

✦ USER_OBJECTS — c o ntains info rmatio n abo ut the vario us o bjec ts in the
database, plus a referenc e to o ther tables that c o ntain mo re detailed info rmatio n abo ut a spec ific type o f o bjec t.

✦ USER_TABLES — c o ntains the definitio ns o f the tables in the database.
✦ USER_TAB_COLUMNS — c o ntains the definitio ns fo r the c o lumns in the table.
✦ USER_SOURCE — c o ntains the so urc e c o de fo r sto red pro c edures.
✦ USER_SEQUENCES — c o ntains the definitio ns o f the sequenc es in yo ur
database.

✦ USER_INDEXES — c o ntains info rmatio n abo ut the indexes asso c iated with
eac h table.

Program Global Area
The Pro gram Glo bal Area (PGA) maintains info rmatio n o n the ac tive pro c esses running in the database. These pro c esses either perfo rm wo rk o n behalf o f a c lient applic atio n o r perfo rm bac kgro und pro c essing and mo nito ring o f the database server. Fo r
instanc e, when a c lient applic atio n requests a rec o rdset, a server pro c ess will retrieve
the nec essary ro ws (ho pefully fro m the SGA, o therwise fro m disk) and return them to
the c lient. A bac kgro und pro c ess, o n the o ther hand, might c o llec t perfo rmanc e statistic s, whic h c an be analyzed to determine bo ttlenec ks.

589

590

Part VII ✦ Oracle8i

Network architecture
While SQL Server is managed thro ugh a single server pro c ess, Orac le8i relies o n a
number o f different server applic atio ns. Eac h database instanc e has its o wn server
pro c ess, while there is ano ther server applic atio n devo ted to netwo rking. The netwo rking pro c ess uses a piec e o f so ftware kno wn as Net8 (desc ribed earlier in this
c hapter). Net8’s func tio n is to rec eive requests fro m c lient applic atio ns and pass
them o n to the appro priate database server fo r pro c essing. It is also respo nsible fo r
handling c o mmunic atio ns between the vario us database instanc es and fo r fac ilitating
c o mmunic atio ns between vario us database instanc es o n different c o mputer systems.

Oracle8 i data types
Orac le8i suppo rts a wide variety o f data types, as sho wn in Table 26-1.

Table 26-1
Oracle8 i Data Types
Oracle8i Data Type

Visual Basic Data Type

Comments

Bfile

Byte Array

Contains a binary large object up to
4 gigabytes in length.

Blob

Byte Array

Contains a binary large object that
can be up to 4 gigabytes in length.

Char

String

Since Char fields alw ays have a
fixed length, the length of the
String value w ill be the sam e as
the length of the field. A Char field
m ay contain up to 2,000 characters.

Clob

String

A character-oriented large object up
to 4 gigabytes in length.

Date

Date

A date and tim e value that is m ore
accurate than the Date data type.
The value w ill be rounded as
needed.

Decimal

Currency

Contains a packed decim al num ber
w ith up to 38 digits of precision.

Float

Single, Double

Uses the sam e storage form at as

Number.

Chapter 26 ✦ Overview of Oracle8i

Oracle8i Data Type

Visual Basic Data Type

Comments

Long

String

A character string w hose m axim um
length can be up to 2 gigabytes.

Long Raw

Byte Array

A binary string w hose m axim um
length can be up to 2 gigabytes.

Nchar

String

Contains a fixed-length Unicode
string w ith up to 2,000 characters.

Nclob

String

A character-oriented large object
containing Unicode characters.

Number

Currency

Contains a packed decim al num ber
w ith up to 38 digits of precision.

Nvarchar2

String

Contains a variable length Unicode
string w ith up to 4,000 characters.

Raw

String

A binary string up to 2,000 bytes
long.

Rowid

String

The internal form at is autom atically
converted to a String value.

Varchar2

String

Contains a variable length String
w ith a m axim um length of 4,000
characters.

Connecting to Oracle8 i
Building an ADO c o nnec tio n string fo r an Orac le8i database invo lves spec ifying values fo r the pro vider and the database, as sho wn belo w:

Provider=MSDAORA.1; Data source=vb6db.Athena.justpc.net
Yo u c an also inc lude the User ID= and Password= keywo rds if yo u want to add
that info rmatio n as part o f the c o nnec tio n string, o r yo u c an supply them as arguments to the Open metho d.
Yo u c an also c o nfigure the Orac le OLE DB pro vider via the Data Link Pro perties windo w. The first step is to selec t the Mic ro so ft OLE DB Pro vider fo r Orac le (see Figure
26-4). After pressing the Next butto n, yo u c an enter the name o f yo ur Orac le database
server and o ptio nally spec ify yo ur user name and passwo rd (see Figure 26-5). Yo u
c an verify that the info rmatio n yo u entered was c o rrec t by pressing the Test
Co nnec tio n butto n.

591

592

Part VII ✦ Oracle8i

Figure 26-4: Choosing the Oracle provider.

Figure 26-5: Specifying values for the
key connection properties.

Tip

There’s always a choice: Oracle also has a provider for OLE DB that you m ay w ish
to try, and there are third party OLE DB providers that m ay outperform both
Microsoft’s and Oracle’s, though at a considerable cost in tim e and m oney.

Note

A provider is only provider: The Oracle provider supplied by Microsoft only translates the calls from your Visual Basic program into som ething that the Oracle8 i client
softw are on your com puter w ill understand. You m ust install a copy of Net8 on your
client com puter for any program to com m unicate w ith an Oracle8 i database.

Chapter 26 ✦ Overview of Oracle8i

Oracle8 i Security
In o rder to ac c ess an Orac le8i database, yo u must be pro perly authentic ated and
autho rized. Authentic atio n ensures that the user name and passwo rd asso c iated
with an individual is valid befo re ac c ess is granted to the database server. Onc e
the users have been granted ac c ess to the server, everything that the users c an
perfo rm is based o n the permissio ns they have been autho rized.

Authentication
In o rder to ac c ess an Orac le database, every user must have a valid user ID and a
valid passwo rd. This info rmatio n is usually kept in the database, tho ugh Orac le
do es inc lude ho o ks to use an external direc to ry, suc h as the Windo ws 2000 Ac tive
Direc to ry o r Kerbero s.

Authorization
Inside Orac le8, yo u must b e granted the privilege to ac c ess a partic ular datab ase
o b jec t o r c o mmand. In fac t, witho ut the pro per privileges, yo u c an’t even c o nnec t
to the datab ase, even if yo u had a valid user ID and passwo rd. Privileges are managed using the Grant and Re voke SQL statements, o r b y using the Enterprise
Manager utility’s GUI interfac e. The two types o f privileges, o b jec t privileges and
system privileges, are disc ussed next. Ob jec t privileges dic tate the user’s ac c ess
to a spec ific datab ase o b jec t, while system privileges determine the user’s ab ility
to exec ute spec ific Orac le and SQL statements.

Object privileges
Obje ct privile ge s spec ify whic h c o mmands c an be used against spec ific database
o bjec ts. Depending o n the o bjec t, yo u apply the privileges sho wn in Table 26-3.
The syntax fo r the Grant statement to apply o bjec t privileges lo o ks like this:

Grant On To [With Grant Option]
where c o ntains a list o f o ne o r mo re privileges separated by c o mmas selec ted fro m Table 26-2; spec ifies the database o bjec t that the
privileges are asso c iated with;and is a list o f o ne o r mo re user names
separated by c o mmas that will rec eive the privileges o r the keywo rd Public indic ating that any database user may have the privilege. The With Grant Option c lause
allo ws the user rec eiving the privilege to pass it alo ng to o ther users by using the
Grant statement.

593

594

Part VII ✦ Oracle8i

Caution

With Grant Option security can really be compromised: Because you passed on
the ability to control security to another user, they can pass it on to others. Thus,
people that you m ay not w ant to have access to the object m ay get access from
som eone else. While using the With Grant Option is necessary to im plem ent a
distributed security m anagem ent system , you m ust use it w ith care to ensure that
only authorized users can access your database.

Table 26-2
Object Privileges
Statement

Associated Privileges

Alter

Tables, Sequences, Snapshots

Delete

Tables, View s

Execute

Procedures, Functions, Packages, Libraries, Types

Index

Tables

Insert

Tables, View s

Read

Directories

References

Tables

Select

Tables, View s, Sequences, Snapshots

Update

Tables, View s, Snapshots

Fo r example, if yo u wanted to allo w Jill to retrieve and update info rmatio n in the
Custo mers table, but no t insert o r delete ro ws, yo u wo uld use this Grant statement:

Grant Select, Update On Customers To Jill

System privileges
Syste m privile ge s c o ntro l the ability to exec ute spec ific Orac le and SQL statements.
Like o bjec t privileges, system privileges are based o n the c o nc ept o f allo wing a user
to use a spec ific c o mmand. Unlike o bjec t privileges, system privileges allo w yo u to
use that c o mmand o n any o bjec t o r against the database itself (see Table 26-4).
No te that so me o f the privileges desc ribe general c apabilities within the database
server, and no t just the ac tual c o mmands used to perfo rm a task. These are also
listed in Table 26-4.

Grant To [With Admin Option]
where is a list o f o ne o r mo re system privileges, separated by c o mmas, c ho sen fro m Table 26-3, and is a list o f o ne o r mo re user names separated by c o mmas.

Chapter 26 ✦ Overview of Oracle8i

The With Admin Option c lause allo ws the user to pass the privilege to ano ther user.

Table 26-3
System Privileges
Command

Associated Privileges

Alter

Any Cluster, Any Index, Any Procedure, Any Role, Any Sequence, Any
Shapshot, Any Table, Any Trigger, Any Type, Database, Profile,
Resource Cost, Rollback Segm ent, Session, System , Tablespace, User

Analyze

Any

Audit

Any, System

Backup

Any Table

Becom e

User

Com m ent

Any Table

Create

Any Cluster, Any Directory, Any Index, Any Library, Any Procedure,
Any Sequence, Any Snapshot, Any Synonym , Any Table, Any Trigger,
Any Type, Any View, Cluster, Database Link, Directory, Library,
Procedure, Profile, Public Database Link, Public Synonym , Role,
Rollback Segm ent, Session, Sequence, Snapshot, Synonym , Table,
Tablespace, Trigger, Type, User, View

Delete

Any Table

Drop

Any Cluster, Any Directory, Any Index, Any Library, Any Procedure,
Any Role, Any Sequence, Any Snapshot, Any Synonym , Any Table,
Any Trigger, Any Type, Any View, Library, Profile, Public Database Link,
Public Synonym , Rollback Segm ent, Tablespace, User

Execute

Any Procedure, Any Type

Force

Any Transaction, Transaction

Grant

Any Privilege, Any Role

Insert

Any Table

Lock

Any Table

Select

Any Sequence, Any Table

Update

Any Table

Non-com m and
based privileges

Manage Tablespace, Readup, Restricted Session, Unlim ited
Tablespace, Writedow n, Writeup

595

596

Part VII ✦ Oracle8i

Roles
Managing permissio ns fo r individual users c an be o verwhelming o n a database system with a large number o f users. Thus, Orac le8i also uses the c o nc ept o f ro les to
simplify database administratio n. A ro le represents a c o llec tio n o f privileges that
c an be assigned to a user. If yo u assign a ro le to a user, the user inherits all o f the
privileges in the ro le. Likewise, if yo u add a privilege to an existing ro le, all o f the
users that are assigned that ro le will auto matic ally rec eive the new privilege.
When granting privileges to a ro le, yo u use the same Grant statement that yo u
wo uld use fo r an o bjec t privilege. Yo u simply spec ify the name o f the ro le in plac e
o f the user. Fo r instanc e, yo u wo uld use the fo llo wing statement to grant the Select
privilege to the Clerks ro le:

Grant Select To Clerks
When granting a ro le to a user, yo u use the fo rm o f the Grant statement used to
asso c iate system privileges to a user. In this c ase, the ro le is substituted fo r a system privilege. The fo llo wing statement sho ws ho w to grant the Clerks ro le to the
user Samantha. When exec uted after the previo us Grant statement, Samantha will
be able to use the Select statement.

Grant Clerks To Samantha

Thoughts on Oracle8 i
Oracle8 i is a high-perform ance database that runs on m any different hardw are and softw are platform s. It is also m ore difficult to install and m aintain than SQL Server. If you need
the biggest, fastest database m anagem ent system in existence today, Oracle8 i should be at
the top of your list, since it runs on the biggest com puter system s available. Com panies like
Am azon.com and eBay rely on Oracle database servers.
How ever, this pow er com es at a cost. You really need an experienced Oracle DBA to m aintain your database. Unlike SQL Server, w hich contains a large num ber of w izards to perform
routine tasks, Oracle8 i doesn’t. If you’re not very fam iliar w ith Oracle databases in general,
you need som eone to help you set up the various processes and ensure that they w ork
properly.
The other dow nside to Oracle8 i is its cost. Oracle know s that Oracle8 i is the highest perform ance database on the m arket today and charges accordingly. While it is hard to argue
about the value of Oracle8 i , it is im portant to note that solutions from other database vendors m ay be less expensive. Of course, if your application is large enough, then your only
option m ay be Oracle, no m atter how m uch the com petition charges for their softw are.

Chapter 26 ✦ Overview of Oracle8i

I som etim es look at this issue from a m ainfram er’s perspective. In the m ainfram e w orld,
operating system softw are, including database m anagem ent system s, are very com plex
products that are highly adjustable. You can’t sim ply install a package and begin using it. It
usually takes anyw here from a few days to a few m onths to install a piece of softw are.
Som e of this tim e is spent selecting options and setting various param eters in order to
m ake the softw are w ork, w hile the rest of the tim e is spent ensuring that you have the right
options set.
A person that is experienced in the softw are package can set the options m uch m ore
quickly than a person learning the softw are. But in the long run, having lots of options to
select and param eters to set allow s an organization to m ake the softw are really fly by, elim inating the options not needed and tw eaking the other settings so that each function perform ed by the database gets the resources it needs.

Summary
In this c hapter yo u learned:

✦ abo ut the Orac le8i database server and the vario us editio ns that are available.
✦ abo ut the majo r utilities and key c o mpo nents.
✦ abo ut the Orac le8i database arc hitec ture.
✦ abo ut the data types available in Orac le8i and ho w they map into Visual Basic
data types.

✦ ho w to c o nnec t to an Orac le8i database with ADO.
✦ abo ut Orac le8i sec urity.







597