Coping with global change - vulnerability and adaptation in Indian ...
“Change Bad!” Coping with change in the data you store...1 SMS#Management#Technology “Change...
Transcript of “Change Bad!” Coping with change in the data you store...1 SMS#Management#Technology “Change...
-
1
SMS M
anag
emen
t & Tec
hnology “Change Bad!”
Coping with change in the data you store
Andrew J. Todd esq. OSDC – November, 2009
-
2
SMS M
anag
emen
t & Tec
hnology
What?
A journey through identifying, understanding and managing change in database schemas
-
3
SMS M
anag
emen
t & Tec
hnology
Who?
Application developers
-
4
SMS M
anag
emen
t & Tec
hnology
Who?
Database designers/developers
-
5
SMS M
anag
emen
t & Tec
hnology
Who?
Database Administrators
-
6
SMS M
anag
emen
t & Tec
hnology
Databases
-
7
SMS M
anag
emen
t & Tec
hnology
Even these ones
-
8
SMS M
anag
emen
t & Tec
hnology
Terminology Database
A service that allows an application to store data
Database Schema A logical collection of objects within a database
Database Object A construct within a database that stores similar items
Domain Model A representation of our understanding of a problem area
-
9
SMS M
anag
emen
t & Tec
hnology
Change
“Data matures like wine, applications like fish”
-
10
SMS M
anag
emen
t & Tec
hnology
The Causes of Change
User requirements maturing
-
11
SMS M
anag
emen
t & Tec
hnology
The Causes of Change
New domains
-
12
SMS M
anag
emen
t & Tec
hnology
The Causes of Change
YAGNI
-
13
SMS M
anag
emen
t & Tec
hnology
When Do Things Change?
Data models have a lower rate of change than the applications that work with them
-
14
SMS M
anag
emen
t & Tec
hnology
What Changes?
Tables
-
15
SMS M
anag
emen
t & Tec
hnology
What Changes?
Columns
-
16
SMS M
anag
emen
t & Tec
hnology
What Changes?
Views
-
17
SMS M
anag
emen
t & Tec
hnology
What Changes?
Stored Procedures
-
18
SMS M
anag
emen
t & Tec
hnology
What Changes?
Indexes
-
19
SMS M
anag
emen
t & Tec
hnology
How Do We Track Changes?
Put the DDL in version control
-
20
SMS M
anag
emen
t & Tec
hnology
How Do We Track Changes?
Put a database independent model in version control
-
21
SMS M
anag
emen
t & Tec
hnology
How Do We Track Changes?
But … Database = DDL + Data
-
22
SMS M
anag
emen
t & Tec
hnology
How Do We Track Changes?
Actually … Database = DDL + Data + Implementation
-
23
SMS M
anag
emen
t & Tec
hnology
Strategies For Coping
Do Nothing
-
24
SMS M
anag
emen
t & Tec
hnology
Strategies For Coping
Store complete DDL for each schema version
-
25
SMS M
anag
emen
t & Tec
hnology
Strategies For Coping
Store complete initial DDL and subsequent deltas
-
26
SMS M
anag
emen
t & Tec
hnology
Strategies For Coping
Store complete DDL for every version and subsequent deltas
-
27
SMS M
anag
emen
t & Tec
hnology
Strategies For Coping
Don’t forget reference data
-
28
SMS M
anag
emen
t & Tec
hnology
Strategies For Coping
Or schema (user) creation scripts
-
29
SMS M
anag
emen
t & Tec
hnology
What To Do When Things Go Wrong
You have a backup, right?
-
30
SMS M
anag
emen
t & Tec
hnology
What To Do When Things Go Wrong
The secret to success is testing
-
31
SMS M
anag
emen
t & Tec
hnology
What To Do When Things Go Wrong
Where possible complement ‘upgrade’ with ‘downgrade’
-
32
SMS M
anag
emen
t & Tec
hnology
What To Do When Things Go Wrong
Each migration should maintain data integrity
-
33
SMS M
anag
emen
t & Tec
hnology
What To Do When Things Go Wrong
Prior to the migration take a copy of the table being updated and store it in a staging area
Validate that the copy and the original object have the same structure and contents.
Perform the migration on the original object Validate that the migration is successful - by running the
migration tests After a suitable period of time, usually not less than a week,
remove the copy of the table from the staging area
From “Database Refactoring”:
-
34
SMS M
anag
emen
t & Tec
hnology
What To Do When Things Go Wrong
High Availability is a different kettle of fish
-
35
SMS M
anag
emen
t & Tec
hnology
Finis
Version Control is your friend but you need to think about how you use it …