Vous êtes sur la page 1sur 22

C H A P T E R

Introducing Oracle8

1
3 3

In This Chapter

n alternative title for this chapter might be Look Before You Leap. Here you will nd a review of the new features that make Oracle8 different from Oracle7. The installation choices are outlined and briey examined here. This chapter takes you on a quick tour of the database. After installation you will nd that your database already takes up about 50MB of storage. Whats in that space? Youll review the Users, Roles, and some of the Tables that are built-in and preinstalled. Finally, you get a sneak peek at the sample Tables you can choose to install especially for use with this book: the Oracle8 Bible Sample Tables.

Examining new Oracle8 features Making decisions before installation Touring a few of Oracle8s tools Examining initial contents of the database Looking at this books sample Tables

New Features of Oracle8


The new features of Oracle8 enhance the features of Oracle7.3. If you have an existing Oracle7 database, all your Tables, Indexes, Triggers, and so forth will migrate seamlessly into Oracle8. As a group, all the new features fall into one of the following three categories: very large database support, Object-oriented support, and Enhanced Toolset. The next sections discuss each new feature youll nd in Oracle8.

Very large database support


Oracle8 can support tens of thousands of concurrent Users and robust Internet applications such as online shopping or airline reservations. Oracle8 can support thousands of gigabytes of storage within a single database. Databases today barely approach this size. Large data warehouses, however, are growing both in size and popularity.

Chapter 13 Introducing Oracle8

Imagery and multimedia storage tend to cause a jump in the data storage needs of a database. Oracle8 has modied its support for the following large Objects (LOBs) by creating several new datatypes. Heres how: 3 BLOB, CLOB, and NCLOB datatypes. These types store up to 4GB of data in a single instance of a Column. Each of the three types has a special use. Imagery, audio, long text les, or les containing foreign language characters are stored in these datatypes. The data is actually stored within the database. 3 BFILE datatype. This type also stores up to 4GB of data in a single Column. The data is stored outside the database in a designated le, however. Videos may be stored this way, enabling them to be accessed by applications (such as a video editor) that do not retrieve or save the data through the database itself. 3 LONG datatype. You can still use the LONG datatype; however, Oracle recommends that you use the other LOB datatypes for any new LOBs you create.

Object-oriented support
Object-oriented features introduce Object-oriented Objects into the relational database, making Oracle8 a hybrid, or Object-relational, database. As an Object-relational database, Oracle8 supports all the familiar relational database concepts of Tables, Columns, rows, and relationships. It also supports a subset of the Object-oriented features of types, methods, and attributes. There are many more features within a strictly Object-oriented database that may eventually become part of Oracle8 in later releases. Currently, though, you can get your feet wet with the existing features in Oracle8. Here is a quick list of the primary Objectoriented features: 3 Object types. Use Object types to create customized datatypes. You can then use these new types in place of the predened datatypes (such as DATE or VARCHAR2) in Object Tables. 3 Object views. Use Object views to store data in relational Tables and access them using Object techniques. 3 Object extensions. Manipulate and dene Objects easily with new commands in SQL and PL/SQL. The commands are in compliance with new Objectoriented standards for SQL. 3 Programmatic interfaces. Reach Oracle8 Objects using the Object extensions added to the precompilers for C and C++ (Pro*C), COBOL (Pro*COBOL) as well as in PL/SQL programs, and OCI programs. Java support is coming soon.

Chapter 1 3 New Features of Oracle8

Enhanced Toolset
New utility features described in this section enhance the set of tools for the DBA, system administrator, and designer. The addition of Enterprise Manager as a standard part of the Oracle8 Package is an outstanding improvement in the tools available for the DBA and the database designer. Chapter 2 describes each component briey and the components appear in other chapters throughout the book. The Enterprise Manager includes these components:

3 Storage Manager

3 Schema Manager

3 Security Manager

3 SQL Worksheet 3 Data Manager 3 Backup Manager

3 Instance Manager 3 Administrator Toolbar 3 Console Oracle8 has so many useful tools its hard to decide which one to use for a particular task. In the Reference section of the book, I make tool recommendations for all listed commands as an effort to guide you through the maze of new tools.

Chapter 13 Introducing Oracle8

Oracle8 includes a host of assistants for helping convert data, create code, Export, Import, and restore a damaged database. (Chapter 5 discusses many of these assistants.) Some assistants follow: 3 Oracle Migration Assistant for Microsoft Access 3 Oracle Data Migration Assistant 3 Oracle Database Assistant 3 Oracle Web Publishing Assistant Finally, the new online documentation is vastly easier to use because your Web browser presents it as HTML pages. A Java-based Index tool enables you to search for any words in one or more sections of the full documentation set. Believe me, this is a welcome relief after the last few disastrous iterations of Oracles online documentation.

A Quick Tour of Oracle8


Lets take a whirlwind tour of Oracle8 with short stops at a few interesting sights along the way. Later, this book covers much of the terminology, commands, and syntax youll need to get the most out of the Oracle8 engine.
Note

If you do not have an Oracle8 database installed, return here after you install your database, park the book next to your computer keyboard, and follow along on the whole tour.

First stop: Instance Manager


The Instance Manager shows you a high-level view of your databases current activity. This section assumes you have access to a DBA User and password. You can use the standard Oracle8 User, SYSTEM, if you wish. The default password for SYSTEM is MANAGER. Follow these steps to look at the Instance Manager: 1. Start the Instance Manager. If you have Windows NT, click Tools Applications Oracle Instance Manager. To log in, type INTERNAL in the User box and ORACLE (or whatever your current password is) in the Password box. Either leave the Service box blank or type in the appropriate name of your Oracle instance. This sequence brings you to the Instance Managers main window, as you see in Figure 1-1.

Chapter 1 3 A Quick Tour of Oracle8

Figure 1-1: The Instance Manager shows the status and current activity of the database.

2. Observe the trafc light. If the light is green, your database is open and running. Oracle8 opens the database when it is needed. Often, you do not have to explicitly start it yourself. If the light is red, your database is closed and you need to start it. 3. Start the database if necessary. If the trafc light is red, start the database by clicking the Database Open radio button in the right window. Clicking Apply prompts you for initialization parameters. Click OK to use the default set of parameters. Then a status message appears saying Oracle8 is running. Click OK; the trafc light is now green. 4. Double-click the Sessions folder in the left frame. You see a list of sessions currently active in your database. The rst six sessions are the background processes that run the Oracle8 engine. The remaining sessions are other Users logged in to the database. 5. Click any session. Figure 1-2 shows the details you see for each session using the database. You see the User, Terminal, and the program running for the session.

Chapter 13 Introducing Oracle8

Figure 1-2: Observe your Users with a click of a button.

6. Exit the Instance Manager by clicking the X box in the upper-right corner. Now go to another useful tool for database designers and DBAs the Schema Manager:

Second stop: Schema Manager


First, make sure your Oracle8 database is running by following the steps in the previous section. Then follow these steps to start up the Schema Manager: 1. Start the Schema Manager. If you have Windows NT, select Start Programs Oracle Enterprise Manager Schema Manager. A log in window appears and asks for your input. 2. Log in as the SYSTEM User or any DBA User. The User SYSTEM comes with every Oracle8 database. The default password for SYSTEM is MANAGER. Leave the Service box blank to reach your PCs database or type in the instance name of the Oracle8 database on your network. Leave the Connect As box defaulting to Normal. Once you log on, you will see the initial screen of the Schema Manager.

Chapter 1 3 A Quick Tour of Oracle8

3. Double-click the Tables folder in the left half of the window. A list of Tables appears in the right half. A list of Schemas (Table owners) appears under the Tables folder in the left half of the window. Your screen should look like Figure 1-3. Schema Manager arranges Objects such as Tables and Indexes in an orderly format, similar to a Windows File Manager or Windows 95 Explorer window. Navigate within the Schema Manager as you would in these utilities. Pulldown menus display your options. Clicking selects an item while rightclicking displays a context-sensitive pop-up menu.

Control menu button Object window

Main menu bar Title bar Toolbar

Object contents window Window controls

Status line Figure 1-3: Schema Manager manages database Objects such as Tables.

4. Double-click the Tables folder in the left frame. A list of Tables appears in both the left and right frames. 5. In the left frame, click the rst Table in the list. The right frame changes to display a tabbed window that describes the highlighted Table. Figure 1-4 shows the components of this window. The basic structure you see in the gure is common to most of the Enterprise Manager tools.

10

Chapter 13 Introducing Oracle8

Figure 1-4: The Schema, Security, and Storage Managers all have this type of layout.

6. Exit the Schema Manager by clicking the X box in the upper-right corner. The Schema Manager can create Tables, Indexes, Primary and Foreign Keys, sequences, Synonyms, and much more. Save time with Schema Manager there is no need to write an SQL command. As you become familiar with the Schema Manager, youll soon know which tool to use for all your various tasks. To help, I added special icons in the Reference section showing you which tool to use as a substitute for writing the SQL. For example, the Schema Manager Icon you see next to this paragraph is also located next to the CREATE TABLE command in the Reference section.

Third stop: Storage Manager


The Storage Manager monitors disk space and le size and also displays the mapping between Tablespaces and actual les. Use Storage Manager to add new les to your database. Follow these steps to view the Storage Manager: 1. Start the Schema Manager. If you have Windows NT, select Start Programs Oracle Enterprise Manager Schema Manager. A log in window appears and asks for your input.

Chapter 1 3 A Quick Tour of Oracle8

11

2. Log in as the SYSTEM User or any DBA User. The User SYSTEM comes with every Oracle8 database. The default password for SYSTEM is MANAGER. Leave the Service box blank to reach your PCs database or type in the instance name of the Oracle8 database on your network. Leave the Connect As box defaulting to Normal. Once you log on, you see the initial screen of the Storage Manager. 3. Click the Tablespace folder in the left half of the window. A list of Tablespaces appears in the right half. The list appears as a usage graph showing occupied space and remaining space in each of your Tablespaces. Your screen should look like Figure 1-5.

Figure 1-5: The Storage Manager displays bar graphs of space usage in the used (M) column.

4. Click the plus sign next to the Datales folder in the left frame. A list of les appears below the Datales folder in the left frame. 5. In the left frame, click the rst datale in the list. The right frame changes to display a tabbed window describing the highlighted datale, as shown in Figure 1-6. Change datale characteristics here. For example, to enlarge the datale, adjust the le size in the box.
Tip

Whenever you make changes in the Storage Manager or in any of the other tools (Schema, Security, and so on), the tool generates SQL code that you can view by pressing the Show SQL button before you apply the change. You can change the SQL commands for later use or view them simply for your own education a great way to learn SQL commands.

12

Chapter 13 Introducing Oracle8

Figure 1-6: The Storage Manager can add to a datale or change its extents.

6. Exit the Storage Manager by clicking the X box in the upper-right corner. The Storage Manager can create new Tablespaces or datales. You can add more space to your database here. You can also take a Tablespace ofine to prepare it for backup. The nal stop in our quick tour shows you Oracle8s new tool for running SQL commands.

Final stop: SQL Worksheet


SQL Worksheet is one of the tools in Oracle Enterprise Manager. To start SQL Worksheet, follow these steps: 1. Select the SQL Worksheet menu option. If you have Windows NT, choose Start Programs Oracle Enterprise Manager SQL Worksheet. 2. Fill in a Valid User, password, and service in the security screen that pops up. If you dont have your own, use Oracle8s sample User (SCOTT) and password (TIGER). The password shows up as asterisks (*) when you type. Leave the Service box blank if you work on a local database. Otherwise, type the name of the Oracle database to which you will connect.

Chapter 1 3 A Quick Tour of Oracle8

13

Accept the Connect As box as Normal. The SQL Worksheet appears. Figure 1-7 shows the SQL Worksheet window that you can use to type your commands. The window divides horizontally into two frames. The bottom frame is the area in which you type SQL commands. The top frame displays the command and the results of the command.

Figure 1-7: Use the SQL Worksheet to write and execute SQL commands.

3. Type the following SQL command in the bottom frame.


SELECT * FROM ALL_TABLES

4. Click the Execute button the lightning bolt button. You see the command copied to the top half of the screen. Then you see results miraculously appear, as in Figure 1-8. Use the draw bar on the right side and bottom of the top frame to view all the results, if necessary. 5. Close the SQL Worksheet by clicking the X button in the upper-right corner of the window. The SQL Worksheet enables you to test SQL commands. The mouse-driven editing capabilities make it a great tool for developing SQL, even if the SQL later gets incorporated into a C++ program or a form. Unless you explicitly COMMIT your commands, all DML commands are rolled back when you exit the SQL Worksheet.

14

Chapter 13 Introducing Oracle8

Figure 1-8: SQL Worksheet runs your commands and shows the results.

The next section briey discusses the critical decisions you must make before installing the Oracle8 database.

Before You Install


You and your organization must make a few important choices before installing the Oracle8 database. These choices affect how the database gets installed in the system. The Oracle8 Documentation contains a section on installation that describes the various choices you have for installation. To reach the documentation prior to installation, follow these steps: 1. Insert the Oracle8 CD-ROM in your computer. After inserting the self-starting CD-ROM, you see an initial window, provided you have your autorun feature on. If you have turned off the autorun feature, you must run the setup.exe le found on the CD-ROM. The initial window shows the three selections available: Begin Installation; Browse Information; and Explore CD. 2. Select Browse Information. Your default Web browser starts and displays an introduction page. Several choices enable you to read Oracle8 product line information.

Chapter 1 3 Before you Install

15

3. Select Documentation. The Documentation button launches the documentation for the entire Oracle8 Package. Use this documentation to view preinstallation data. Figure 1-9 shows the initial page for Oracle8 Documentation.

Figure 1-9: The Oracle8 Documentation uses your Web browser and Java.

4. Select JAVA VERSION. The Java Version of the documentation provides interactive search capabilities. When the Java Version starts up, you have a small window with a list of documents similar to the Windows Explorer, as shown in Figure 1-10. 5. Click the plus sign next to Installation and then click Oracle8 Enterprise Edition. These actions launch the Table of Contents for the Installation documentation. The documentation in the Installation section describes the options for installing either the Oracle8 Enterprise server or the Oracle8 client. It also discusses the hardware and software requirements.

16

Chapter 13 Introducing Oracle8

Figure 1-10: The Java window has a Table of Contents for the current section.

6. Click the sections you wish to read. You should review special considerations before installation. The next sections summarize the installation documentation. Remember, this book does not substitute for careful reading of the preinstallation and installation instructions provided by Oracle. It gives you a good overview of primary issues to consider when installing the software, however.

Client or server or both


The Oracle8 Package has two parts: the server and the client. Chapter 2 details the contents of the server and the client. Table 1-1 quickly lists the contents of each Package. The client Package has two options: Application User and Database Administrator. The Oracle8 Package options are broken down as follows:

Table 1-1 Oracle8 Product Matrix


Product Enterprise Edition Oracle8 Utilities Oracle Replication Manager Server YES YES YES Client (Application User) NO NO NO Client (Database Administrator) NO YES YES

Chapter 1 3 Before you Install

17

Product Oracle8 Object Type Translator Oracle Call Interface Oracle Enterprise Manager Products/Toolbar SQL*Plus Oracle Objects for OLE Oracle8 ODBC Driver Oracle8 Documentation Oracle Trace Collection Services Java Runtime Environment Oracle8 Client Net8 Server Oracle Database Assistant Oracle Data Migration Assistant Oracle Intelligent Agent Oracle Names Server Oracle Migration Assistant for Microsoft Access Oracle Web Publishing Assistant Oracle8 Performance Utility Oracle Installer Net8 Client Oracle Names Server

Server YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES YES NO YES YES NO YES

Client (Application User) NO NO NO YES YES YES YES YES YES YES NO NO NO NO NO YES NO NO YES YES YES

Client (Database Administrator) YES YES YES YES YES YES YES YES YES YES NO NO NO NO NO YES YES NO YES YES YES

Enhance the server with additional cartridges for a license fee. If you purchase the license, these Cartridges come installed with your server: 3 Oracle8 Context Cartridge Workbench 3 Oracle8 Context Cartridge 3 Oracle8 Spatial Cartridge Utilities

18

Chapter 13 Introducing Oracle8

3 Oracle8 Spatial Cartridge 3 Oracle8 Image Cartridge 3 Video Cartridge


CrossReference

See Chapter 5 for more information about these cartridges.

Fresh installation or migration from Version 7


When creating a brand-new (fresh) Oracle8 installation on a system that does not contain an older version of Oracle, read and follow the entire installation manual carefully. If you have an older version of Oracle on a different computer, your Oracle8 installation is still considered a fresh installation. If you have a current Oracle database running and want to overlay that database with Oracle8, this option includes a migration of all your existing data into the new Oracle8 structure. Oracle makes the migration from Oracle7 to Oracle8 efcient because you do not move or copy the actual database data. The Data Dictionary of the current database upgrades to Oracle8 structure. The migration takes a short amount of time for any database, regardless of size.
Caution

The documentation contains detailed information on how to migrate from many older versions to the version you are about to install. Read the documentation to avoid pitfalls that could cause your migration to fail. To nd the documentation: 1. Access the documentation. Follow Steps 1 through 4 found at the beginning of the section Before You Install earlier in this chapter. 2. Click the plus sign next to Release Notes and then click Oracle8 Enterprise Edition. This sequence brings up the Table of Contents for the Release Notes documentation. 3. Click the Migration link. The documentation in the migration section describes important notes critical to a successful migration from older versions of the database.

Upgrade from earlier Oracle8 versions


When upgrading, you simply review the README le included with the upgrade for any platform-specic or release-specic instructions. Generally speaking, your old version of the Oracle Installer handles the upgrade. The next sections describe standard Oracle8 database contents.

Chapter 1 3 Initial Basic Database Contents

19

Initial Basic Database Contents


An Oracle8 database contains the basic structures needed to keep track of everything you add to the database. Tables, Indexes, views, Users, Synonyms, and Roles are all preloaded for this purpose. All of these structures are critical to the proper functioning of your database; you should not change them in any way without specic instructions from Oracle Support. In addition to these critical items, the fresh Oracle8 database contains Users, Roles, Tables, Indexes, and relationships to simplify database administration. The following sections describe the preloaded Users, Roles, and Tables. A nal section describes Tables you can add especially for use with this book: the Oracle8 Bible Sample Tables.

Users
Do not remove certain preinstalled Users from the database. These Users own critical for internal use only Tables and Objects. To learn about all the preinstalled Users, see Table 1-2. Do not change or remove Users with YES in the Critical Column.
Note

The following Table displays the Users and passwords that automatically install when you select the typical database option. If you chose the custom database option, your User passwords are set as whatever you chose during installation. Also, some of the Users may not have been installed, depending on what options you selected during installation.

Table 1-2 Preinstalled Users in Oracle8


User INTERNAL SYS SYSTEM SCOTT DEMO DBSNMP Password ORACLE CHANGE_ON_INSTALL MANAGER TIGER DEMO DBSNMP Critical YES YES YES NO NO NO Usage Alias for SYS. Not a true User. System DBA. Owns many Internal database Tables used by Oracle8 engine. DBA. Owns many Data Dictionary views. Use as your DBA. Owns a small test Schema that Oracle documentation references frequently. Owns a small test Schema that Oracle Documentation references frequently. Oracle Enterprise Manager Administrator.
(continued)

20

Chapter 13 Introducing Oracle8

Table 1-2 (continued )


User CTXSYS ORDSYS MDSYS Password CTXSYS ORDSYS NO MDSYS NO Critical NO Usage Context Cartridge Administrator.

Image Cartridge Administrator. Spatial Cartridge Administrator.

Note

Change the passwords for the Administrator Users (SYS, SYSTEM, ORDSYS, MDSYS, and CTXSYS) as soon as possible after installation to protect the security of your database.

Roles
Roles primarily help dene security in the database. They also give you a convenient way of grouping related privileges together to assign to groups of Users. Table 1-3 shows the preinstalled Roles in a new Oracle8 database.

Table 1-3 Preinstalled Roles in Oracle8


Role CONNECT RESOURCE DBA CTXADMIN CTXAPP DELETE_CATALOG_ROLE EXP_FULL_DATABASE IMP_FULL_DATABASE Usage Log into the database only Create new Objects (Tables, Indexes, Objects, and so forth) Perform DBA functions such as creating new Users or altering Table structure Context Cartridge Administration Context Cartridge Applications User Allowed to delete Audit Trail records Export entire database Import entire database

RECOVERY_CATALOG_OWNER Allowed to run a recovery SELECT_CATALOG_ROLE Able to view Data Dictionary views

Chapter 1 3 Initial Basic Database Contents

21

Tables
Familiarize yourself with the demonstration Tables included in every Oracle database. The database User named SCOTT (password: TIGER) owns four important Tables loaded in your database. In these four Oracle8 demonstration Tables, a simple set of relationships enables experiments with all the basics of SQL. All of Oracles manuals contain examples with these same Tables. You can nd out more about the sample Tables by reviewing the data in each Table. Type the following SQL to view the Table contents:
SELECT SELECT SELECT SELECT * * * * FROM FROM FROM FROM EMP; DEPT; BONUS; SALGRADE;

Oracle8 Bibles sample Tables


I have lled this book with examples of code. These examples provide step-by-step instructions on how to perform many tasks in the Oracle8 database. After installing your Oracle8 database, you can install all the sample Tables used here into your database. For your convenience, I provide these Tables (plus instructions for installing the Tables into your database) on the accompanying CD-ROM. Once you install these Tables in your database, you can run most of the example code exactly as you see it in the book. Figure 1-11 shows a detailed relational database diagram of all the sample Tables on the CD-ROM. Appendix A contains both the installation instructions and a detailed listing of the Tables contents.

22

Chapter 13 Introducing Oracle8

SEA ANIMAL PARK

CARETAKER CARETAKER_NAME

TANK TANK_NO CHIEF_CARETAKER_NAME (fk)

CHECKUP CHECKUP_TYPE

AQUATIC_ANIMAL ID_NO TANK_NO (fk) PARK_REVENUE CHECKUP_HISTORY CHECKUP_TYPE ID_NO ACCOUNT_NO

LIBRARY
PERSON PERSON_ID BOOKS BOOK_ID

BOOKS_LOANED BL_LOAN_ID BL_BOOK_ID BL_PERSON_ID

BOOKS_RESERVED RESERVED_ID RESERVED_BOOK_ID RESERVED_PERSON_ID

Figure 1-11: The Oracle8 Bible Sample Table contains many sets of relationships.

Summary
Oracle8 has many new features that the DBA and database designer will welcome. Oracle8 handles massive amounts of data by using partitioned tables that can span disk drives. With the new data types for large objects, up to 4GB can be stored in a single Column. True Object-oriented Objects, types, and methods help Oracle8 begin to transition from a strictly relational database to an Object-relational database.

Chapter 1 3 Summary

23

The Enterprise Manager and a host of assistants add user-friendly features for database management tasks. Start and stop your database and modify initialization parameters in the Instance Manager. Create Tables, dene Constraints, and create Indexes without writing any SQL commands using the Schema Manager. Write and execute SQL commands using the GUI tool, SQL Worksheet. Before installing Oracle8, decide whether you should install the client, server, or both portions of the Oracle8 product. If you have an existing Oracle7 database to migrate into Oracle8, you must review additional information to prepare for the installation. Review the special instructions if you are upgrading from a previous version of Oracle8. The default Oracle8 database comes with several predened Users, Roles, Tables, and views to assist in using the database. This chapter briey describes the books sample Tables and provides a database diagram of their relationships.

Vous aimerez peut-être aussi