Вы находитесь на странице: 1из 50

ibm.

com/db2/labchats

Enabling applications from Oracle to DB2 the easy way


July 16, 2009
1

ibm.com/db2/labchats
2009 IBM Corporation

> Featured Speaker


Serge Rielau SQL Architect, DB2 for Linux, UNIX, and Windows IBM

2009 IBM Corporation

Agenda
Motivation Oracle compatibility in DB2 9.7 Steps of enablement to DB2 Choosing the right applications Customer and partner experiences

2009 IBM Corporation

Motivation
TINYINT

NUMBER VARCHAR2

SELECT * FROM T

recursion, ..

DB2

Your choices

SQL Standard

Pick one dialect and stick (or be stuck) with it. For ISVs: Pick two or all and have dual/triple maintenance Pick intersect only and escape to Java, Hibernate etc You loose either way!
4
2009 IBM Corporation

What did DB2 do to bridge the gap?


Traditionally
Implement SQL Standard features Extend SQL standard with popular features Map proprietary SQL using Migration Tool Kit (MTK)

Problem

5

MTK can only help with data base objects and DDL e.g. procedures, triggers, functions, tables ..but SQL is littered throughout the application code! Impedance mismatch can cause performance issues
2009 IBM Corporation

A new approach
Syntax toleration
Where no semantic conflicts exist

Added infrastructure

Eliminate impedance mismatch

Compatibility modes

Overcome clashes between DB2 and other SQL dialects

Out of the box compatibility for your app


Client side Server side
6
2009 IBM Corporation

Early feedback
More than 300 participants in the Early Access
Some participants with multiple applications Many applications that currently use Oracle Many participants enabled their applications to use DB2 in a few days 7.5M LOC PL/SQL for biggest beta customer

Detailed analysis reveals that:


On average, participants experience 90% less effort to enable DB2 Some participants need only change the connect string!!!

2009 IBM Corporation

DB2 9.7 adds Oracle compatibility features


Oracle Concurrency Control SQL dialect PL/SQL PL/SQL Packages Built-in package library JDBC extensions OCI SQL*Plus Scripts DB2 Native support Native support Native support Native support Native support Native support Native support Native support

Changes are the exception. Not the rule.


THIS IS WHY WE CALL IT ENABLEMENT AND NOT PORT !
8
2009 IBM Corporation

Concurrency Control
Pre DB2 9.7 DB2 9.7 Architecture

2009 IBM Corporation

Concurrency Control of old


Oracle default
Statement level snapshot blocks Reader Writer Reader No No Writer No Yes

DB2 default
Cursor stability blocks Reader Writer Reader No No* Writer Yes Yes
* In default isolation DB2 keeps no rows locked while scanning

10

2009 IBM Corporation

Concurrency Control in DB2 9.7


read currently committed variation on DB2s cursor stability isolation
If uncommitted row-change found use currently committed version Default behavior in DB2 9.7
blocks Reader Writer Reader No Writer
11

No Yes
2009 IBM Corporation

No

Concurrency Control in DB2 9.7


Log based
No management overhead No performance overhead No wasted memory/storage (no undo tablespace)
Scanner User 1: Table T1
Name Country Italy France Spain Greece Israel Belgium

Memory Lookup Log Buffer RID 1=Rossi->Russo Log Files

update T1 set name = Russo where country=Italy


User 2:

Rossi Russo Bernard Garcia Pappas Levi Peeters

select * from T1
Locks

12

2009 IBM Corporation

Oracle SQL Dialect support


Data types Casting Function library SQL constructs

13

2009 IBM Corporation

New types in DB2 9.7


Type NUMBER VARCHAR2 DATE BOOLEAN Hash tables VARRAY Row Type Cursor type Comment Exploits P6 hardware accelerated DECFLOAT is NULL, trailing blank sensitive collation Year to seconds, SYSDATE In procedural code Associative INDEX BY arrays in procedural code Regular arrays in procedural code In procedural code, ARRAY, hash tables Allows passing, and predefining of ref-cursor

TIMESTAMP(n) 0 (date + time) <= N <= 12 (date + time + picoseconds)

14

2009 IBM Corporation

Weak Typing in DB2


DB2 has been following strict SQL standard typing rules The trend is towards weak typing (PERL, RUBY, PHP, ) New behavior

Implicit conversion between numerics and strings on:


SET salary = 52000 WHERE salary > 52000 salary: || 52000

Substitutability between DATE and TIMESTAMP


Save storage for a DATE column by using SQL Standard DATE without changing an Oracle DATE based application

More aggressive usage of NULL and parameter markers


Function invocation with untyped parameter markers and NULL values foo(?, NULL)
15
2009 IBM Corporation

New functions in DB2 9.7

Function Conversion and Formatting Date arithmetic String manipulation Misc TO_CHAR, TO_DATE, TO_TIMESTAMP, TO_NUMBER, TO_CLOB EXTRACT, ADD_MONTHS, INITCAP, RPAD, LPAD, INSTR, DECODE, NVL, LEAST, GREATEST, BITAND

16

2009 IBM Corporation

New SQL in DB2


Feature
CONNECT BY (+)-join DUAL ROWNUM SELECT INTO FOR UPDATE ROWID AUTONOMOUS TX TRUNCATE table Public synonym CREATEd temp table and more
17
2009 IBM Corporation

Tree walk recursion, includes helper functions (9.5) Old style OUTER JOIN syntax (9.5) Dummy one row, one column table (9.5) Pseudo column for ROWNUMBER() (9.5) Get update lock without a cursor Pseudo column syntax for RID_BIT() Independent transactions for auditing Quickly delete a table without logging For table, sequence, module Catalogued, private temporary table

PL/SQL in DB2 9.7


Architecture Debugging etc Depth and breath of support

18

2009 IBM Corporation

Native PL/SQL support in DB2


Source level debugging and profiling Built-in Proven
PL/SQL Compiler SQL PL Compiler Debugger Profiler Editor Data Studio

SQL Unified Runtime Engine DB2 Server Data base

Quality criteria: PL/SQL execution at >95% of SQL PL


19
2009 IBM Corporation

Optim Development Studio PL/SQL Debugger

20

2009 IBM Corporation

Supported PL/SQL constructs


Function All logic EXCEPTION Constant variables FOR over range over SELECT over cursor User Defined Exceptions %TYPE %ROWTYPE #PRAGMA AUTONOMOUS
21

IF, WHILE, :=, etc.. Try/catch handling Variables that cannot be set Step through numbers Step through result set of query Step through result set of cursor Define conditions with or without SQLCODEs Anchored scalar data types Anchored row types Procedure executes in own commit scope

2009 IBM Corporation

PL/SQL in DB2
Area Anonymous block Scalar function Procedure PL/SQL Package Trigger Including DEFAULT, and named parameters Known as MODULE in SQL PL Row level, Before or After Server side scripting New also in SQL PL dialect

22

2009 IBM Corporation

PL/SQL Packages in DB2


Feature CREATE PACKAGE CREATE PACKAGE BODY Replace package body PKG [BODY] VARIABLE CURSOR TYPE EXCEPTION FUNCTION PROCEDURE SYNONYM ON PACKAGE Public synonyms Define prototypes and public objects Define content and private objects Replace body without loosing prototypes or public objects Public/private variables Public/private cursors Public/private types User defined exceptions

23

2009 IBM Corporation

Built-in package library


Library DBMS_OUTPUT UTL_FILE DBMS_ALERT DBMS_PIPE DBMS_JOB DBMS_LOB DBMS_SQL DBMS_UTILITY UTL_MAIL UTL_SMTP
24

print debugging and simple reporting Server side I/O API Cross session semaphoring Cross session data pipe Job scheduler Alternate API to DB2 native LOB functions Alternate API to PREPARE/EXECUTE Misc functions and procedures Server API to email Server API to SMTP
2009 IBM Corporation

Using SQL*Plus scripts in DB2


CLPPlus
Compatible commands Compatible options Variable substitution Simple reporting Column formatting Control variables

25

2009 IBM Corporation

Steps of Enablement
1. Identify and size-up candidate using the MEET DB2 Tool 2. Enable application using the IBM Data Movement Tool 3. Test, Test, Test 4. Parallel production 5. Cut-Over

26

2009 IBM Corporation

Best targets for enablement to DB2


Cross vendor standardized client APIs (+ OCI) JDBC ODBC .NET OCI Isolated/no dependencies on extended options or features Spatial Streams (AQ) Text Search
27
2009 IBM Corporation

DB2 9.7 MEET Report Case Study

99.0% of statements
immediately transferable to IBM DB2

MEET Report Rapid assessment of application Early confirmation of compatibility Lists details and source code line number for exceptions
28
2009 IBM Corporation

DB2 Early Access Program Study


The compatibility level that DB2 9.7 achieved is amazing. Masato Kudo, Works Applications Code from 18 EAP Participants analyzed Range of industries, solutions, countries Range of sizes: 2,000 185,000 SQL statements Over 750,000 lines tested
20%

100%

80%

% of SQL statements

60%

90-99% of statements
immediately transferable to IBM DB2

40%

0% A B C D E F G H I J K L M N O P Q R Companies Supported Statements Unsupported Statements

90-99% of lines immediately transferable to DB2

29

2009 IBM Corporation

IBM Data Movement Tool Setup

30

2009 IBM Corporation

IBM Data Movement Tool Select, Deploy, Patch

31

2009 IBM Corporation

openbravo to DB2 9.7


DB2 9.5: ~2 YEARS
1. Map schema and data types Different datatype behavior. Eg: DATE Different DDL 2. Move data 3. Translate PL/SQL code (Triggers/Procedures/Functions) Missing built-in functions & packages Missing functionality: REF CURSORs, %TYPE, 4. Translate SQL in application logic (manual) Untyped expressions (thousands of occurences) 5. Debugging Hard to fix concurrency problems 6. Test and Tuning

DB2 9.7: 1 WEEK


1. Map schema and data types Native support 99% of SQL no change 156 of 158 procedures- no change PL/SQL no change 2. Move data 3. Run the shared code Native support NO EMULATION!! Minor adjustments (triggers needed tune up) 4. Test and Tuning

No porting effort for future releases of the application

32

2009 IBM Corporation

Reactions to DB2 9.7


Two years One week!
"To move our application to DB2 9.5 would have taken an estimated two-year effort. We were thrilled to see it took only one week to move it to DB2 9.7. This represents a terrific opportunity to expand our international community of users, partners and developers, and were very excited to partner with IBM to make new deployment options available. Paolo Juvara, CTO of Openbravo (Spain)

Significantly lower overall costs


"These features drastically reduce the time required for migration efforts and significantly lower overall costs. Axel Puerner, Managing consultant, Puerner Unternehmensberatung

Paradigm shift
"The new IBM DB2 offers true ENABLEMENT and not mere PORTING. This feature is a paradigm shift in the very concept of database migration!" Godson Retna, Senior Architect, Cognizant Technology Solutions

33

2009 IBM Corporation

Anixters experience with DB2 9.7 beta

Bernie OConnor Director Information Technology Anixter

July 16, 2009 Glenview, IL, USA

34

Anixters Business See www.anixter.com


Anixter is a leading global supplier of communications and security products, electrical and electronic wire and cable, fasteners and other small components. We help our customers specify solutions and make informed purchasing decisions around technology, applications and relevant standards. Throughout the world, we provide innovative supply chain management services to reduce our customers' total cost of production and implementation. To more than 100,000 customers in 52 countries, Anixter is more than a distributor: we are a business partner.

35

Why DB2 9.7? Business Driver to hold down costs Key business driver: hold down personnel costs
by maintaining skilled professionals for one enterprise software stack, instead of two. personnel, even more than hardware and software, is a critical cost to be considered. we already have specialists in WebSphere, MQ Series and DB2

36

Business Application Warehouse Management System Warehouse Management System


Contracted to be done in WebSphere / DB2 Delivered in JBoss / Oracle We still wanted WebSphere / DB2

Lines of code
Java: 2501 files with 171,285 lines of code JSP: 387 files with 19,101 lines of code XML: 400 files with 153,897 lines XSD:63 XSD files with 4,898 lines JS (Javascript): 60 files with 21,350 lines. Tables: 223 Views: 194, many nested
37

Ease of Migration It worked! It migrated successfully! We ran the exact same tests as with JBoss / Oracle With WebSphere / DB2 9.7:
Read Consistency worked
This was a very big deal! Writers didnt block readers for the application

Equivalent Performance
Some normal tuning using indexes

38

Extra Effort RI Design, Datatypes Referential Integrity


Oracle permits selective enforcement of RI The Physical Design included an aggregation table
Null parent RI references - Children without parents

Resolution:
Either drop the RI or break out the aggregation into multiple tables

Datatypes
Conversion tool and Number columns (easy to fix)
Converted to DECFLOAT(16) by conversion tool Unqualified Decimal column resulted in Decimal (5, 0) Easy to fix the DDL once identified

Non-problem differences upon review: Timestamp Manipulation: Microseconds Varchar2: No problem for our application
39

DB2 9.7 Beta Program was a great experience! Thanks to IBM, IDUG, Gold Consultants Beta program experience was very good! Thanks to:
IBM
Maria Schwenger (DB2 enablement advocate)

IDUG
Chris Eaton (IBM Toronto Lab - DB2 Technical Evangelist) Martin Hubel (Martin Hubel Consulting)

IBM DB2 Gold Consultants and Data Champions


Dave Beulke (Gold Consultant and Data Champion)
Pragmatic Solutions (PSI)

Ingo Muller (former Gold Consultant)

40

Brett Annandale CEO and Founder AnnanTech Ltd.

www.annantech.com

WISDOM port to DB2 9.7


41
41

AnnanTech 2009

AnnanTech 2009

Background

AnnanTech is an IT service provider. Our experience spans Finance, Risk Management, Business Continuity, Security and Information Assurance. WISDOM is our CME (Central Management Encyclopaedia) system which connects/accesses all your existing systems to give a single, useful focused view of your business information in one place. WISDOM had been designed to support multiple databases simultaneously, but actual port had not been required from MS SQL Server by clients. But the need arose for both Oracle and DB2 support at the same time i.e. twice the problem with same number of hands!
42
42 www.annantech.com

The Port

Luckily WISDOMs internal structures were designed for this, but did still require actual work to port base tables, stored procedures and dealing with some SQL/DDL syntax differences. We used Oracle migration tool and IBM Migration Tool Kit (MTK) to get part way a lot of WISDOMs code is dynamic, which means neither migration tool works 100% for us. First completed Oracle port as a reference point using Oracle migration tools Oracle done. Minor tweaks of code to run natively on DB2 (note: we were using Beta, so this would be less now), and set DB2 for Oracle compatibility DB2 9.7 done.
43
43 www.annantech.com

Summary

Remember: we wanted to support all platforms a bit more complex than a single port. From supporting a single platform, we now support four in just over the time that wouldve been required for a single port. DB2 9.7 gave us One Dev Platform, suite of tools, etc. for:
Native (i.e. Legacy) DB2 support; Oracle support; and New DB2 9.7 support (one code base for 2 platforms going forward)

i.e. BANG FOR BUCK In Conclusion: Were proud to be part of the DB2 beta programme and tremendously pleased with DB2 9.7 and it saved us a lot of effort! And support given to us as ISV was of a very high standard.
44 www.annantech.com

44

Enablement of ExactCost Solutions to DB2 9.7

Gene Ostrovsky
Vice President R & D, ExactCost, Inc.

1999-2009 ExactCost, Inc.

45

Background
ExactCost is a software technology company focused on Clinical Cost & Process Improvement solutions for healthcare providers Our proprietary technology enables healthcare providers to improve their revenue and operational margins. ExactCost solutions are delivered via the Web, without any capital investment, enabling the organization to achieve sustainable bottom-line improvements.

46

Value of Enabling to IBM DB2 9.7

Becoming Blue
Offer our clients a complete package including ExactCost solutions and the hardware and services from one of the strongest brands in the world. Participate in IBMs HIF (Health Integration Framework) and acquire new clients and leads. Demonstrate ExactCost solutions to potential customers at IBMs Dallas Innovation Center.

47

DB2 9.7 Rapid Enablement Experience


Initial State Utilized Oracle 10G with: Extensive usage of Oracle PL/SQL stored procedures Extensive usage of advanced Oracle features The Target Support to DB2: ASAP Minimum code rewrite One code for Oracle and DB2 databases And the end result With IBM DB2 9.7 and the new IBM Optim Development Studio, we completed our recent code and data migration project from Oracle to DB2 in 80 percent less time than we originally estimated (with DB2 v9.5), saving about two and a half months.

48

> Questions

49

2009 IBM Corporation

Thank You!

ibm.com/db2/labchats

n ha T

u yo

a or f

d en t

g in

50

2009 IBM Corporation

Вам также может понравиться