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

22
Copyright Oracle Corporation, 1999. All rights reserved. 4 4 Oracle Designer: Creating the Database Design CMIS 570 - Powell CMIS 570 - Powell

Upload: melvin-harrington

Post on 30-Dec-2015

220 views

Category:

Documents


0 download

TRANSCRIPT

Page 1: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

Copyright Oracle Corporation, 1999. All rights reserved.

44

Oracle Designer:Creating the Database Design

CMIS 570 - PowellCMIS 570 - Powell

Oracle Designer:Creating the Database Design

CMIS 570 - PowellCMIS 570 - Powell

Page 2: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Setting the SceneSetting the Scene

Surely, we must be

ready to begin the

database design.

You’re right. Let’s begin.

We don’t have to do this by hand,

do we?

Page 3: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

OverviewOverview

• Final checks are important!

• Data model transformation

– Entities and attributes

– Relationships

• Primary and foreign key constraints

• Benefits of automating the process

• The Database Design Transformer (DDT)

• Final checks are important!

• Data model transformation

– Entities and attributes

– Relationships

• Primary and foreign key constraints

• Benefits of automating the process

• The Database Design Transformer (DDT)

Page 4: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Final Checks!Final Checks!

• Check each Entity:

– Should have a set of attributes

– Should be in at least one relationship

– Should have a primary key

– Should be used by at least one function

• Check each Entity:

– Should have a set of attributes

– Should be in at least one relationship

– Should have a primary key

– Should be used by at least one function

Page 5: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Final Checks!Final Checks!

• Check each Attribute:

– Should have at least format, length, and optionality specified

• Check each Relationship:

– Should be accurate in its degree and optionality

• Check each Attribute:

– Should have at least format, length, and optionality specified

• Check each Relationship:

– Should be accurate in its degree and optionality

Page 6: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Repository Reports for Final ChecksRepository Reports for Final Checks

“Quality” Reports:

• Entity Completeness Checks

• Function Completeness Checks

“E/R Modeling” Reports:

• Entity Definition

• Attribute Definition

• Attributes in a Domain

Page 7: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Final Checks!Final Checks!

Based on the checklist, we need to:

– Add a unique identifier to the COPY entityLet’s call it COPY NUMBER and set it as:

Mandatory, Primary, VARCHAR2 length of 6

– Add a unique identifier to the SUPPLIER entity

Let’s call it SUPPLIER ID and set it as:

Mandatory, Primary, VARCHAR2 length of 6

Let’s do it now . . . Let’s do it now . . .

Based on the checklist, we need to:

– Add a unique identifier to the COPY entityLet’s call it COPY NUMBER and set it as:

Mandatory, Primary, VARCHAR2 length of 6

– Add a unique identifier to the SUPPLIER entity

Let’s call it SUPPLIER ID and set it as:

Mandatory, Primary, VARCHAR2 length of 6

Let’s do it now . . . Let’s do it now . . .

Page 8: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Where We Have Come FromWhere We Have Come From

CUSTOMER# ID * LAST NAME . . .

ORDER# ID * ORDER DATE . . .

originator of

for

Page 9: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Where We Are GoingWhere We Are Going

CUSTOMERS# * ID * LAST_NAME . . .

ORDERS

# * ID * ORDER_DATE . . . * CTR_ID

TableTable

Primary keyPrimary keycolumncolumnColumnsColumns

Foreign keyForeign key

Foreign keyForeign keycolumncolumn

Page 10: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

The Data Design ModelThe Data Design Model

• DDT does not generate SQL

• Data Design Model consists of table definitions

• Table definitions are later input to the Database Generator to create the SQL to define the physical database

• DDT does not generate SQL

• Data Design Model consists of table definitions

• Table definitions are later input to the Database Generator to create the SQL to define the physical database

ERD Analysis

Model

ERD Analysis

Model

Data Design

Model

Data Design

ModelDDTDDT

Page 11: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Transforming Entities and AttributesTransforming Entities and Attributes

Analysis ModelAnalysis Model Design Model Design Model

+ Entity+ CUSTOMER

+ Attributes+ LAST NAME

+ Unique Identifier

+ Table+ CUSTOMERS

+ Columns

+ Primary Key

+ LAST_NAME

CUSTOMERS# * ID * LAST_NAME * STREET o POSTAL_CODE

CUSTOMER# ID* LAST NAME* STREETo POSTAL CODE

Page 12: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Transforming RelationshipsTransforming Relationships

CUSTOMER

ORDER# ID . . .

# ID . . .

originator of

for

CUSTOMERS

ORDERS# * ID * CTR_ID . . .

# ID . . .

Mandatory

Not Null

ORD_CTR_FK

Page 13: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Transforming a Foreign KeyTransforming a Foreign Key

• A foreign key column is created in the “many” table– Matches the primary key of the referenced table

– Foreign key column is named:

<short name of the entity>_<name of the referenced column>

• A foreign key constraint is created and associated with the new foreign key column– Constraint object is named:

<short name of “many” entity>_<short name of “one” entity>_FK

• A foreign key column is created in the “many” table– Matches the primary key of the referenced table

– Foreign key column is named:

<short name of the entity>_<name of the referenced column>

• A foreign key constraint is created and associated with the new foreign key column– Constraint object is named:

<short name of “many” entity>_<short name of “one” entity>_FK

Page 14: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Transforming a Foreign KeyTransforming a Foreign Key

CUSTOMERS

# * IDID * LAST_NAME . . .

• ID is a primary key column:

– Identifies a customer uniquely

– Cannot be null

• ID is a primary key column:

– Identifies a customer uniquely

– Cannot be null

ORDERS# * ID . . . CTR_IDCTR_ID

• CTR_ID is a foreign key column:

– Same size and type as CUSTOMERS.ID

• CTR_ID is a foreign key column:

– Same size and type as CUSTOMERS.ID

• ORD_CTR_FK is the foreign key constraint

• ORD_CTR_FK is the foreign key constraint

Page 15: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Benefits of an Automated Tool Benefits of an Automated Tool

• Enforces standards

– Naming conventions

– Standard results

• Saves development time

• Eliminates repetitive work

• Eliminates careless errors

• Allows for changes in analysis

• Enforces standards

– Naming conventions

– Standard results

• Saves development time

• Eliminates repetitive work

• Eliminates careless errors

• Allows for changes in analysis

Page 16: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Selecting Entities to TransformSelecting Entities to Transform

Entities 5

Tables (Mapped)

All entities

Selected entities

• ERD• ERD

• Front panel• Front panel

ITEM

*ORDER

#

Page 17: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Using the ToolUsing the Tool

Customize the Database Design Transformer

Settings

Run the Transformer in Default Mode

Mode

Run HelpShow Run Set

Selected entitiesAll entities

Customize the Database Design Transformer

Run optionsRun optionsRun optionsRun options

Settings that Settings that rarely changerarely changeSettings that Settings that rarely changerarely changeModes for entity selectionModes for entity selectionModes for entity selectionModes for entity selection

Summary of run set

0

Entities 5

Tables (Mapped)

Run options

Page 18: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

How We Will Run The DDTHow We Will Run The DDT

• Initiate from the Designer launchpad

• Select “Default Mode” and “All Entities”

• Click “Run” to initiate the DDT

• When DDT has finished processing:– Close the “Output” window

– Select “Customize the DDT” to access the “Table Mappings” and “Other Mappings” tabs

– Here, you can see the detailed results of the DDT run

• Initiate from the Designer launchpad

• Select “Default Mode” and “All Entities”

• Click “Run” to initiate the DDT

• When DDT has finished processing:– Close the “Output” window

– Select “Customize the DDT” to access the “Table Mappings” and “Other Mappings” tabs

– Here, you can see the detailed results of the DDT run

Page 19: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Viewing the ResultsViewing the Results

Output WindowOutput WindowOutput WindowOutput Window Mappings tabsMappings tabs

ITEMS

PRICED_PRODU

Table Mappings

Entity

PRODUCTPRICED PRODUCTORDERITEM

ORDERS

PRODUCTSPRICED_PRODU

ITEMSCUSTOMER CUSTOMERS

Other Mappings

committing changes…committed successfullyupdating dialog…

Loading Tables from the ReposiCUSTOMERSITEMSORDERSPRICED_PRODUCTPRODUCTS

-----------------------------------------…………………………………...…………………………………...Waiting for Close to be pressed..

committing changes…committed successfullyupdating dialog…

Loading Tables from the ReposiCUSTOMERSITEMSORDERSPRICED_PRODUCTPRODUCTS

-----------------------------------------…………………………………...…………………………………...Waiting for Close to be pressed..

Page 20: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

SummarySummary

• Transform the analysis data model into a data design (i.e. table definitions)

• DDT automates the process

• Transform the analysis data model into a data design (i.e. table definitions)

• DDT automates the process

EntityEntityUIDUID

AttributeAttributeRelationshipRelationship

TableTablePrimary or unique keyPrimary or unique keyColumnColumnForeign key column Foreign key column and constraintand constraint

Page 21: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Practice 1Practice 1

1. View the entity relationship model

2. Write down your expected DDT results

3. After running the DDT, examine the result – using using Design EditorDesign Editor . . . . . .

1. View the entity relationship model

2. Write down your expected DDT results

3. After running the DDT, examine the result – using using Design EditorDesign Editor . . . . . .

Page 22: Copyright  Oracle Corporation, 1999. All rights reserved. 4 CMIS 570 - Powell Oracle Designer: Creating the Database Design CMIS 570 - Powell

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

Intro to the Design Editor ToolIntro to the Design Editor Tool

1. Initiate Design Editor from the Designer launchpad

2. Select “Server Model” (the default) and UN-check “Use a Guide”

3. Expand “Relational Table Definitions”

4. Use the shift key to select all 3 tables

5. Drag them to the “work surface” at right

6. Maximize the work surface window to study your model

7. Print this model out if you want to

1. Initiate Design Editor from the Designer launchpad

2. Select “Server Model” (the default) and UN-check “Use a Guide”

3. Expand “Relational Table Definitions”

4. Use the shift key to select all 3 tables

5. Drag them to the “work surface” at right

6. Maximize the work surface window to study your model

7. Print this model out if you want to