Upload
bada-sainath
View
221
Download
0
Tags:
Embed Size (px)
Citation preview
Data Warehouse Introduction By Satish K Yellanki
Page 1 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Let us Start With CA-Erwin
Erwin Supports A Variety of Aspects of Database Design, Including Data
Modeling.
Erwin Supports Data Modeling in Two Flavors
Forward Engineering
The Creation of A Database Schema And Physical Database on The Basis of A
Data Model.
Reverse Engineering
The Creation of A Data Model on The Basis of An Existing Database.
Erwin Supports Data Modeling For A Wide Variety of Relational DBMS Software.
Main Areas of Erwin Workplace
Logical
In This View, Data Model Represents Business Requirements Like Entities,
Attributes Etc.
Physical
In This View, Data Model Represents Physical Structures Like Tables, Columns,
Data Types Etc.
Modelmart
Many Users Can Work With A Same Data Model Concurrently.
What Can Be Done With Erwin?
Logical, Physical And Dimensional Data Models Can Be Created.
Data Models Can Be Created From Existing Systems Like RDBMS, DBMS, Script
Files.
Different Versions of A Data Model Can Be Compared.
Data Model And Database Can Be Compared.
SQL Scripts Can Be Generated To Create Databases From Data Model.
Reports Can Be Generated in Different File Formats.
By Using Modelmart, Concurrent Users Can Work on The Same Data Model.
Starting CA-Erwin
Start Programs Computer Associates All Fusion Erwin Data Modeler
Erwin Data Modeler.
Step1 Creation of A Basic Data Model
Click The Create New Button OR File New OR CTRL + N.
In The Create Model Dialog Box Select Logical/Physical Option, And Any
Template if Available.
Select The Target Database As Oracle And Version As 10.x And Click OK.
NOTE
The Logical Model Does Not Allow The Target Database Selection.
The Physical Model Provides A List of Different Databases That Are Supported
By Erwin.
We Can Select Predefined Templates By Browsing The System if Available.
Data Warehouse Introduction By Satish K Yellanki
Page 2 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Erwin Work Place
The Erwin Workplace Consists of Two Main Parts.
o The Model Navigator It Displays A Hierarchy of Items.
o The Display Window It Will Show The ER Diagram Itself.
Data Warehouse Introduction By Satish K Yellanki
Page 3 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Setting Preferences
Erwin Accommodates A Number of Data Modeling Notations And Conventions.
To Set The Preferences, Click Model Model Properties
Few Options That Are Very Regular For Setting
From The Format Entity Display Menu, Make Sure That Primary Key
Designator is Checked
From The Format Entity Display Menu, Make Sure That Foreign Key
Designator (FK) is Unchecked.
From The Format Entity Display Menu, Make Sure That Show Migrated
Attributes is Unchecked.
From The Format relationship Display, Make Sure That Verb Phrase is
Checked.
We Can Choose Between Two Different ER Diagramming Notations From The
Model Properties Window
o Information Engineering Notation (IE)
o Integration DEFinition For Information Modeling IDEF1X.
Erwin Also Provides The Dimensional Modeling Notation.
Data Warehouse Introduction By Satish K Yellanki
Page 4 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Steps To Create an Entity
To Create A New Entity, Click on The Entity Icon on The Erwin Toolbar And Click
in The Display Area, OR Right-Click on The Entities Node in The Model
Navigator.
Notice That The Default Name For The New Entity is E/x, Where x is Sequence
Number of The Entity.
Select The Entity in The Display Area And Click on The Tab Key To Focus The
Cycle Between The Three Main Parts of The Entity
o The Name of The Entity
o The Primary Key Attribute(s)
o The Non-Primary Key Attribute(s).
To Modify One of These Three Parts of The Entity, We Have To Press The Tab
Key To Cycle To The Appropriate Part of The Entity, Then Type To Add OR
Modify That Part of The Entity.
Steps To Add Primary Key Columns
Once The Entity Name is Changed, Then Press The Tab Key Again To Move The
Focus To The Next Part of The Entity, To Add A Primary Key Attribute.
Type The Name of The Primary Key Attribute As Per The Requirement of The
System Being Designed.
To Add Multiple Columns For A Primary Key, To Recognize As A Composite
Primary Key State, Press Enter Key After Adding The First Column For Primary
Key.
Steps To Add Non Key Attributes
Press The Tab Key After Adding The Primary Key Attribute, Which Will Help To
Add A Number of Non-Primary Key Attributes.
After Adding The Required Non-Primary Key Attribute Press The Enter Key, To
Add The Remaining Non Key Attributes.
Data Warehouse Introduction By Satish K Yellanki
Page 5 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
System For Design
Data Warehouse Introduction By Satish K Yellanki
Page 6 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Creating Relationships in Erwin
Erwin Supports Three Basic Kinds of Relationship Types
o Identifying Relationship.
o Non-Identifying Relationship.
o Many-To-Many Relationship.
Erwin Supports Three Basic Kinds of Cardinality Types
o One-To-One
o One-To-Many
o Many-To-Many
Within The One-To-Many Category, Erwin Allows To Distinguish Between
Identifying And Non-Identifying One-To-Many Relationships.
Identifying Relationship
An Identifying Relationship is A Relationship Between Two Entities in Which An
Instance of A Child Entity is Identified Through its Association With A Parent
Entity.
In Identifying Relationship The Child Entity is Dependent on The Parent Entity
For its Identity And Cannot Exist Without The Parent Entity.
In An Identifying Relationship, One Instance of The Parent Entity is Related To
Multiple Instances of The Child.
Data Warehouse Introduction By Satish K Yellanki
Page 7 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Notation Style in Erwin IDEF1X Notation
A Solid Line With A Diamond OR A Filled Circle At Either End of The Line.
IE Notation
A Solid Line With Crows Feet.
Steps To Create Identifying Relationship
To Create An Identifying Relationship, Click First on The Identifying
Relationship Icon.
Click on The Parent Entity, Generally on The One Side of The Relationship Entity
And Then Click on The Child Entity on The Many Side of The Relationship Entity.
Note
Erwin Provides A Label "R/x" For Every Relationship That is Created.
This Default Label Can Be Changed As Per Our Requirement in A Meaningful
Way.
Defining Customized Labels For Relationships
Double-Click on The Relationship To Open The Relationship Dialog Box.
The Relationship Dialog Box Has Features To Refine The Properties of The
Relationship.
Data Warehouse Introduction By Satish K Yellanki
Page 8 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
In The Relationship Text Box The Relationship is Presented From Parent Entity
R/1 Child Entity.
The Verb Phrase Portion of This Box Allows To Define The Label To Place on The
Relationship in Place of R/1.
In The Relationship Cardinality Portion, We Can Determine How Many Child
Entity Occurrences May Be Associated With Each Parent Entity Occurrence.
We Can Define Participation As Mandatory OR Optional in The Database.
Note
When An Entity Participates As The Child in An Identifying Relationship it is
Modeled With Rounded Corners.
This Notation is Useful To Understand The Weak Entity Concept in RDBMS.
Creating Non-Identifying Relationship
Click on The Non-Identifying Relationship Icon Which Uses A Dashed Line
Instead of A Solid Line.
Click On The Parent Entity, Then The Child Entity.
In Non-Identifying Relationship Type, We Have The Option of Indicating
Whether NULLS Are Permitted OR Not.
This Decision Regards The Participation of The Parent Entity in A Relationship
With The Child Entity.
We Have A Choice of Mandatory OR Optional State in Non-Identifying
Relationship.
Data Warehouse Introduction By Satish K Yellanki
Page 9 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Creating Subtypes And Supertypes
Some Entities May Have Sub-Category Classifications.
Each of The Sub-Category Classifications Has All of The Properties of The Main
Category, But in Addition Have A Small Number of Specific Extra Attributes.
In Many Situations The Subtype Entities Do Not Contain Any Key Attributes.
The Attributes Registered in The Subtypes Are Only Registered To That Subtype
Entity And Should Not Be Part of The Main Type.
Subtype / Supertype Representation is For Clarity on The Overall System, But
Not Mandatory.
Steps in Erwin
To Specify The Sub Types Erwin Provides The Subtype Tool.
To Indicate A Subtype of Main Type, Select The Subtype Icon, Click on The
Super Type Entity, Then on The Subtype Entity.
To Represent The Additional Subtypes of The Same Maintype, Click on The
Subtype Icon That is Created And Then Click The Mouse on The Subtype Entity.
Data Warehouse Introduction By Satish K Yellanki
Page 10 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Creation of A Database Schema
Before A Database Schema is Created We Must Ensure That All Fundamental OR
Strong Entities Have A Primary Key.
Once The Primary Keys Are Identified, We Should Define The Domain For Each
Attribute.
We Can Leave The Responsibility To Erwin For Converting The ER Diagram into
A Relational Schema.
Assigning Primary Keys
Fundamental OR Strong Entities Are Those That Do Not Depend on Any Other
Entity For Their Primary Key.
Fundamental Entities Are Not
o Subtypes
o Associative OR Composite Entities
o Weak OR Attributive Entities.
o Entities At The 'Many' End of An Identifying One-To-Many Relationship.
Data Warehouse Introduction By Satish K Yellanki
Page 11 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
The Sub-Types Do Not Contain Their Own Primary Keys, But They Inherit The
Primary Key From The Main Type.
Once The Primary Keys Are Identified For All The Strong Entities The Database
Schema Creation Can Be Commenced.
Defining Domains in Erwin
The Domain of An Attribute is The Set of Values That Attribute is Permitted To
Have.
To Define A Domain We Have To Define Two Components
Datatype
Datatype is A Mandatory Property Applied For Every Attribute.
Constraints
Constraints Are Optional Specifications Applied As Business Rules Upon The
Attributes.
Constraint Can Set The Permitted Values Which Can Be Narrower Than
Defined By The Data Type Alone.
Domains Can Be Shared By More Than One Attribute.
Data Warehouse Introduction By Satish K Yellanki
Page 12 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
In An ER Diagram, We Can Define The Domain Once, And Apply it to Multiple
Attributes.
Domains Provide The Benefit of Consistence Across Attributes And Ease of
Maintenance.
Steps To Create Domains
Click The Model Menu Domain Dictionary.
Specify The Required Options For Each Domain That Has To Be Created.
Steps To Create A Identifier Domain
To Create A New Domain Click on New Button.
Type The Logical Name of The Domain As Identifier And Click OK.
Click on The Data Type Tab, And Choose The INTEGER Datatype For This
Domain.
Data Warehouse Introduction By Satish K Yellanki
Page 13 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Domains Identified For The Current Schema
After All The Required Domains Are Created, The Domains Are Individually
Attached To The Attributes.
Applying Domains To Attributes
The Final Step of Working With Domains is To Associate A Domain With Each
Attribute.
To Attach The Domain, Double-Click on One of The Entities in The E-R Diagram.
To Associated A Domain With An Attribute, Click First on The Attribute, Then
Click on The Associated Domain.
Converting An E-R Diagram into A Relational Schema
The First Stop in Converting An ER Diagram into A Relational Schema is To
Transform Each Entity And Each Relationship into its Counterpart in A
Relational Schema Consisting of Relational Tables.
Click Format Entity Display in Menu And Check The Following Properties
o Primary Key Designator
o Foreign Key Designator
o Show Migrated Attributes
To Transform The Logical ER Diagram into Physical Relational Schema Click And
Select The Physical Option.
In Physical Model The Relational Schema Will Be Looking Exactly As it is
Expected By The DBMS Software.
Data Warehouse Introduction By Satish K Yellanki
Page 14 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Enhancing The Data Model
We Can Use The Drawing Features To Enhance The Data Model Appearance And
Make it Easier To View And Understand.
The Drawing And Appearance Features Provided Are
Enlarge The Font Size For All Entity Names.
Change The Color of All Foreign Keys To Red.
Use Different Fonts And Colors To Identify New Objects From Old Objects in
The Model.
Resize And Align One OR More Entity Boxes.
Data Warehouse Introduction By Satish K Yellanki
Page 15 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Changing Font and Color For Individual Objects
Select The Object For Which The Font And Color Has To Be Changed And Use
Object Font And Color Property
Inheriting Objects With Color
In Erwin The Color of An Object Can Be Related To The Color it Inherits From
Other Objects in The Diagram.
Select The Relation Line And Click Secondary Mouse Button And Choose Object
Font And Color.
Data Warehouse Introduction By Satish K Yellanki
Page 16 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Create Stored Displays
A Stored Display Helps in Having Different Views For The Data Model Very
Quickly.
Steps To Create Stored Display
Format Stored Display
In The Stored Displays Dialog Box Click New.
Type A Name For The Stored Display, And Click OK.
The New Stored Display Dialog Closes.
Select The Display Option Settings By Clicking The Property Tabs. Click OK To
Save.
Creating Subject Areas
A Subject Area is A Subset of Objects Taken From The Whole Pool of Objects in
The Model Diagram.
A New Data Model Includes One Subject Area Called The Main Subject Area,
Which Includes All of The Objects in The Data Model.
The Subject Areas Are Not Copies of The Data Model, But Are Dynamic Subsets
of The Data Model.
When A Members is Added To A Subject Area The Objects Are Added To The
Current Subject Area And The Main Subject Area.
When An Attribute OR Column is Added To An Existing Entity OR Table, The
New Object is Added To Every Subject Area in Which The Entity OR Table is A
Member.
Steps To Create A New Subject Area
Model Subject Areas OR Click The Subject Areas Button on The Toolbar.
In The Subject Area Editor, Click New.
Data Warehouse Introduction By Satish K Yellanki
Page 17 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Type A Name For The New Subject Area, And Click OK.
Click The Members Tab And Use The Arrows To Include The Objects in The New
Subject Area, Click OK.
Creating An Index in The Index Editor
Right-Click A Table in The Diagram And Select Indexes (OR)
Right-Click An Index Located Under A Table in The Model Explorer And Select
Properties (OR)
Click An Index Located Under A Table in The Model Explorer, And Then Click
The Property Editor Button.
Click New, In The New Index Dialog Assign An Index Name.
Check The Unique Option To Create An AK Index OR Uncheck The Unique
Option To Create An Inversion Entry (IE) Index. Click OK.
In The Index Editor, Select The Index Columns From The Available Columns
List. Click OK.
Creating An Index in The Model Explorer
Click Tables To Expand The Folder, Right-Click The Indexes Folder.
Select Either New AK OR New IE, A New Folder With A Default Name is Added
To The Indexes List.
Data Warehouse Introduction By Satish K Yellanki
Page 18 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Right-Click The New Index Folder, Select Properties.
Select The Index Columns From The Available Columns List, Click Close.
Creating Views in Erwin
We Can Create Views in Physical Model.
A View is A SQL Query Which is Permanently Stored In The Database Under
Assigned Names.
A View is Used To Present Specific Database Information For A Target
Audience.
In AllFusion ERwin Data Modeler, A View Table And Relationship Line Are Both
Drawn With Dashed-Lines.
Adding a View To A Model
Different Ways To Create A View in Erwin
o Click The Entity Button on The Allfusion Erwin DM Toolbox. Then Click in The
Diagram Window.
o Reverse Engineer An Existing Database.
o Copy A View From One Model And Paste it into Another Model.
o Right-Click The Views Folder in The Model Explorer And Choose New.
A View is A Logical Representation of The Data, That is Accessed From The
Database Table OR Tables.
Data Warehouse Introduction By Satish K Yellanki
Page 19 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
A View Provides Restricted Access To The Data From The Actual Database Table
OR Tables.
Forward Engineering
Forward Engineering is A Process That Generates The Physical Database
Schema From The Data Model.
Forward Engineering Process Can Generate A Schema
o Tables
o Triggers
o Stored Procedures
o Indexes
o Constraints
o Physical Storage Objects
o Other Database Features Supported By The Target DBMS.
Data Warehouse Introduction By Satish K Yellanki
Page 20 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]
Through Forward Engineering A Data Model, We Can Choose To Generate A
Script File, Which We Can Use To Update The Database Using A Database
Administration Tool.
Using Forward Engineering We Can Directly Connect To The Database Catalog
And Generate The Database.
Before We Forward Engineer, We Can View The Schema, Which is A Text-Based
Representation of The Database Objects.
Preview Schema Generation
Select Open From The File Menu, And Open The Required Model For Schema
Generation.
Use The Model Type Indicator And Switch To The Physical Model.
Choose Forward Engineer, Schema Generation From The Tools Menu And Click
The Preview Button.
Change Schema Generation Options
We Can Set Schema Generation Options By Category.
The Target Server We Select Determines The Options That Appear in The Editor.
Tools Forward Engineer Schema Generator
Make The Necessary Selections As Per The Requirement.
Generate The Schema
From The Preview Dialog, Click Generate (OR)
From The Main Schema Generation Dialog, Click Generate.
In The Oracle Connection Dialog Box Enter A User Name, Password, And
Connect String.
Data Warehouse Introduction By Satish K Yellanki
Page 21 of 21
Document Prepared By The Technical Cell of
SkyEss Techno Solutions Pvt. Ltd., 80 / A, Flat No 201
Abhilash Towers, S.R. Nagar, Hyderabad : 500016. India
Phone : +91-040-23710047, [email protected]