Post on 10-May-2015
description
© 2013 EnterpriseDB Corporation. All rights reserved. 1
Kevin.Martyn@EnterpriseDB.com 2013-10-30
The Real Scoop on Migrating from Oracle Databases
© 2013 EnterpriseDB Corporation. All rights reserved. 2
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 3
Providing enterprises with the cost-performance benefits of Postgres by offering the products, resources, support and dependability required for high-level commercial applications.!• 140+ employees
• 2,500+ customers across all market segments
• Global presence with offices in North America, Europe, Asia
• Fast growing: 60%+ YOY sales growth in 2012, 80%+ YOY 2013
• Strong financial banking:
© 2013 EnterpriseDB. All rights reserved.
© 2013 EnterpriseDB Corporation. All rights reserved. 4
New Gartner ODBMS Magic Quadrant
Gartner Comments:
• Community leadership — EnterpriseDB is the primary contributor to the PostgreSQL community and is responsible for many new features of PostgreSQL, including JSON.
• Functionality — The functionality of EnterpriseDB's Postgres Plus has increased greatly, and with the Oracle Compatibility Feature is now more than sufficient to run both mission-critical and non-mission-critical applications.
• Stability and compatibility — References specifically call out compatibility with Oracle, the stability of the DBMS and product support as strengths.
© 2013 EnterpriseDB Corporation. All rights reserved. 5
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 6
Synchronized with and contributing to the PostgreSQL community
Postgres Plus: A Super-Set of Features
© 2013 EnterpriseDB Corporation. All rights reserved. 7
What Is Postgres Plus Advanced Server?
u Superset of community PostgreSQL
u 10th generation of Oracle compatibility, since 2005
u World-class security add-ons u Performance that rivals any other
proprietary RDBMS u Enterprise-class developer and
DBA tools u Installation, performance tuning,
and maintenance services u Software indemnification
© 2013 EnterpriseDB Corporation. All rights reserved. 8
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 9
Oracle Compatibility - Goals
• Run applications written for Oracle virtually unchanged
• No need to re-train Oracle DBAs and developers
• Support for SQL, PL/SQL, OCI and Pro*C
• Replication for easy sharing of data
• Dramatic Cost Savings
• No Vendor Lock-in
© 2013 EnterpriseDB Corporation. All rights reserved. 10
Compatibility means: • SQL extension support
− Decode, NVL, Substr, NVL2 − Date/time functions: add_months, extract, next_day
• PL/SQL support − REF Cursors, Implicit and explicit cursors − Looping, variable declarations, conditional statements − Collections: Associative Arrays, Varrays, Nested tables − Bulk binding − Named parameters − User Defined Exceptions − Explicit Transaction Control
− within a stored procedure − (not supported by PostgreSQL)
© 2013 EnterpriseDB Corporation. All rights reserved. 11
Compatibility means: (cont.) • Features
− Packages − Stored procedures − Functions − Triggers − Hints − Database Links − Hierarchical Queries − Materialized view (foundation) (*1) − Synonyms – Public and Private − Sequences − Rownum − Object types
− Create type … as object, … as table, …as varray − Constructor and collection methods
− Users/Roles − Dynamic SQL *1 – PPAS 9.3
© 2013 EnterpriseDB Corporation. All rights reserved. 12
Compatibility means: (cont.) • Data Types
Integer, number, char, double precision, float, varchar2, blob, clob, xmltype, rowid
• Built-in Packages DBMS_:
SQL, RLS, LOB, JOB, PIPE, ALERT, OUTPUT, UTILITY, PROFILER RANDOM, LOCK, CRYPTO, SCHEDULER, MVIEW (*1)
UTL_: FILE, MAIL, SMTP, ENCODE, TCP HTTP, URL (*1)
REGEXP_: INSTR, SUBSTR, COUNT (*1)
• Oracle-like Data Dictionary − ALL_, DBA_, USER_ views − Most commonly accessed views
*1 – PPAS 9.3
© 2013 EnterpriseDB Corporation. All rights reserved. 13
Compatibility means: (cont.) • Diagnostics - DRITA
− System and session waits − Not exposed in PostgreSQL − Part of Advanced Server
− Statspack like reporting
• Tools − EDB*Plus (SQL*Plus look-a-like) − EDB*Loader (SQL*Loader equivalent) − EDB*Wrap (similar to the PL/SQL wrapper)
*1 – PPAS 9.3
© 2013 EnterpriseDB Corporation. All rights reserved. 14
Partitioning in PPAS v9.3
76 times Faster!
0
10
20
30
40
50
60
70
80
250 500 1000
Impr
ovem
ent F
acto
r
Number of Table Partitions
• Oracle syntax for partitioning (create, add, exchange, split, …) • Postgres Plus Advanced Server is up to 76 times faster for data
retrieval than PostgreSQL 9.3 or PPAS 9.2 (Partition pruning, and inserts) • The greater the number partitions, the greater the performance benefits
PPAS 9.2 PostgreSQL 9.3
PPAS 9.3
Partitioning Performance: PPAS 9.3 v. PostgreSQL 9.3 v. PPAS 9.2
© 2013 EnterpriseDB Corporation. All rights reserved. 15
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 16
Migration Example
© 2013 EnterpriseDB Corporation. All rights reserved. 17
Database Migration Toolkit • Online Migration Toolkit enables point and click migration from
Oracle
• Automatically Migrates:
u Data u Schemas u Stored Procedures u Triggers u Functions
u Sequences u Packages u Views u Database Links u Synonyms
© 2013 EnterpriseDB Corporation. All rights reserved. 18
Oracle Compatibility & Migration Strategies Strategy Benefits
Develop/Deploy New LOB Applications
§ Significant cost savings for non mission critical systems
§ Leverages all existing Oracle skills § Very low risk
Deploy Postgres Plus as Oracle
Replication Server
§ Significant cost savings § Leverages Postgres Plus Replication Server § Leverages all existing Oracle skills § Improves transaction and query performance
Migrate non Mission Critical Oracle Apps to
Postgres Plus
§ Significant cost savings § Leverages all existing Oracle skills § Very low risk
Migrate Mission Critical Oracle Apps to Postgres Plus
§ Biggest cost savings § Leverages all existing Oracle skills § Greatest deployment flexibility
© 2013 EnterpriseDB Corporation. All rights reserved. 19
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 20
Multi-phase Migration Process u Phase I – Planning
• Determine what application to migrate"– Home grown applications!– Java, C!– Packaged applications that support multiple databases!– Support JDBC, ODBC"
• Once candidate applications are chosen, sign up for OMA"• Oracle Migration Assessment (OMA) Identifies:"
– Possible migration issues!– Gives time estimate to migrate system"
• Establish migration team:"– Need source system knowledgeable resource!– Need target system knowledgeable resource"
• Establish project plan with milestones
© 2013 EnterpriseDB Corporation. All rights reserved. 21
Multi-phase Migration Process
• Phase II – Prepare Environment − Obtain and install necessary software − Establish connectivity between systems
− Copy the Oracle JDBC jar file to jre/lib/ext directory in Postgres Plus Advanced Server Installation
• Phase III – Migrate Schema − Use Migration Toolkit in schema only mode − Resolve issues here before going to next phase
• Phase IV – Migrate Data − Use command line MTK
− Use –copyViaDBLinkOra − Uses OCI to connect to Oracle
− Use parallel threads − Use dblink_ora_copy function directly to bypass logging − Export Oracle data to flat files, load using EDB*Loader
© 2013 EnterpriseDB Corporation. All rights reserved. 22
Multi-phase Migration Process
22
• Phase V – Port Application − Change connection information − Recompile /Link application (OCI or Pro*C)
• Phase VI – Test − Verify application functionality − Address issues − Test performance − Tune
• Phase VII Integration − Establish co-existence strategy − Setup database links to other databases − Setup replication between Oracle or SQL Server and Postgres
Plus Advanced Server
• Phase VIII – Rollout − System becomes production
© 2013 EnterpriseDB Corporation. All rights reserved. 23
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 24
Work Products
Phase I Oracle Migration Assessment
• Detailed OMA Analysis Report
• List of known workarounds
• Technology risks
• Compatibility Score
• Proposed migration approach including skills requirements, training, architecture support, developer subscription, and development resources
© 2013 EnterpriseDB Corporation. All rights reserved. 25
Phase I Setup MTK Environment • Establish connectivity
− Copy Oracle JDBC jar file to Postgres Plus Advanced Server install
cp /usr/lib/oracle/xe/app/oracle/product/11.2.0/server/jdbc/lib/ojdbc14.jar /opt/PostgresPlus/9.2AS/jre/lib/ext
− Edit the toolkit.properties file to contain Oracle and Postgres Plus Advanced
Server connection information:
SRC_DB_URL=jdbc:oracle:thin:@localhost:1521:xe SRC_DB_USER=system SRC_DB_PASSWORD=manager TARGET_DB_URL=jdbc:edb://localhost:5999/demo TARGET_DB_USER=demo
TARGET_DB_PASSWORD=manager
© 2013 EnterpriseDB Corporation. All rights reserved. 26
Phase II Oracle Migration Toolkit • *** Checking for Migration Issues *** • Object Type Type Count • ------------------------------------------------------------------------------- • TRIGGER Count 0 • SOURCE Package 0 • SOURCE Syntax - Exception 0 • SOURCE Function 789 • SOURCE Syntax - Object 0 • SOURCE Syntax - Other 792 • SOURCE Syntax - Hints 282 • SOURCE Syntax - Exp Trans Ctl 730 • SOURCE Total Count 2623 • COLLECTION Count 1 • VARRAY Count 0 • DIMENSION Count 0 • JOB Count 0 • MATERIALIZED VIEW Count 0 • RESOURCE MGR Count 0 • POLICY Count 9 • PROFILE Count 6 • SUMMARY Possible Migration Issues 2775
© 2013 EnterpriseDB Corporation. All rights reserved. 27
Phase III Migrate Schema
Use MTK in schema only mode: [enterprisedb@localhost bin]$ ./runMTK.sh -schemaOnly hr Source database connectivity info... conn =jdbc:oracle:thin:@localhost:1521:xe user =system password=****** Target database connectivity info... conn =jdbc:edb://localhost:5999/demo user =demo password=****** Connecting with source Oracle database server... Connecting with target EnterpriseDB database server... Importing redwood schema hr... Creating Schema...hr Creating Object Type: NUMLIST Creating Sequence: EMPLOYEES_SEQ Creating Tables... Creating Table: EMPLOYEES
© 2013 EnterpriseDB Corporation. All rights reserved. 28
Phase III Migrate Schema con’t ******************** Migration Summary ******************** Object Types: 9 out of 9 Sequences: 3 out of 3 Tables: 49 out of 53 Constraints: 39 out of 40 Procedures: 7 out of 7 Functions: 3 out of 3 Packages: 3 out of 3 Total objects: 139 Successful count: 134 Failure count: 5 List of failed objects ====================== Tables -------------------- 1. HR.BFTEST 2. HR.TESTBD 3. HR.TESTBF 4. HR.TESTCNTXT
© 2013 EnterpriseDB Corporation. All rights reserved. 29
Phase III Migrate Schema con’t
• Migration logs stored in user’s home directory : /home/enterprisedb/.enterprisedb/migration-toolkit/logs
• Resolve issues: Error Creating Table TESTCNTXT:ERROR: function sys_context(unknown,
unknown) does not exist
Hint: No function matches the given name and argument types. You might need to add explicit type casts.
CAUSE: this table used SYS_CONTEXT(‘USERENV’,’CURRENT_USER’) as a DEFAULT value
RESOLUTION: use CURRENT_USER function instead
© 2013 EnterpriseDB Corporation. All rights reserved. 30
Phase III Migrate Schema con’t
• Migration logs stored in user’s home directory : • Resolve issues: XMLELEMENT : 35
There is a similar function in Postgres with the same name but the syntax is slightly different.
SELECT xmlelement(name foo, xmlattributes(current_date as bar), 'cont', 'ent'); xmlelement ------------------------------------- <foo bar="2007-01-26">content</foo>
© 2013 EnterpriseDB Corporation. All rights reserved. 31
Phase IV Migrate Data
• Use MTK in data only mode: • [enterprisedb@localhost bin]$ ./runMTK.sh -dataOnly hr • Source database connectivity info... • conn =jdbc:oracle:thin:@localhost:1521:xe • user =system • password=****** • Target database connectivity info... • conn =jdbc:edb://localhost:5999/demo • user =demo • password=****** • Connecting with source Oracle database server... • Connecting with target EnterpriseDB database server... • Importing redwood schema hr... • Loading Table Data in 8 MB batches... • Loading Table: AGES ... • [AGES] Migrated 1 rows. • [AGES] Table Data Load Summary: Total Time(s): 0.467 Total Rows: 1 • Loading Table: DEPARTMENTS ...
© 2013 EnterpriseDB Corporation. All rights reserved. 32
Phase V Port the Application § Change Application Connection method
§ Java application =
§ Old connection syntax:
Class.forName("oracle.jdbc.driver.OracleDriver");
Connection con = DriverManager.getConnection("jdbc:oracle:thin:@localhost:1521:xe”,”hrapp”,”manager”);
§ New connection syntax:
Class.forName("com.edb.Driver");
Connection con = DriverManager.getConnection("jdbc:edb://localhost:5444/edb",
“hrapp",“manager");
© 2013 EnterpriseDB Corporation. All rights reserved. 33
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 34
Handling Issues • Not all migrations are error free
− Migration log will contain all errors
• Some common issues: − Column delimiter chosen is in column data
− Causes ‘Extra data found’ error − Resolve by using different delimiter
• Oracle built-in package does not exist − DBMS_AQ – we use solutions like ActiveMQ, MQSeries or Tibco
− Or own code. Enqueue and dequeue procedures are fairly easy to code − xDB Replication Server can also be used since based on pub/sub architecture − DBMS_LOCK.sleep – use pg_sleep function instead
• Oracle feature not supported − MERGE command not supported
− Can be rewritten to use INSERT and UPDATE with checks − Index Organized Tables
− Cluster a table using CLUSTER command for same read performance gain
© 2013 EnterpriseDB Corporation. All rights reserved. 35
Handling Issues (continued) • Database Links
− Migrated over by tool but password is invalid − This is because Oracle hides the password − Resolve by dropping and recreating − Or by specifying a password to use when running the MTK
− runMTK -allDBLinks LINK_NAME1=abc,LINK_NAME2=xyz HR
• Data Movement – performance − Migration toolkit connects via jdbc − Large datasets are slow to move − Use database link functionality instead
− Dblink_ora_copy – EnterpriseDB method to copy data from Oracle over OCI − Much faster
− OR extract data from Oracle to csv files, load using edbldr
© 2013 EnterpriseDB Corporation. All rights reserved. 36
Tuning Recommendations
• Use DynaTune − Dynamically adjusts database configuration based on available resources − Set via edb_dynatune parameter
− Values 0 – 100 corresponding to % of machines to use
• Remember to analyze database − Use Analyze command
• Oracle Hints supported − No need to remove from embedded SQL
© 2013 EnterpriseDB Corporation. All rights reserved. 37
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 38
38
How EnterpriseDB Can Help
© 2013 EnterpriseDB Corporation. All rights reserved. 39
Oracle Migration Assessment • Paid for service from EnterpriseDB
• What is it? − Pre-analysis interview − Analysis of Oracle schemas to be migrated − Finds possible migration issues
− Unsupported Features − Unsupported Syntax − Implementation Differences
− Findings documented in final report − Post analysis discussions to review findings
• Migration feasibility score assigned (1 – 10)
http://www.enterprisedb.com/solutions/oracle-migration-assessment
© 2013 EnterpriseDB Corporation. All rights reserved. 40
Professional services for your migration Assist after the OMA
• Plan rollout
• Migration the Schema and Stored procedures (OMF next)
• Migrate the data (once, 2x,… minimal down time)
• Training
• Port and test application(s) (typically customer)
• DBA and application coaching/support
• Support contract
• Remote DBA
© 2013 EnterpriseDB Corporation. All rights reserved. 41
Oracle Migration Factory Core Services • Customer provides data-less Oracle export of database
• Migrate the database(s) to Postgres Plus Advanced Server − Resolve any issues − Implement workarounds for missing or different functionality − Perform sanity checking of unit functionality
− Requires input/output from customer on same units in Oracle
• Document the changes/workarounds
• Educate Customer on changes/workarounds − Advise on application level changes needed
• Return migrated databases to Customer − Via pg_dump
• Customer can customize with add on options
© 2013 EnterpriseDB Corporation. All rights reserved. 42
Oracle Migration Factory Add-ons • Setup and Migrate test system
− Installation of Postgres Plus Advanced Server on Customer server − Import of migrated database to Postgres Plus Advanced Server − Migration of test data from a test Oracle system
• Application Functional Testing − Provide assistance in connecting application to database − Provide assistance in functional testing of application − Resolve functional testing issues
• Performance Tuning of Migrated System
• Production Migration Setup − Install Postgres Plus Advanced Server on target production server − Import migrated database from testing server − Setup of xDB Replication Server
− Snapshot process will migrate production Oracle data − Deltas are captured by xDB triggers − Once snapshot is done, synchronization is performed
© 2013 EnterpriseDB Corporation. All rights reserved. 43
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 44
Summary • Migrations are no longer impossible
• Compatibility provides − Lower cost of migrations − Shorter migration timelines − Lower risk (you can always go back)
• EnterpriseDB provides − Oracle compatibility − Automated tools to migrate from Oracle − And others: MySQL, Sybase, SQL Server (data & schema)
• Migration Expertise for: − Planning − Performing migration − Testing − Rollout
http://www.enterprisedb.com/solutions/oracle-compatibility
© 2013 EnterpriseDB Corporation. All rights reserved. 45
EDB Serves ALL Your Postgres Needs
PostgreSQL Postgres Plus
Advanced Server Postgres Plus Cloud
© 2013 EnterpriseDB Corporation. All rights reserved. 46
Agenda • Company Overview • What is Postgres Plus Advanced Server? • What do we mean by ‘Oracle Compatibility’?
• What does this mean to you? • Migration Methodology • How to Migrate
• Handling migration issues • How EnterpriseDB can help • Summary
• Some common questions answered • Q&A
© 2013 EnterpriseDB Corporation. All rights reserved. 47
47
Some Common Questions Answered
© 2013 EnterpriseDB Corporation. All rights reserved. 48
How can I replace RAC for HA?
§ Active/Passive Clustering is proven technology § Provides fast detection and failover § No extra database cost
© 2013 EnterpriseDB Corporation. All rights reserved. 49
How can I replace DataGuard(Physical)?
Archiver
Disk Storage
Live Server
Instance
Postgres Plus Advanced Server
Disk Storage
Standby Server
(in recovery mode)
Postgres Plus Advanced Server
WAL WAL
pg_standby
© 2013 EnterpriseDB Corporation. All rights reserved. 50
How can I replace DataGuard(Logical)?
» Uses WAL for speed and reliability
» Highly cost effective, uses commodity servers
» Excellent HA solution when clustering is not an option
© 2013 EnterpriseDB Corporation. All rights reserved. 51