Database migration. from Sybase ASE to PostgreSQL. Achim Eisele and Jens Wilke. 1&1 Internet AG 8.11.2013



Similar documents
php tek 2006 in Orlando Florida Lukas Kahwe Smith

Postgres Plus xdb Replication Server with Multi-Master User s Guide

Real-time Data Replication

Agenda. ! Strengths of PostgreSQL. ! Strengths of Hadoop. ! Hadoop Community. ! Use Cases

Linas Virbalas Continuent, Inc.

A Case Study of ebay UTF-8 Database Migration

database abstraction layer database abstraction layers in PHP Lukas Smith BackendMedia

SQL Server to Oracle A Database Migration Roadmap

EMBL-EBI. Database Replication - Distribution

High Availability Solutions for the MariaDB and MySQL Database

Open Source DBMS CUBRID 2008 & Community Activities. Byung Joo Chung bjchung@cubrid.com

Instant SQL Programming

High Availability and Scalability for Online Applications with MySQL

Monitoring PostgreSQL database with Verax NMS

Architecture and Mode of Operation

Setting up SQL Translation Framework OBE for Database 12cR1

Database Replication with MySQL and PostgreSQL

Java DB Performance. Olav Sandstå Sun Microsystems, Trondheim, Norway Submission ID: 860

Sybase Adaptive Server Enterprise

Irecently worked on the implementation

6231B: Maintaining a Microsoft SQL Server 2008 R2 Database

A Shared-nothing cluster system: Postgres-XC

SQL Databases Course. by Applied Technology Research Center. This course provides training for MySQL, Oracle, SQL Server and PostgreSQL databases.

Informatica Data Replication FAQs

Package sjdbc. R topics documented: February 20, 2015

2. Boot using the Debian Net Install cd and when prompted to continue type "linux26", this will load the 2.6 kernel

MyOra 3.0. User Guide. SQL Tool for Oracle. Jayam Systems, LLC

SQL - QUICK GUIDE. Allows users to access data in relational database management systems.

The elephant called PostgreSQL

Why Zalando trusts in PostgreSQL

DBMS / Business Intelligence, SQL Server

Database Migration from MySQL to RDM Server

Porting from Oracle to PostgreSQL

Weaving Stored Procedures into Java at Zalando

Comparing Microsoft SQL Server 2005 Replication and DataXtend Remote Edition for Mobile and Distributed Applications

DataLogger Kepware, Inc.

Heterogeneous Replication Guide. SAP Replication Server SP200

Netezza PureData System Administration Course

SharePlex for SQL Server

Increasing Driver Performance

"SQL Database Professional " module PRINTED MANUAL

agileworkflow Manual 1. agileworkflow 2. The repository 1 of 29 Contents Definition

Understanding Disk Storage in Tivoli Storage Manager

Comparing SQL and NOSQL databases

SAP HANA Storage Requirements

ETL Overview. Extract, Transform, Load (ETL) Refreshment Workflow. The ETL Process. General ETL issues. MS Integration Services

Facebook: Cassandra. Smruti R. Sarangi. Department of Computer Science Indian Institute of Technology New Delhi, India. Overview Design Evaluation

Database Schema Deployment. Lukas Smith - lukas@liip.ch CodeWorks PHP on the ROAD

1.264 Lecture 15. SQL transactions, security, indexes

Cloud Computing at Google. Architecture

Services. Relational. Databases & JDBC. Today. Relational. Databases SQL JDBC. Next Time. Services. Relational. Databases & JDBC. Today.

High Availability with Postgres Plus Advanced Server. An EnterpriseDB White Paper

CSE 530A Database Management Systems. Introduction. Washington University Fall 2013

ODBC Client Driver Help Kepware, Inc.

Migration Guide Software, Database and Version Migration

Heterogeneous Replication Guide. Replication Server SP100

Zero Downtime Deployments with Database Migrations. Bob Feldbauer

Plug-In for Informatica Guide

In this session, we use the table ZZTELE with approx. 115,000 records for the examples. The primary key is defined on the columns NAME,VORNAME,STR

Querying Massive Data Sets in the Cloud with Google BigQuery and Java. Kon Soulianidis JavaOne 2014

Administering your PostgreSQL Geodatabase

Postgres Plus Advanced Server

Oracle to MySQL Migration

Administering a Microsoft SQL Server 2000 Database

How, What, and Where of Data Warehouses for MySQL

MyOra 3.5. User Guide. SQL Tool for Oracle. Kris Murthy

Configuring Apache Derby for Performance and Durability Olav Sandstå

PostgreSQL vs. MySQL vs. Commercial Databases: It's All About What You Need

INTEGRATING MICROSOFT DYNAMICS CRM WITH SIMEGO DS3

SQL Server for developers. murach's TRAINING & REFERENCE. Bryan Syverson. Mike Murach & Associates, Inc. Joel Murach

Lecture 5: GFS & HDFS! Claudia Hauff (Web Information Systems)! ti2736b-ewi@tudelft.nl

SAP HANA implementation on SLT with a Non SAP source. Poornima Ramachandra

Kony MobileFabric. Sync Windows Installation Manual - WebSphere. On-Premises. Release 6.5. Document Relevance and Accuracy

How To Create A Table In Sql (Ahem)

Chapter 9 Java and SQL. Wang Yang wyang@njnet.edu.cn

Rebasoft Auditor Quick Start Guide

$99.95 per user. SQL Server 2005 Database Administration CourseId: 152 Skill level: Run Time: 30+ hours (158 videos)

Below are the some of the new features of SQL Server that has been discussed in this course

Expert Oracle. Database Architecture. Techniques and Solutions. 10gr, and 11g Programming. Oracle Database 9/, Second Edition.

Firebird. A really free database used in free and commercial projects

TimesTen Auditing Using ttaudit.java

Database Programming with PL/SQL: Learning Objectives

SQL Server Database Coding Standards and Guidelines

SOLUTION BRIEF. JUST THE FAQs: Moving Big Data with Bulk Load.

10775A Administering Microsoft SQL Server 2012 Databases

IBM Campaign and IBM Silverpop Engage Version 1 Release 2 August 31, Integration Guide IBM

Workflow Templates Library

PeopleSoft DDL & DDL Management

CON5604 Upgrade from Siebel CRM 7.7 to 8.1 in Germany s Largest Loyalty Program Moscone West /01/14, 11:30-12:15

CSI 2132 Lab 3. Outline 09/02/2012. More on SQL. Destroying and Altering Relations. Exercise: DROP TABLE ALTER TABLE SELECT

Getting started with PostgreSQL

L7_L10. MongoDB. Big Data and Analytics by Seema Acharya and Subhashini Chellappan Copyright 2015, WILEY INDIA PVT. LTD.

Bidirectional replication for InterBase and Firebird

Administering a Microsoft SQL Server 2000 Database

Deploying BDR. Simon Riggs CTO, 2ndQuadrant & Major Developer, PostgreSQL. February 2015

1 Copyright 2011, Oracle and/or its affiliates. All rights reserved. Insert Information Protection Policy Classification from Slide 8

ABAP SQL Monitor Implementation Guide and Best Practices

The Future of PostgreSQL High Availability Robert Hodges - Continuent, Inc. Simon Riggs - 2ndQuadrant

Transcription:

Database migration from Sybase ASE to PostgreSQL Achim Eisele and Jens Wilke 1&1 Internet AG 8.11.2013

Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects

Introduction Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects

Introduction Goals Why we had been dissatisfied many DBs on one System the availability was depending on third party Systems many downtimes performance dependencies Our goals autonomy performance improvements high availability satisfied customers :-) 1&1 Internet AG 2013 Database migration 1/26

Introduction Why PostgreSQL Most advanced Open Source RDBMS Best TCO 1&1 Internet AG 2013 Database migration 2/26

Analysis Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects

Analysis 3 Applications 250 GB size 20 Mio. Queries per day up to 1.500 transactions per second 1&1 Internet AG 2013 Database migration 3/26

Analysis Architecture Sybase all reading and writing operations on one system many databases, user and tools on a single system PostgreSQL Heartbeat / DRBD WAL / Streaming Replication (not synchronous!) SR-Standby for dedicated Statements 1&1 Internet AG 2013 Database migration 4/26

Differences between Sybase ASE and PostgreSQL Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects

Differences between Sybase ASE and PostgreSQL Limitations of Postgres Sybase offers bi-directional replication using the replication agent on Sybase it is possible to switch the replication direction Sybase offers replication of single tables with few impact, using the transaction log Sybase offers a replication solution for Road Warriors RAW Devices, advantage on modern file systems is doubtable I/O can be audited by process Plans of running queries can be shown 1&1 Internet AG 2013 Database migration 5/26

Differences between Sybase ASE and PostgreSQL Advantages of Postgres 1/3 Postgres MVCC vs Sybase s locking Postgres is conforming to SQL-standard nested transactions vs savepoints Postgres does know schemes Postgres does support grant for colums, not just revoke on Postgres it is possible to restrict the connection limit per user Logins can be restricted to IP adresses in Postgres 1&1 Internet AG 2013 Database migration 6/26

Differences between Sybase ASE and PostgreSQL Advantages of Postgres 2/3 On Sybase ASE strings longer than varchar/char or a page are cropped or fail different behaviour on insert and update default ASE pagesize is 2k Sybase creates a fixed size container for the DB and the transaction log. shrinking the DB container is only possible with version 15.7 1&1 Internet AG 2013 Database migration 7/26

Differences between Sybase ASE and PostgreSQL Advantages of Postgres 3/3 Postgres sequences are not limited to a single column as Sybase s identity columns are and the value can be overwritten bcp (COPY) is neither capable to escape nor to quote Postgres does support multiple trigger for one event Sybase is planning to implement advisory locks for future versions index concurrently since ASE 15.7 SP 100, May 2013 1&1 Internet AG 2013 Database migration 8/26

Porting the application Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects

Porting the application Database driver Java (Hibernate) loading JDBC driver setting Dialect and DriverClass PHP On Debian: apt-get install php5-pgsql PDO only need another data source name Plain PHP sybase_connect(), sybase_select_db() => pg_connect() sybase_query() => pg_query() sybase_fetch_object() => pg_fetch_object() 1&1 Internet AG 2013 Database migration 9/26

Porting the application Sybase vs PostgresSQL Dialect 1/3 Date/time Sybase SELECT getdate(); -- Oct 30 2013 03.52PM SELECT convert(varchar(30), getdate(), 109); -- Oct 30 2013 03:52:34:126PM PostgreSQL SELECT current_timestamp; -- 2013-10-30 15:52:34.126305+01 SELECT to_char(current_timestamp, Mon DD YYYY HH12:MI:SS:MSAM ); 1&1 Internet AG 2013 Database migration 10/26

Porting the application Sybase vs PostgresSQL Dialect 2/3 concatenation Sybase SELECT zip + + city FROM address PostgreSQL SELECT zip city FROM address field length Sybase set textsize 512000 -- limits the size of a text or image column that is -- returned through a select statement. The default is 32KB. PostgreSQL n/a 1&1 Internet AG 2013 Database migration 11/26

Porting the application Sybase vs PostgresSQL Dialect 3/3 LIMIT = TOP, OFFSET is not available in Sybase ASE NULL Handling Text-types in Sybase ASE NULL => empty string empty string => blank -- The empty string, "" or, is stored as a single space -- rather than as NULL. Thus, "abc" + "" + "def" -- is equivalent to "abc def", not to "abcdef". Sybase s BIT 0 and 1 only (NULL is not allowed) vs Postgres BOOLEAN, TRUE/FALSE and NULL 1&1 Internet AG 2013 Database migration 12/26

Migration strategies Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects

Migration strategies Procedures Migration strategies: Dump Reload Replication 1&1 Internet AG 2013 Database migration 13/26

Migration strategies Dump - Reload 1/5 adjust and import the DDL stop the application/write access export Data, search and replace dates and times, import create indexes, foreign keys and set sequences import and index/key creation by multiple processes in parallel logical checks re-configure and start the application 1&1 Internet AG 2013 Database migration 14/26

Migration strategies Dump - Reload 2/5 Advantages simple less effort rollback is also simple Disadvantages longer downtime limits regardiung quoting, escaping and content (date/time) empty strings are converted to NULL 1&1 Internet AG 2013 Database migration 15/26

Migration strategies Dump - Reload 3/5 Export with bcp bcp $db..$tablename out $fifo_path/$tablename.pipe -Jutf8 -c -t ; Sybase bcp is not capable to write in unnamed pipes, just in files Date and time formats of Sybase are not conforming to any standard: milliseconds are separated by colons and a white space is missing before AM/PM 1&1 Internet AG 2013 Database migration 16/26

Migration strategies Dump - Reload 4/5 Import in Postgres using COPY and fix the timestamps: mkfifo $fifo_path/$tablename.pipe cat $fifo_path/$tablename.pipe sed s/\(;\ ^\ [A-Z]\)\([^;\]*\):\([0-9]\+\)\(AM\ PM\) \(;\ $\)/\1\2.\3 \4\5/g psql -d $IMPORTDB -c "COPY $tablename from stdin CSV DELIMITER ; " alter sequence $seq restart with max(id)+1 create indexes and foreign keys 1&1 Internet AG 2013 Database migration 17/26

Migration strategies Dump - Reload 5/5 the image type is converted to binary image is imported into a text field and decoded after that CREATE TABLE $tablename2 as (select id, decode(image, hex ) as image,... from $tablename); DROP TABLE $tablename; ALTER TABLE $tablename2 RENAME to $tablename; 1&1 Internet AG 2013 Database migration 18/26

Migration strategies Sybase PostgreSQL - Replication Closed source replication tool based on transaction logs setup replication, wait until it s synchronised and restart the re-configured application. Advantages flexible point of time for the switch minimal downtime less organisational overhead :) no impact on the production DB Disadvantages expensive closed source without warranty 1&1 Internet AG 2013 Database migration 19/26

Migration strategies Pseudo-replication Top requirement: minimal downtime! should we write our own trigger based replication tool? too much resource consuming on the server analysis of the table usage static tables autoincrement tables non-static tables tool based migration Optimizations (indexes, field lengths) 1&1 Internet AG 2013 Database migration 20/26

Migration strategies Pseudo-replication - DDL 1/2 Automated Export of DDL sp_tables sp_columns sp_pkeys sp_fkeys sp_statistics sp_helpuser sp_helprotect 1&1 Internet AG 2013 Database migration 21/26

Migration strategies Pseudo-replication - DDL 2/2 // iterate over all tables for $table in sp_tables "CREATE TABLE $table->name (" // now iterate over all columns of table for $column in sp_columns $table->name "$column->name $column->type DEFAULT $column->default" // add primary key "ALTER TABLE $table->name ADD PRIMARY KEY "+sp_pkeys // grant statements for $right in sp_helprotect "GRANT $right->action ON $table->name TO $right->user" 1&1 Internet AG 2013 Database migration 22/26

Migration strategies Pseudo-replication - Data 1/2 Data import to reduce the system load, batch jobs were suspended import by 10 processes in parallel (horizontal partition) chunks of 5.000 rows per select Setup Up-Sync (auto increment) 80 tables migrated by triggers (non static tables) using a transitional migration table (table name, primary key, action) 1&1 Internet AG 2013 Database migration 23/26

Migration strategies Pseudo-replication - Data 2/2 Finalisation create indexes during downtime create sequences create foreign keys content checks re-configure the applications DB connection parameter tests result: 10 minutes downtime 1&1 Internet AG 2013 Database migration 24/26

Retrospects Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects

Retrospects 12 months with PostgreSQL achivement of objectives autonomy: dedicated hardware stability: not one single outage in 12 months performance: dedicated hardware, read-only standby 1&1 Internet AG 2013 Database migration 25/26

Retrospects Questions??? 1&1 Internet AG 2013 Database migration 26/26