copyright oracle corporation, 1999. all rights reserved. 5 cmis 570 - powell oracle designer:...

31
Copyright Oracle Corporation, 1999. All rights reserved. 5 5 Oracle Designer: Design Editor and Building the Database and Table API CMIS 570 - Powell CMIS 570 - Powell

Upload: isabel-bell

Post on 28-Dec-2015

216 views

Category:

Documents


2 download

TRANSCRIPT

Page 1: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

Copyright Oracle Corporation, 1999. All rights reserved.

55

Oracle Designer:Design Editor and Building the

Database and Table API

CMIS 570 - PowellCMIS 570 - Powell

Oracle Designer:Design Editor and Building the

Database and Table API

CMIS 570 - PowellCMIS 570 - Powell

Page 2: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-22 Copyright Oracle Corporation, 1999. All rights reserved.

OverviewOverview

• Design Editor

– Purpose

– Navigator + Work Surface

– Modifying Properties

• Generating the Database

• Generating the Table API

• Design Editor

– Purpose

– Navigator + Work Surface

– Modifying Properties

• Generating the Database

• Generating the Table API

Page 3: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-33 Copyright Oracle Corporation, 1999. All rights reserved.

Design EditorDesign Editor

• After you TRANSFORM your analysis models, use Design Editor to:

– Refine the design of your database and your application modules

– Generate the database and application modules

• After you TRANSFORM your analysis models, use Design Editor to:

– Refine the design of your database and your application modules

– Generate the database and application modules

Page 4: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-44 Copyright Oracle Corporation, 1999. All rights reserved.

Design EditorDesign Editor

• Format of the Design Editor tool:

– Navigator

– Work Surface

• Format of the Design Editor tool:

– Navigator

– Work Surface

Page 5: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-55 Copyright Oracle Corporation, 1999. All rights reserved.

The NavigatorThe Navigator

Server Model Modules DB Admin Distribution

APPLICATION[1]

Relational Table DefinitionsView DefinitionsSnapshot Definitions

Sequence DefinitionsCluster Definitions

PL/SQL DefinitionsDomainsData Diagram

Navigator - Server ModelNavigator - Server Model

Server Model Modules DB Admin Distribution

DatabaseDatabasedesign design and buildand build

Application Application design and design and buildbuild

Page 6: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-66 Copyright Oracle Corporation, 1999. All rights reserved.

Design Editor - SPEEDY[1]

Navigator - Server Model

Table Definitions

CUSTOMERSORDERS

The Work SurfaceThe Work Surface

• Create diagrams using drag and drop• Create diagrams using drag and drop

DSD1

EMPLOYEESEMPLOYEES DEPARTMENTSDEPARTMENTS

LASTNAMELASTNAMEFIRSTNAMEFIRSTNAMEEMPNOEMPNOEMPLOYEES_LOCATIONEMPLOYEES_LOCATIONEMPLOYEES_DEPTNAMEEMPLOYEES_DEPTNAME

LOCATIONLOCATIONDEPTNAMEDEPTNAME

DEPARTMENTS_EMPNODEPARTMENTS_EMPNO

EMP_DEPT_FKEMP_DEPT_FK

ODR_CTR_FK

CUSTOMERS

ORDERS

Page 7: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-77 Copyright Oracle Corporation, 1999. All rights reserved.

The Server Model DiagramThe Server Model Diagram

• How to read it

• Making modifications to it prior to generating the database

– Modifying table definitions

– Setting a column default value

• How to read it

• Making modifications to it prior to generating the database

– Modifying table definitions

– Setting a column default value

Page 8: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-88 Copyright Oracle Corporation, 1999. All rights reserved.

The Server Model DiagramThe Server Model Diagram

ITM_ODR_FKITM_ODR_FK

Table

Foreignkey

ITEMS

* QUANTITY o DISCOUNT * ODR_ID

ORDERS

# * ID

o DELIVERED_TIME

Primarykey

Column

Page 9: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-99 Copyright Oracle Corporation, 1999. All rights reserved.

PRODUCTS

DESCRIPTION

DISCOUNT_DAY

PRODUCT_TYPE

ID

PHOTO

*

o

*

*

o

Reading a Server Model DiagramReading a Server Model Diagram

PrimaryPrimarykeykey

OptionalityOptionality

Allowable valuesAllowable values

DatatypeDatatype

SequenceSequenceDomainDomain

Page 10: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1010 Copyright Oracle Corporation, 1999. All rights reserved.

Modifying Design PropertiesModifying Design Properties

• To modify design properties, you can use either:

– Property dialog box– Shows you the commonly used

properties for the type of object selected

– Property palette– Shows ALL the properties for the

selected object

• Icon to toggle between dialog box vs. palette display

• To modify design properties, you can use either:

– Property dialog box– Shows you the commonly used

properties for the type of object selected

– Property palette– Shows ALL the properties for the

selected object

• Icon to toggle between dialog box vs. palette display

Page 11: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1111 Copyright Oracle Corporation, 1999. All rights reserved.

Property Dialog vs. PaletteProperty Dialog vs. Palette

• Commonly used properties

• Commonly used properties

• All properties• All properties

Use dialog box Use palette

Display properties

Page 12: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1212 Copyright Oracle Corporation, 1999. All rights reserved.

Setting a Default ValueSetting a Default Value

Column Properties

Definition

Default Value PIZZA

INSERTINSERT

101PIZZA

Product Type ID

Page 13: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1313 Copyright Oracle Corporation, 1999. All rights reserved.

Setting a Default to SYSDATESetting a Default to SYSDATE

To have a field default to the current date, in the properties palette:

• Set Default to SYSDATE

• Set Derivation Expression Type to “Function Call”

• Set Server Derived to “Yes”

• SAVE!

To have a field default to the current date, in the properties palette:

• Set Default to SYSDATE

• Set Derivation Expression Type to “Function Call”

• Set Server Derived to “Yes”

• SAVE!

Page 14: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1414 Copyright Oracle Corporation, 1999. All rights reserved.

Practice 1Practice 1

Use the Design Editor to view your HOLLYWOOD database design (server) model:

• Use property palette AND property dialog box to examine properties of the COPIES table

• Use property palette AND property dialog box to examine properties of a field in the COPIES table

• Get comfortable with the toggle between these two property displays

Use the Design Editor to view your HOLLYWOOD database design (server) model:

• Use property palette AND property dialog box to examine properties of the COPIES table

• Use property palette AND property dialog box to examine properties of a field in the COPIES table

• Get comfortable with the toggle between these two property displays

Page 15: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1515 Copyright Oracle Corporation, 1999. All rights reserved.

Practice 2Practice 2

Use Design Editor to make the following modifications to your HOLLYWOOD server model:

• Re-order fields to be in this order . . .– # primary key fields

– * mandatory fields

– o optional fields

. . . By using the table properties dialog box, Columns tab, select a column name and use the screen arrows

Use Design Editor to make the following modifications to your HOLLYWOOD server model:

• Re-order fields to be in this order . . .– # primary key fields

– * mandatory fields

– o optional fields

. . . By using the table properties dialog box, Columns tab, select a column name and use the screen arrows

Page 16: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1616 Copyright Oracle Corporation, 1999. All rights reserved.

Practice 2Practice 2

• Set the ACQUIRE_DATE field of table COPIES to default to current date

• Save your Server Model

• Set the ACQUIRE_DATE field of table COPIES to default to current date

• Save your Server Model

Page 17: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1717 Copyright Oracle Corporation, 1999. All rights reserved.

Database GenerationDatabase Generation

• Preparing for generation

• Generating database objects

• Viewing online database objects

• Generating the Table API

• Preparing for generation

• Generating database objects

• Viewing online database objects

• Generating the Table API

Page 18: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1818 Copyright Oracle Corporation, 1999. All rights reserved.

The ResultsThe Results

TablesTablesCUSTOMERS

LAST_NAMEFIRST_NAME

ConstraintsConstraints

IndexesIndexes

Page 19: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-1919 Copyright Oracle Corporation, 1999. All rights reserved.

Generating the DatabaseGenerating the Database

Target

DDL files

Database

ODBC

Start . . .

Direct connectionDirect connection Other

Database

Page 20: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2020 Copyright Oracle Corporation, 1999. All rights reserved.

How We Generate The DatabaseDO DO NOTNOT DO THIS NOW !!! DO THIS NOW !!!

How We Generate The DatabaseDO DO NOTNOT DO THIS NOW !!! DO THIS NOW !!!

1. Within Design Editor, view your Server Model

2. From the Generate pull-down menu, select “Generate Database from Server Model”

3. In the Target tab, set the “Target for Generation” radio button to “Database” and fill in your userid-password-connect as you do at logon

1. Within Design Editor, view your Server Model

2. From the Generate pull-down menu, select “Generate Database from Server Model”

3. In the Target tab, set the “Target for Generation” radio button to “Database” and fill in your userid-password-connect as you do at logon

Page 21: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2121 Copyright Oracle Corporation, 1999. All rights reserved.

How We Generate The Database(continued)

How We Generate The Database(continued)

4. Fill in the directory with c:\temp

5. Select the Objects tab, and copy all the objects over to the right side (i.e., generate all objects)

6. Click the Start button

7. At pop-up, select “Execute DDL”

8. Look for message that there were no errors

4. Fill in the directory with c:\temp

5. Select the Objects tab, and copy all the objects over to the right side (i.e., generate all objects)

6. Click the Start button

7. At pop-up, select “Execute DDL”

8. Look for message that there were no errors

Page 22: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2222 Copyright Oracle Corporation, 1999. All rights reserved.

Viewing the Database After Generation

Viewing the Database After Generation

• Specify database connection

• Specify database connectionholly@dev

dev holly Tables CUSTOMERS ITEMS ORDERS PRODUCTS Views Snapshots Sequences Clusters Functions Packages

holly@dev - Database Navigator

File View Navigator Utilities

• View objects andproperties

View

ToolsDatabase Navigator

Page 23: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2323 Copyright Oracle Corporation, 1999. All rights reserved.

Practice 3Practice 3

Generating the Database:

• ONE BY ONE !!! Generate the database through direct connection

– Pass the “stress dollar”

• View resulting objects by using Tools Database Navigator

Generating the Database:

• ONE BY ONE !!! Generate the database through direct connection

– Pass the “stress dollar”

• View resulting objects by using Tools Database Navigator

Page 24: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2424 Copyright Oracle Corporation, 1999. All rights reserved.

Table APITable API

By generating the Table API:

• We generate needed procedures and triggers to go with the database, e.g.:

– PL/SQL logic in the server that processes and validates data before inserts, updates, and deletes are executed on database tables

–i.e., Logic to enforce referential integrity

– Code to operationalize “server-derived” fields

By generating the Table API:

• We generate needed procedures and triggers to go with the database, e.g.:

– PL/SQL logic in the server that processes and validates data before inserts, updates, and deletes are executed on database tables

–i.e., Logic to enforce referential integrity

– Code to operationalize “server-derived” fields

Page 25: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2525 Copyright Oracle Corporation, 1999. All rights reserved.

Table API is Server-Side LogicTable API is Server-Side Logic

• Keeps the client applications “thin”

• Minimizes maintenance because logicis in one place

• Keeps the client applications “thin”

• Minimizes maintenance because logicis in one place

Table API

Tables

Client Applications

Page 26: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2626 Copyright Oracle Corporation, 1999. All rights reserved.

Generating Table APIGenerating Table API

• Invoke from Design Editor

• Generates packages and triggers for tables

• Invoke from Design Editor

• Generates packages and triggers for tables

Generate Tools Options Generate Module...Generate Module As...Generate Module...Generate Module As...

Generate Table API...

Captue Design Of

Generate Database from Server Model... Generate Database Administration Objects...

Generate Reference Code Tables...Generate Module Component API…Generate Module Component API…

Capture Application Logic...Capture Application Logic...

Page 27: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2727 Copyright Oracle Corporation, 1999. All rights reserved.

How We Generate Table APIHow We Generate Table API

1. Still within Design Editor, select 1 or more table definitions

2. From the Generate pull-down menu, select “Generate Table API”

3. In the Target tab, select the “Database” radio button and enter your logon password

4. Click the Objects tab

5. Make sure all tables are moved to the right side.

1. Still within Design Editor, select 1 or more table definitions

2. From the Generate pull-down menu, select “Generate Table API”

3. In the Target tab, select the “Database” radio button and enter your logon password

4. Click the Objects tab

5. Make sure all tables are moved to the right side.

Page 28: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2828 Copyright Oracle Corporation, 1999. All rights reserved.

How We Generate Table APIHow We Generate Table API

6. Click the Start button

7. Look for message that says zero errors (you may have warning-level messages)

6. Click the Start button

7. Look for message that says zero errors (you may have warning-level messages)

Page 29: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-2929 Copyright Oracle Corporation, 1999. All rights reserved.

The Generate Table API Dialog BoxThe Generate Table API Dialog BoxGenerate Table APIGenerate Table API

ObjectsTarget

Target for Generation

File

Oracle

File Prefix

UsernamePasswordConnect

UsernamePasswordConnect

Oracle8 Browse...

Stop on error Stop on warningGenerate Table API Triggers

File PrefixDirectory

Page 30: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-3030 Copyright Oracle Corporation, 1999. All rights reserved.

Practice 4Practice 4

ONE BY ONEONE BY ONE !!! !!! (pass the “Stress $”) (pass the “Stress $”)

– Generate your Table API

– Use Design Editor option Tools Database Navigator to note the “Packages” and “Procedures” generated

ONE BY ONEONE BY ONE !!! !!! (pass the “Stress $”) (pass the “Stress $”)

– Generate your Table API

– Use Design Editor option Tools Database Navigator to note the “Packages” and “Procedures” generated

Page 31: Copyright  Oracle Corporation, 1999. All rights reserved. 5 CMIS 570 - Powell Oracle Designer: Design Editor and Building the Database and Table API CMIS

8-8-3131 Copyright Oracle Corporation, 1999. All rights reserved.

SummarySummary

To build the physical database from the server model:

• Use Server Generator to generate database objects

• View results thru Design Editor pull-down option Tools Database Navigator

• Generate the Table API

To build the physical database from the server model:

• Use Server Generator to generate database objects

• View results thru Design Editor pull-down option Tools Database Navigator

• Generate the Table API