Date post: | 30-Dec-2015 |
Category: |
Documents |
Upload: | melvin-harrington |
View: | 217 times |
Download: | 0 times |
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
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?
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)
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
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
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
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 . . .
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
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
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
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
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
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
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
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
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
#
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
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
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..
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
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 . . . . . .
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