Top Banner
Maturity DB Process Maturity DB Process Logical Design Physical Design DDL Script Unit Test Integration Test Stress Test Production Review Review Evaluation Coding Review Design Stage
100

Maturity DB Process

Jan 10, 2016

Download

Documents

kael

Maturity DB Process. Design Stage. Review. Logical Design. Physical Design. Review. DDL Script. Review. Coding. Unit Test. Integration Test. Evaluation. Stress Test. Production. Design decide the system quality. Design Stage. Coding Stage. Testing Stage. Production. Design Stage. - PowerPoint PPT Presentation
Welcome message from author
This document is posted to help you gain knowledge. Please leave a comment to let me know what you think about it! Share it to your friends and learn new things together.
Transcript
Page 1: Maturity DB Process

Maturity DB ProcessMaturity DB Process

Logical Design

Physical Design

DDL Script

Unit Test

Integration Test

Stress Test Production

Review

Review

Evaluation

CodingReview

Design Stage

Page 2: Maturity DB Process

Design decide the system Design decide the system qualityquality

Design Stage

Coding Stage

Testing Stage

Production

Page 3: Maturity DB Process

Design StageDesign Stage

Logical DesignLogical Design

Physical DesignPhysical Design

Maintain PlanMaintain Plan

Page 4: Maturity DB Process

I Logical DesignI Logical Design

Page 5: Maturity DB Process

Data ModelData Model

What is a logical data model?What is a logical data model?

What is the purpose of data What is the purpose of data modeling?modeling?

How to design logical data model?How to design logical data model?

Page 6: Maturity DB Process

What is Data ModelWhat is Data Model??

A model is an abstract representation of A model is an abstract representation of some real thing.some real thing.

Data modeling is the action of exploring Data modeling is the action of exploring data-oriented structures.  data-oriented structures. 

A logical data model is a graphical A logical data model is a graphical representation of the information representation of the information requirements of arequirements of a business area, it is not a business area, it is not a database.database.

Page 7: Maturity DB Process

Data ModelsData Models Concepts Concepts

Conceptual data models Conceptual data models

Logical data models (LDMs).  Logical data models (LDMs). 

Physical data models (PDMs). Physical data models (PDMs).

Page 8: Maturity DB Process

What is the difference between a logical data model and a physical database design?

THE LOGICAL MODELTHE LOGICAL MODEL THE PHYSICAL DATABASE THE PHYSICAL DATABASE DESIGNDESIGN

Includes all entities, relationships, and Includes all entities, relationships, and attributesattributes

(and their information types) whether (and their information types) whether supportedsupported

by a technology or not.by a technology or not.

Uses business names.Uses business names.

Captures and records information Captures and records information necessarynecessary for the business.for the business.

Includes tables, columns, keys, Includes tables, columns, keys, datatypes, validationdatatypes, validation rules. DB rules. DB triggers, stored procedures, domains, triggers, stored procedures, domains, andand access constraints (security).access constraints (security).

Names may be limited by the DBMS.Names may be limited by the DBMS.

Includes technology-specific data Includes technology-specific data elements such aselements such as flags, switches, and flags, switches, and timestamps.timestamps.

Includes unique identifiers.Includes unique identifiers. Includes primary keys, foreign keys, Includes primary keys, foreign keys, and indices for fastand indices for fast data access.data access.

Is normalized to at least 3rd normal form.Is normalized to at least 3rd normal form. May be de-normalized to meet May be de-normalized to meet pperformanceerformance requirements.requirements.

Does not include any redundant data.Does not include any redundant data. May include redundant data elements.May include redundant data elements.Does not include any derived data.Does not include any derived data. May include results of complex or May include results of complex or

difficult to recreate calculations.difficult to recreate calculations.Business experts drive the model.Business experts drive the model. DesignerDesigner drive the model. drive the model.

Page 9: Maturity DB Process

A simple logical data model. A simple logical data model.

Page 10: Maturity DB Process

A simple physical data A simple physical data model model

Page 11: Maturity DB Process

Logical Data Model FormatLogical Data Model Format

Logical Data Model is in format Logical Data Model is in format known as “Entity Relationship known as “Entity Relationship Diagram” (ERD)Diagram” (ERD)

Most popular data modeling tools are Most popular data modeling tools are Erwin, ER Studio and Power Designer. Erwin, ER Studio and Power Designer.

Page 12: Maturity DB Process

Data ModelData Model

What is a logical data model?What is a logical data model?

What is the purpose of data What is the purpose of data modeling?modeling?

How to design logical data model?How to design logical data model?

Page 13: Maturity DB Process

AdvantageAdvantagess to Using a to Using a ModelModel

Easier to understand model at a Easier to understand model at a glanceglance

No need to trace through narrative No need to trace through narrative descriptions of relationshipsdescriptions of relationships

Communicates one clear definition Communicates one clear definition Understood by business and Understood by business and

technical stafftechnical staff

Page 14: Maturity DB Process

Benefits of a Logical Data Benefits of a Logical Data ModelModel

Using a Logical Data model speedsUsing a Logical Data model speeds maintenance maintenance and eases theand eases the Transition to new technologies.Transition to new technologies.

Capture business requirements (ensure Capture business requirements (ensure understanding)understanding)

Ability to share data across enterprise resulting Ability to share data across enterprise resulting in:in: Accurate dataAccurate data Consistent dataConsistent data Reduced costsReduced costs

Easier to implement changes in your businessEasier to implement changes in your business Business requirements can be satisfied in Business requirements can be satisfied in

database designdatabase design

Page 15: Maturity DB Process

Data ModelData Model

What is a logical data model?What is a logical data model?

What is the purpose of data modeling?What is the purpose of data modeling?

How to design logical data model?How to design logical data model?

Page 16: Maturity DB Process

Who uses the logical data model?

The Business Area Experts own the logical data model.They describe their data requirements to the data modeler and review the models created. They use the models for impact analysis of changes to business requirements.

The Data Modeler conducts facilitated sessions with business area experts to gather the data requirements and build the logical data model.The data modeler also works with the process analyst to link data with processes. The data modeler is responsible for getting approval of the logical data model from the business area experts and then works with the DBA to transition the logical model to the physical model.

The DBA (Designer) builds the physical data model from the logical data model.To create a good quality database design, the DBA reviews the logical model to select technology appropriate keys, create indexes, detail data types, and build referential integrity to protect the data values. The database administrator may de-normalize the database for efficiency. DBAs also are responsible for creating db schemas, maintaining referential integrity, and monitoring database performance.

Page 17: Maturity DB Process

Actions in Data ModelingActions in Data Modeling

Identify – Identify – Determine which things are represented Determine which things are represented in the model.in the model.

Name – Name – Each thing represented in the model Each thing represented in the model needs to have a unique and meaningful name.needs to have a unique and meaningful name.

Describe – Describe – Name is important, but not sufficient. Name is important, but not sufficient. Description should be no more than three Description should be no more than three sentences, each with subject, object, and verb. sentences, each with subject, object, and verb. Must answer:Must answer: What is it?What is it? What it is What it is not.not. Sometimes: What are some examples?Sometimes: What are some examples?

AssociateAssociate – Much of the meaning is in associations – Much of the meaning is in associations among the things represented in the model.among the things represented in the model.

Page 18: Maturity DB Process

How to Model DataHow to Model Data

Identify entity types Identify entity types Identify attributes Identify attributes Assign keys Assign keys Inversion EntriesInversion Entries Identify relationships Identify relationships Normalize to Reduce Data Normalize to Reduce Data

Redundancy Redundancy

Page 19: Maturity DB Process

What is an Entity?What is an Entity?

Entity: a person, place, thing, Entity: a person, place, thing, concept or event that the business concept or event that the business wants to store information aboutwants to store information about

MOVIE

A movie is an entertainment,

documentary, or educational event which has been

recorded in a moving picture format.

Page 20: Maturity DB Process

Entity and InstanceEntity and Instance

Each entity is made up by a group of objects, which are named as Instances.

Each instance can be identified from other instances.

Page 21: Maturity DB Process

ENTITY Examples category ENTITY Instance

EMPLOYEEEMPLOYEE

STUDENTSTUDENT

OFFICEOFFICE

AUTOMOBILEAUTOMOBILE

CHEMICALCHEMICAL

FUNDS TRANSFERFUNDS TRANSFER

TENNIS TOURNAMENTTENNIS TOURNAMENT

COUNTRYCOUNTRY

DEPARTMENTDEPARTMENT

ORDERORDER

People

Place

Things

Event

concept

Mr.KochMs.ChouHongKongR.O.CBMW 525iAmmonia42233

U.S. OPENL789I12345

Page 22: Maturity DB Process

What is an Attribute?What is an Attribute?

Attribute: a fact or characteristic of Attribute: a fact or characteristic of an entity with only one meaning an entity with only one meaning (atomic)(atomic)

Each entity type will have one or Each entity type will have one or more data attributes more data attributes

attributesEmployee IdEmployee Last NameEmployee First Name

Employee AddressEmployee Phone Number

Employee IdEmployee Last NameEmployee First Name

Employee AddressEmployee Phone Number

EMPLOYEE

ENTITY NameENTITY Name

Page 23: Maturity DB Process

Two kinds of Attributes

Key AttributesKey Attributes Non-key AttributesNon-key Attributes

Consultant IdConsultant Id

Consultant Last NameConsultant First Name

Consultant SpecializationConsultant Hourly Rate

Consultant Last NameConsultant First Name

Consultant SpecializationConsultant Hourly Rate

CONSULTANT

Key AttributesKey Attributes

Non-key AttributesNon-key Attributes

Page 24: Maturity DB Process

Candidate Keys

One single attribute or a group of One single attribute or a group of attributes that can be used to attributes that can be used to identify each instance.identify each instance.

TEACHER

Teacher Last NameTeacher First Name

Teacher AddressTeacher Country

Teacher Certificate IdTeacher Mother Maiden NameTeacher Phone Number

Teacher Date of Birth

TEACHER

Teacher Last NameTeacher First Name

Teacher AddressTeacher Country

Teacher Certificate IdTeacher Mother Maiden Name

Teacher Phone NumberTeacher Date of Birth

Page 25: Maturity DB Process

Primary KeyPrimary Key

A candidate key with the highest A candidate key with the highest prioritypriority that be used to identify the that be used to identify the instanceinstance

EMPLOY ID

First NameLast Name

AddressDepartment

Phone NumberBirthday

Employee

PK

Page 26: Maturity DB Process

Alternate KeyAlternate Key

All the candidate keys except PK

EMPLOYEE

Employee IdEmployee Id

Employee Last Name (AK1)Employee First Name (AK1)

Employee Address Employee CityEmployee State

Employee Zip CodeEmployee Phone Number (AK2)

Employee Date of Birth (AK1,AK2)

Employee Last Name (AK1)Employee First Name (AK1)

Employee Address Employee CityEmployee State

Employee Zip CodeEmployee Phone Number (AK2)

Employee Date of Birth (AK1,AK2)

Page 27: Maturity DB Process

Inversion EntriesInversion Entries

Some of attributes be used to find out the instance wanted. The result may not be unique.

Employee IdEmployee Id

Employee Last Name (AK1,IE2)Employee First Name (AK1)

Employee Address Employee City (IE1)Employee State (IE1)Employee Zip Code

Employee Phone NumberEmployee Date of Birth (AK1)

Employee Last Name (AK1,IE2)Employee First Name (AK1)

Employee Address Employee City (IE1)Employee State (IE1)Employee Zip Code

Employee Phone NumberEmployee Date of Birth (AK1)

EMPLOYEE

Page 28: Maturity DB Process

What is a Relationship?What is a Relationship?

Relationship: an association between Relationship: an association between occurrences of one or more entities occurrences of one or more entities which provides some relevant and which provides some relevant and valuable informationvaluable information

MOVIE VIDEO TAPE

is recorded on

records

Page 29: Maturity DB Process

What is a Verb PhraseWhat is a Verb Phrase

Parent-to-child verb phrase describes how Parent-to-child verb phrase describes how the parent is related to the child. In the the parent is related to the child. In the example to the left, the verb phrase states example to the left, the verb phrase states that that ““STORE rents A MOVIE.STORE rents A MOVIE.””

Child-to-parent verb phrase describes how Child-to-parent verb phrase describes how a child entity is related to a parent entity. In a child entity is related to a parent entity. In the example to the left, the verb phrase the example to the left, the verb phrase states that states that ““MOVIE is rented from A STOREMOVIE is rented from A STORE””

Page 30: Maturity DB Process

Cardinality Cardinality of of RelationshipRelationship

One-to-oneOne-to-one One-to-manyOne-to-many Many-to-oneMany-to-one Many-to-manyMany-to-many All types can be optional for one or All types can be optional for one or

both entitiesboth entities

Page 31: Maturity DB Process

Identifying RelationshipIdentifying 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, which means the child entity is dependent on the parent entity for its identify and cannot exist without it.

MOVIE MASTER

Movie Master IdMovie Master Id

Movie NameMovie StarMovie Type

Movie Rating

Movie NameMovie StarMovie Type

Movie Rating

MOVIE COPY

Movie Master Id (FK)Movie Copy NumberMovie Copy Create

DateMovie Copy Due DateMovie Copy Condition

Movie Master Id (FK)Movie Copy NumberMovie Copy Create

DateMovie Copy Due DateMovie Copy Condition

is rented as/is created from

Page 32: Maturity DB Process

Mandatory non-identifying Mandatory non-identifying relationshiprelationship

A non-identifying relationship in which an A non-identifying relationship in which an instance of the child entity must be instance of the child entity must be related to an instance of the parent entity.related to an instance of the parent entity.

places/is received from

CUSTOMER

Customer IdCustomer Id

Customer NameCustomer Address

Customer Phone

Customer NameCustomer Address

Customer Phone

ORDER

Order NumberOrder Number

Customer Id (FK)Order Date

Order StatusOrder Shipdate

Customer Id (FK)Order Date

Order StatusOrder Shipdate

Page 33: Maturity DB Process

Non-mandatory non-identifying Non-mandatory non-identifying relationshiprelationship

A non-identifying relationship in A non-identifying relationship in which an instance of the child entity which an instance of the child entity can exist without being related to an can exist without being related to an instance of the parent entity.instance of the parent entity.

EMPLOYEE

Employee IdEmployee Id

Department Number (FK)Employee Name

Employee Address

Department Number (FK)Employee Name

Employee Address

employs/belongs to

Department Number

Department Number

Department NameDepartment

Location

Department NameDepartment

Location

DEPARTMENT

Page 34: Maturity DB Process

Many-to-Many RelationshipMany-to-Many Relationship

A many-to-many relationship is one where a A many-to-many relationship is one where a relationship and its inverse are both to-many relationship and its inverse are both to-many (if you are used to entity-relationship (if you are used to entity-relationship modeling using a relational database.modeling using a relational database.

is ordered from

/sends usPART SUPPLIER

Page 35: Maturity DB Process

Build RelationshipBuild Relationship

Draw and name anIdentifying Relationship

from Parent to Child

M:M

inheritableor

Non-inheritable

Draw and name aNon-identifying Relationship

from Parent to ChildFK - NO NULL

Draw and name aNon-identifying Relationship

from Parent to ChildFK - NULLS ALLOWED

1 : Mor

M : M M:M

1:MCardinality of R

Indentifyor

Non-identify

Start

Y

N

Y

Page 36: Maturity DB Process

Normalize to Reduce Data Normalize to Reduce Data Redundancy Redundancy

Data normalization is a process in which data Data normalization is a process in which data attributes within a data model are organized to attributes within a data model are organized to increase the cohesion of entity types. increase the cohesion of entity types.

Level Rule

First normal First normal form (1NF)form (1NF)

An entity type is in 1NF when it contains no repeating An entity type is in 1NF when it contains no repeating groups of data.groups of data.

Second normal Second normal form (2NF)form (2NF)

An entity type is in 2NF when it is in 1NF and when all An entity type is in 2NF when it is in 1NF and when all of its non-key attributes are fully dependent on its of its non-key attributes are fully dependent on its primary key.primary key.

Third normal Third normal form (3NF) form (3NF)

An entity type is in 3NF when it is in 2NF and when all An entity type is in 3NF when it is in 2NF and when all of its attributes are directly dependent on the primary of its attributes are directly dependent on the primary key.key.

Page 37: Maturity DB Process

NormalizationNormalization

Step by step process to verify and refine Step by step process to verify and refine logical data modellogical data model

Condition of model at completion of each Condition of model at completion of each step is a “normal form”step is a “normal form”

DOT standard is third normal formDOT standard is third normal form First normal form:First normal form:

Eliminate repeating groups Eliminate repeating groups Second normal form:Second normal form:

Ensure that all attributes depend on the entity identifier Ensure that all attributes depend on the entity identifier Third normal form:Third normal form:

Ensure that all attributes depend only on the entity Ensure that all attributes depend only on the entity identifieridentifier

Page 38: Maturity DB Process

1st Normal Form1st Normal Form

Eliminate repeating groups Eliminate repeating groups To remove the repeating group of fields, To remove the repeating group of fields,

collapse them into a single field with collapse them into a single field with multiple records in a new table, related multiple records in a new table, related back to the primary data. back to the primary data.

Page 39: Maturity DB Process

2nd Normal Form2nd Normal Form

Uniquely identify each instanceUniquely identify each instance Each table must contain attributes for a Each table must contain attributes for a

single subject and each table must single subject and each table must contain an attribute (or set of attributes) contain an attribute (or set of attributes) that uniquely identify a single record that uniquely identify a single record within that table. within that table.

Page 40: Maturity DB Process

3rd Normal Form3rd Normal Form

Eliminate columns not dependent on Eliminate columns not dependent on the key the key Each attribute must depend on the Each attribute must depend on the

primary key, so the violating fields are primary key, so the violating fields are moved into separate, related tables. moved into separate, related tables.

Page 41: Maturity DB Process

II Physical DesignII Physical Design

Page 42: Maturity DB Process

Physical DesignPhysical Design

Mapping Logical Model to Physical ModelMapping Logical Model to Physical Model Naming standardNaming standard Identify table typeIdentify table type Column Data TypeColumn Data Type Group tablesGroup tables Assign KeysAssign Keys Choose IndexChoose Index Denormalizate to improve performanceDenormalizate to improve performance StorageStorage

Page 43: Maturity DB Process

Mapping Logical Model to Mapping Logical Model to Physical ModelPhysical Model

Entity -> TableEntity -> Table Attribute -> ColumnAttribute -> Column Primary Key -> Primary KeyPrimary Key -> Primary Key Relationship -> Foreign KeyRelationship -> Foreign Key Inversion Entry -> IndexInversion Entry -> Index

Page 44: Maturity DB Process

Naming StandardNaming Standard

Name the db objects under defined Name the db objects under defined naming standardnaming standardExample: table should have a prefix t_Example: table should have a prefix t_

Define abbreviationDefine abbreviationExample: Cargo -> CGOExample: Cargo -> CGO

Page 45: Maturity DB Process

Table TypesTable Types

Table PurposeTable Purpose

Data WaveData Wave

Data SizeData Size

Page 46: Maturity DB Process

Table PurposeTable Purpose

Transaction TableTransaction Table

Log Table / Analysis tableLog Table / Analysis table

Statistics TableStatistics Table

Supporting TableSupporting Table

Page 47: Maturity DB Process

Data WaveData Wave

Stable TableStable Table

Increasing TableIncreasing Table

Volatile TableVolatile Table

Page 48: Maturity DB Process

Data SizeData Size

Large TableLarge Table

Small TableSmall Table

Page 49: Maturity DB Process

Group TableGroup Table

Group table by business moduleGroup table by business module

Group table by relationshipGroup table by relationship

Page 50: Maturity DB Process

Column Data TypeColumn Data Type

Choose data typeChoose data type Char Varchar2Char Varchar2 Number Integer FloatNumber Integer Float

LengthLength LOBLOB

Store in rowStore in row Store in another tablespaceStore in another tablespace

Page 51: Maturity DB Process

Assign Primary KeyAssign Primary Key

Natural KeyNatural Key AAssign a natural key which is one or ssign a natural key which is one or

more existing data attributes that are more existing data attributes that are unique to the business concept. unique to the business concept.

Surrogate KeySurrogate Key IIntroduce a new column, called a ntroduce a new column, called a

surrogate key, which is a key that has surrogate key, which is a key that has no business meaning.  no business meaning. 

Page 52: Maturity DB Process

Natural KeyNatural Key

AdvantageAdvantage No need introduce new columnNo need introduce new column Meaningful and Meaningful and understandableunderstandable Key value is tKey value is transferableransferable

DisadvantageDisadvantage May changed by business requirement changeMay changed by business requirement change May contain many columns in feature generationMay contain many columns in feature generation Key value may be updated which will also impact Key value may be updated which will also impact

children tableschildren tables

Page 53: Maturity DB Process

Surrogate KeySurrogate Key

AdvantageAdvantage Not related to business, be easily maintainNot related to business, be easily maintain StableStable Just contain one single column, simplify the Just contain one single column, simplify the

foreign keyforeign key DisadvantageDisadvantage

Will lead to recursive relationshipWill lead to recursive relationship Hard to understand the relationship and its typeHard to understand the relationship and its type May add May add redundancyredundancy code code

Page 54: Maturity DB Process

How to choose surrogate How to choose surrogate key?key?

Key assigned by the RDBMS, e.g. Key assigned by the RDBMS, e.g. SEQUENCESEQUENCE

Max()+1Max()+1 Universally Unique Identifiers (UUID)Universally Unique Identifiers (UUID) Global Unique Identifiers (GUID)Global Unique Identifiers (GUID) High-Low strategyHigh-Low strategy

Page 55: Maturity DB Process

Choose Key SChoose Key Strategiestrategies

UniqueUnique Minimal ColumnsMinimal Columns Not nullNot null StableStable Fit to the applicationFit to the application

Page 56: Maturity DB Process

Assign Foreign KeyAssign Foreign Key

Ensure the data integrationEnsure the data integration

Delete/Update CascadeDelete/Update Cascade

Which case no need assign Foreign Which case no need assign Foreign Key?Key?

Page 57: Maturity DB Process

How to choose indexHow to choose index

Proto-index from logical modelProto-index from logical model Eliminate overlapped indexEliminate overlapped index Eliminate low-hit indexEliminate low-hit index Column sequence in indexColumn sequence in index B-Tree .vs. BitmapB-Tree .vs. Bitmap

Page 58: Maturity DB Process

Proto-index from logical Proto-index from logical modelmodel

Inversion EntryInversion Entry

Primary KeyPrimary Key

Candidate Key

Foreign Key

Page 59: Maturity DB Process

Eliminate overlapped indexEliminate overlapped index

Index overlap indexIndex overlap index

Multiple Option ColumnsMultiple Option Columns

Page 60: Maturity DB Process

Eliminate low-hit indexEliminate low-hit index

Small Table / Cached TableSmall Table / Cached Table

Indexed Column cardinalityIndexed Column cardinality(1/distinct_value_num)*total_value_num(1/distinct_value_num)*total_value_num

Page 61: Maturity DB Process

Column sequence in indexColumn sequence in index

High searching column leading the High searching column leading the indexindex

Low Cardinality column leading the Low Cardinality column leading the indexindex

Conduce to eliminate duplicated indexConduce to eliminate duplicated index

Page 62: Maturity DB Process

B-Tree .vs. BitmapB-Tree .vs. Bitmap

B-Tree IndexB-Tree Index OLTP tableOLTP table Low Cardinality ColumnLow Cardinality Column

Bitmap IndexBitmap Index DSS/OLAP tableDSS/OLAP table High Cardinality ColumnHigh Cardinality Column

Page 63: Maturity DB Process

Denormalize to improve Denormalize to improve performanceperformance

Adding redundancy data toAdding redundancy data to avoid avoid costly table joins can dramatically costly table joins can dramatically improve the query performanceimprove the query performance..

Page 64: Maturity DB Process

When denormalize?When denormalize?

Repeatedly join two table together.Repeatedly join two table together.

Additional query item.Additional query item.

Additional order by item.Additional order by item.

Page 65: Maturity DB Process

Which column be Which column be redundancyredundancy

Small data columnSmall data column

Static and rarely updated columnStatic and rarely updated column

Page 66: Maturity DB Process

Materialized ViewMaterialized View

A materialized view is a database A materialized view is a database object that contains the results of a object that contains the results of a query.query.

A view of tables;A view of tables; Query result be stored physically.Query result be stored physically.

Page 67: Maturity DB Process

Redundancy & IntegrationRedundancy & Integration

TriggerTrigger

Scheduled JobScheduled Job

Page 68: Maturity DB Process

StorageStorage

TablesapceTablesapce

Table storageTable storage

Page 69: Maturity DB Process

TablesapceTablesapce

Dictionary Management Tablespace Dictionary Management Tablespace (DMT)(DMT)

Local Management Tablespace (LMT)Local Management Tablespace (LMT)

Page 70: Maturity DB Process

ASSMASSM

ASSMASSM (Automatic Segment Space (Automatic Segment Space Management) is a method used by Management) is a method used by Oracle to manage space inside data Oracle to manage space inside data blocks. It eliminates the need to blocks. It eliminates the need to specify parameters like PCTUSED, specify parameters like PCTUSED, Freelists and Freelist groups for Freelists and Freelist groups for objects created in the tablespace. objects created in the tablespace.

Page 71: Maturity DB Process

Table StorageTable Storage

Cached TableCached Table Index Organized TableIndex Organized Table Compressed TableCompressed Table Partition TablePartition Table Cluster TableCluster Table External TableExternal Table Global Temporary TableGlobal Temporary Table

Page 72: Maturity DB Process

Cached TableCached Table

For data that is accessed frequently, this For data that is accessed frequently, this clause indicates that the blocks retrieved for clause indicates that the blocks retrieved for this table are placed at the this table are placed at the most recently most recently usedused end of the least recently used (LRU) list end of the least recently used (LRU) list in the buffer cache when a full table scan is in the buffer cache when a full table scan is performed. This attribute is useful for small performed. This attribute is useful for small lookup tables. lookup tables.

You cannot specify CACHE for an index-You cannot specify CACHE for an index-organized table. However, index-organized organized table. However, index-organized tables implicitly provide CACHE behavior. tables implicitly provide CACHE behavior.

Page 73: Maturity DB Process

Index Organized TableIndex Organized Table

TThe data rows are held in an index he data rows are held in an index defined on the primary key for the defined on the primary key for the table. table.

BBest suited for primary key-based est suited for primary key-based access and manipulation. access and manipulation.

Page 74: Maturity DB Process

Compressed TableCompressed Table

Enables data segment compression Enables data segment compression to reduce disk use.to reduce disk use.

Only for heap-organized tables.Only for heap-organized tables.

LOB data segments are not LOB data segments are not compressed.compressed.

Page 75: Maturity DB Process

Partition TablePartition Table

PPartition the table artition the table by rulesby rules. .

Data will be stored at different partition.Data will be stored at different partition.

CCannot partition a table that is part of a annot partition a table that is part of a cluster. cluster.

CCannot partition a table containing any LONG annot partition a table containing any LONG or LONG RAW columns. or LONG RAW columns.

Page 76: Maturity DB Process

Cluster TableCluster Table

Specify one column from the table Specify one column from the table for each column in the cluster keyfor each column in the cluster key..

A clustered table uses the cluster's A clustered table uses the cluster's space allocation. space allocation.

Object tables and tables containing Object tables and tables containing LOB columns cannot be part of a LOB columns cannot be part of a cluster. cluster.

Page 77: Maturity DB Process

External TableExternal Table

It It is a read-only tableis a read-only table, whose m, whose metadata is etadata is stored in the databasestored in the database and table d and table data ata stored stored in in outside databaseoutside database, flat file., flat file.

can specify only can specify only columncolumn, , datatypedatatype, and , and inline_constraintinline_constraint. .

cannot specify constraints on an external cannot specify constraints on an external table. table.

cannot have object type columns, LOB cannot have object type columns, LOB columns, or LONG columns. columns, or LONG columns.

Page 78: Maturity DB Process

Global Temporary TableGlobal Temporary Table

TTable is temporary and that its able is temporary and that its definition is visible to all sessions. definition is visible to all sessions.

The data in a temporary table is The data in a temporary table is visible only to the session that visible only to the session that inserts the data into the table. inserts the data into the table.

it contains either it contains either session-specificsession-specific or or transaction-specifictransaction-specific data data, which , which decided by the ON COMMIT clause.decided by the ON COMMIT clause.

Page 79: Maturity DB Process

Maintain PlanMaintain Plan

Table SizingTable Sizing

Housekeeping PlanHousekeeping Plan

Analyze Statistics dataAnalyze Statistics data

Page 80: Maturity DB Process

Table SizingTable Sizing

Data type lengthData type length VARCHAR2VARCHAR2 LOBLOB Other typeOther type

IndexIndex RowidRowid

Data growthData growth

Page 81: Maturity DB Process

Initial sizing methodInitial sizing method

Calculate Row size by summing column Calculate Row size by summing column length.length.

Insert initial data & analyze table to get the Insert initial data & analyze table to get the row sizerow size

Analyze exiting table to get the row size.Analyze exiting table to get the row size.

Space fragment redundancy (5%~30%).Space fragment redundancy (5%~30%).

Page 82: Maturity DB Process

Housekeeping PlanHousekeeping Plan

Which table need by housekept?Which table need by housekept?

When to perform housekeeping?When to perform housekeeping?

How to housekeep?How to housekeep?

Page 83: Maturity DB Process

Which table need by Which table need by housekept?housekept?

Transaction table / Log table;Transaction table / Log table;

Increasing table;Increasing table;

Large tableLarge table

Page 84: Maturity DB Process

When to perform When to perform housekeeping?housekeeping?

Housekeeping is high cost operation.Housekeeping is high cost operation.

Should be performed at low-loading or Should be performed at low-loading or down time.down time.

High housekeeping frequency will help to High housekeeping frequency will help to keep low HWM.keep low HWM.

Should be performed periodically.Should be performed periodically.

Page 85: Maturity DB Process

How to housekeep?How to housekeep?

Housekeep conditionHousekeep condition TimeTime StatusStatus

Online data ->[Compressed Data ] -> Online data ->[Compressed Data ] -> [ Archived Data ] -> Deleted data[ Archived Data ] -> Deleted data

Schedule Job / ManuallySchedule Job / Manually

Page 86: Maturity DB Process

Analyze Statistics dataAnalyze Statistics data

Which table need be analyzed?Which table need be analyzed?

When to analyze?When to analyze?

Page 87: Maturity DB Process

Which table need be Which table need be analyzed?analyzed?

In CBO, all of tables need be In CBO, all of tables need be analyzed.analyzed.

Different kinds of table have different Different kinds of table have different analyze interval.analyze interval.

Page 88: Maturity DB Process

When to analyze?When to analyze?

Table be online for a time, when data Table be online for a time, when data enough.enough.

Data volume changed dramatically.Data volume changed dramatically.

Table structure changed.Table structure changed.

Page 89: Maturity DB Process

IV ExampleIV Example

Student Course Management SystemStudent Course Management System

Page 90: Maturity DB Process

Student Course Management Student Course Management SystemSystem

EntitiesEntities StudentStudent CourseCourse

Student Course

Page 91: Maturity DB Process

AttributesAttributes

Student Course Management Student Course Management SystemSystem

Student IDNameSexAgeAddressCollegeCollege Address

Student

Course IDCourse NameTeacher IDTeacher Name

Course

Page 92: Maturity DB Process

1NF – Eliminate Repeating Groups1NF – Eliminate Repeating Groups

Student IDFirst NameLast NameSexAgeAddressCollegeCollege Address

Student

Course IDCourse NameTeacher IDTeacher First NameTeacher Last Name

Course

Page 93: Maturity DB Process

Student Course Management Student Course Management SystemSystem

KeysKeys

Student ID (PK)First Name (AK1)Last Name (AK1)SexAgeAddress (AK1)CollegeCollege Address

Student

Course ID (PK)Course Name (AK1)Teacher ID (AK1)Teacher First NameTeacher Last Name

Course

Page 94: Maturity DB Process

Student Course Management Student Course Management SystemSystem

Inversion EntryInversion Entry

Student ID (PK)First Name (AK1)Last Name (AK1)SexAgeAddress (AK1)College (IE1)College Address

Student

Course ID (PK)Course Name (AK1) (IE1)Teacher ID (AK1) (IE2)Teacher First NameTeacher Last Name

Course

Page 95: Maturity DB Process

Student Course Management Student Course Management SystemSystem

RelationshipRelationship

Student Elect Course

Course Open For Student

Student ID (PK)First Name (AK1)Last Name (AK1)SexAgeAddress (AK1)College (IE1)College Address

Student

Course ID (PK)Course Name (AK1) (IE1)Teacher ID (AK1) (IE2)Teacher First NameTeacher Last Name

Course

Page 96: Maturity DB Process

Student Course Management Student Course Management SystemSystem

Transform Many-to-Many to One-to-Transform Many-to-Many to One-to-ManyMany

Student ID (PK)First Name (AK1)Last Name (AK1)SexAgeAddress (AK1)College (IE1)College Address

Student

Course ID (PK)Course Name (AK1) (IE1)Teacher ID (AK1) (IE2)Teacher First NameTeacher Last Name

Course

Student ID(FK1)Course ID(FK2)ScoreElection TimesCredit Hour

Election Course Open For Student

Student Elect Course

Page 97: Maturity DB Process

Student Course Management Student Course Management SystemSystem

2NF -- 2NF -- Ensure that all attributes Ensure that all attributes depend on the entity identifier depend on the entity identifier

Student ID (PK)First Name (AK1)Last Name (AK1)SexAgeAddress (AK1)College (IE1)College Address

Student

Course ID (PK)Course Name (AK1) (IE1)Teacher ID (AK1) (IE2)Teacher First NameTeacher Last NameCredit Hour

Course

Student ID(FK1)Course ID(FK2)ScoreElection Times

Election Course Open For Student

Student Elect Course

Page 98: Maturity DB Process

Student Course Management Student Course Management SystemSystem

3NF -- 3NF -- Ensure that all attributes Ensure that all attributes depend only on the entity identifierdepend only on the entity identifier

Student ID (PK)First Name (AK1)Last Name (AK1)SexAgeAddress (AK1)College ID(IE1)(FK1)

Student

Course ID (PK)Course Name (AK1) (IE1)Teacher ID(AK1)(IE2)(FK1)Credit Hour

Course

Student ID(FK1)Course ID(FK2)ScoreElection Times

Election Course Open For Student

Student Elect Course

College IDCollege NameCollege AddressRector

CollegeTeacher IDTeacher First NameTeacher Last NameCollege ID(FK1)

Teacher

Student Belong to College

Teacher Belong to College

Teacher Teach Course

Page 99: Maturity DB Process

Q & AQ & A

Page 100: Maturity DB Process

Thanks!Thanks!

www.HelloDBA.comwww.HelloDBA.comfuyuncatfuyuncat