SlideShare uma empresa Scribd logo
1 de 33
Baixar para ler offline
Database migration
from Sybase ASE to PostgreSQL

Achim Eisele and Jens Wilke
1&1 Internet AG
30.10.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/25
Introduction

Why PostgreSQL

Most advanced Open Source RDBMS
Best TCO

1&1 Internet AG 2013

Database migration

2/25
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/25
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/25
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/25
Differences between Sybase ASE and PostgreSQL

Advantages of Postgres 1/3

Postgres’ MVCC vs Sybase’s locking
Postgres is conforming to SQL-standard
Postgres does know schemes
and complex datatypes too
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/25
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/25
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/25
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/25
Porting the application

Sybase vs PostgresSQL Dialect 1/2

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/25
Porting the application

Sybase vs PostgresSQL Dialect 2/2

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/25
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

12/25
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 indices, 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

13/25
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

14/25
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

15/25
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)
(;|$)/12.3 45/g
| psql -d $IMPORTDB -c
"COPY $tablename from stdin CSV DELIMITER ’;’"
alter sequence $seq restart with max(id)+1

create indices and foreign keys

1&1 Internet AG 2013

Database migration

16/25
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

17/25
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

18/25
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 (indices, field lengths)

1&1 Internet AG 2013

Database migration

19/25
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

20/25
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

21/25
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

22/25
Migration strategies

Pseudo-replication - Data 2/2

Finalisation
create indices
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

23/25
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

24/25
Retrospects

Questions

???

1&1 Internet AG 2013

Database migration

25/25

Mais conteúdo relacionado

Mais procurados

Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsCarlos Sierra
 
Best practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialColin Charles
 
Indexing in Exadata
Indexing in ExadataIndexing in Exadata
Indexing in ExadataEnkitec
 
Productizing Structured Streaming Jobs
Productizing Structured Streaming JobsProductizing Structured Streaming Jobs
Productizing Structured Streaming JobsDatabricks
 
From distributed caches to in-memory data grids
From distributed caches to in-memory data gridsFrom distributed caches to in-memory data grids
From distributed caches to in-memory data gridsMax Alexejev
 
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자PgDay.Seoul
 
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
 Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo... Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...Enkitec
 
Simplify CDC Pipeline with Spark Streaming SQL and Delta Lake
Simplify CDC Pipeline with Spark Streaming SQL and Delta LakeSimplify CDC Pipeline with Spark Streaming SQL and Delta Lake
Simplify CDC Pipeline with Spark Streaming SQL and Delta LakeDatabricks
 
Data Quality With or Without Apache Spark and Its Ecosystem
Data Quality With or Without Apache Spark and Its EcosystemData Quality With or Without Apache Spark and Its Ecosystem
Data Quality With or Without Apache Spark and Its EcosystemDatabricks
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performancePostgreSQL-Consulting
 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesJonathan Katz
 
What is new in PostgreSQL 14?
What is new in PostgreSQL 14?What is new in PostgreSQL 14?
What is new in PostgreSQL 14?Mydbops
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19cMaria Colgan
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introductionPooyan Mehrparvar
 
Cloud-native Semantic Layer on Data Lake
Cloud-native Semantic Layer on Data LakeCloud-native Semantic Layer on Data Lake
Cloud-native Semantic Layer on Data LakeDatabricks
 
PostGreSQL Performance Tuning
PostGreSQL Performance TuningPostGreSQL Performance Tuning
PostGreSQL Performance TuningMaven Logix
 
Getting Started with Databricks SQL Analytics
Getting Started with Databricks SQL AnalyticsGetting Started with Databricks SQL Analytics
Getting Started with Databricks SQL AnalyticsDatabricks
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL AdministrationEDB
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresEDB
 
SQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoverySQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoveryMichael Poremba
 

Mais procurados (20)

Oracle Performance Tuning Fundamentals
Oracle Performance Tuning FundamentalsOracle Performance Tuning Fundamentals
Oracle Performance Tuning Fundamentals
 
Best practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability TutorialBest practices for MySQL High Availability Tutorial
Best practices for MySQL High Availability Tutorial
 
Indexing in Exadata
Indexing in ExadataIndexing in Exadata
Indexing in Exadata
 
Productizing Structured Streaming Jobs
Productizing Structured Streaming JobsProductizing Structured Streaming Jobs
Productizing Structured Streaming Jobs
 
From distributed caches to in-memory data grids
From distributed caches to in-memory data gridsFrom distributed caches to in-memory data grids
From distributed caches to in-memory data grids
 
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자
[Pgday.Seoul 2017] 7. PostgreSQL DB Tuning 기업사례 - 송춘자
 
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
 Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo... Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
Tuning SQL for Oracle Exadata: The Good, The Bad, and The Ugly Tuning SQL fo...
 
Simplify CDC Pipeline with Spark Streaming SQL and Delta Lake
Simplify CDC Pipeline with Spark Streaming SQL and Delta LakeSimplify CDC Pipeline with Spark Streaming SQL and Delta Lake
Simplify CDC Pipeline with Spark Streaming SQL and Delta Lake
 
Data Quality With or Without Apache Spark and Its Ecosystem
Data Quality With or Without Apache Spark and Its EcosystemData Quality With or Without Apache Spark and Its Ecosystem
Data Quality With or Without Apache Spark and Its Ecosystem
 
Linux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performanceLinux tuning to improve PostgreSQL performance
Linux tuning to improve PostgreSQL performance
 
Operating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with KubernetesOperating PostgreSQL at Scale with Kubernetes
Operating PostgreSQL at Scale with Kubernetes
 
What is new in PostgreSQL 14?
What is new in PostgreSQL 14?What is new in PostgreSQL 14?
What is new in PostgreSQL 14?
 
What to Expect From Oracle database 19c
What to Expect From Oracle database 19cWhat to Expect From Oracle database 19c
What to Expect From Oracle database 19c
 
NoSQL databases - An introduction
NoSQL databases - An introductionNoSQL databases - An introduction
NoSQL databases - An introduction
 
Cloud-native Semantic Layer on Data Lake
Cloud-native Semantic Layer on Data LakeCloud-native Semantic Layer on Data Lake
Cloud-native Semantic Layer on Data Lake
 
PostGreSQL Performance Tuning
PostGreSQL Performance TuningPostGreSQL Performance Tuning
PostGreSQL Performance Tuning
 
Getting Started with Databricks SQL Analytics
Getting Started with Databricks SQL AnalyticsGetting Started with Databricks SQL Analytics
Getting Started with Databricks SQL Analytics
 
Mastering PostgreSQL Administration
Mastering PostgreSQL AdministrationMastering PostgreSQL Administration
Mastering PostgreSQL Administration
 
Practical Partitioning in Production with Postgres
Practical Partitioning in Production with PostgresPractical Partitioning in Production with Postgres
Practical Partitioning in Production with Postgres
 
SQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster RecoverySQL Server High Availability and Disaster Recovery
SQL Server High Availability and Disaster Recovery
 

Destaque

Sybase ase solaris-containers
Sybase ase solaris-containersSybase ase solaris-containers
Sybase ase solaris-containersodd23
 
Sybase ASE 15.7- Two Case Studies of Successful Migration
Sybase ASE 15.7- Two Case Studies of Successful Migration Sybase ASE 15.7- Two Case Studies of Successful Migration
Sybase ASE 15.7- Two Case Studies of Successful Migration SAP Technology
 
ASE Tempdb Performance and Tuning
ASE Tempdb Performance and Tuning ASE Tempdb Performance and Tuning
ASE Tempdb Performance and Tuning SAP Technology
 
ASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg FileASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg FileSAP Technology
 
Tips and Tricks for SAP Sybase ASE
Tips and Tricks for SAP Sybase ASETips and Tricks for SAP Sybase ASE
Tips and Tricks for SAP Sybase ASEDon Brizendine
 
Advanced ASE Performance Tuning Tips
Advanced ASE Performance Tuning Tips Advanced ASE Performance Tuning Tips
Advanced ASE Performance Tuning Tips SAP Technology
 
Imprimir -first_alternative_-_solaris_10_zone_configuration_and
Imprimir  -first_alternative_-_solaris_10_zone_configuration_andImprimir  -first_alternative_-_solaris_10_zone_configuration_and
Imprimir -first_alternative_-_solaris_10_zone_configuration_andodd23
 

Destaque (7)

Sybase ase solaris-containers
Sybase ase solaris-containersSybase ase solaris-containers
Sybase ase solaris-containers
 
Sybase ASE 15.7- Two Case Studies of Successful Migration
Sybase ASE 15.7- Two Case Studies of Successful Migration Sybase ASE 15.7- Two Case Studies of Successful Migration
Sybase ASE 15.7- Two Case Studies of Successful Migration
 
ASE Tempdb Performance and Tuning
ASE Tempdb Performance and Tuning ASE Tempdb Performance and Tuning
ASE Tempdb Performance and Tuning
 
ASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg FileASE Performance and Tuning Parameters Beyond the cfg File
ASE Performance and Tuning Parameters Beyond the cfg File
 
Tips and Tricks for SAP Sybase ASE
Tips and Tricks for SAP Sybase ASETips and Tricks for SAP Sybase ASE
Tips and Tricks for SAP Sybase ASE
 
Advanced ASE Performance Tuning Tips
Advanced ASE Performance Tuning Tips Advanced ASE Performance Tuning Tips
Advanced ASE Performance Tuning Tips
 
Imprimir -first_alternative_-_solaris_10_zone_configuration_and
Imprimir  -first_alternative_-_solaris_10_zone_configuration_andImprimir  -first_alternative_-_solaris_10_zone_configuration_and
Imprimir -first_alternative_-_solaris_10_zone_configuration_and
 

Semelhante a Database migration from Sybase ASE to PostgreSQL @2013.pgconf.eu

IMS to DB2 Migration: How a Fortune 500 Company Made the Move in Record Time ...
IMS to DB2 Migration: How a Fortune 500 Company Made the Move in Record Time ...IMS to DB2 Migration: How a Fortune 500 Company Made the Move in Record Time ...
IMS to DB2 Migration: How a Fortune 500 Company Made the Move in Record Time ...Precisely
 
Enterprise-class security with PostgreSQL - 2
Enterprise-class security with PostgreSQL - 2Enterprise-class security with PostgreSQL - 2
Enterprise-class security with PostgreSQL - 2Ashnikbiz
 
The two faces of sql parameter sniffing
The two faces of sql parameter sniffingThe two faces of sql parameter sniffing
The two faces of sql parameter sniffingIvo Andreev
 
Enterprise grade deployment and security with PostgreSQL
Enterprise grade deployment and security with PostgreSQLEnterprise grade deployment and security with PostgreSQL
Enterprise grade deployment and security with PostgreSQLHimanchali -
 
The Central View of your Data with Postgres
The Central View of your Data with PostgresThe Central View of your Data with Postgres
The Central View of your Data with PostgresEDB
 
Introduction to GCP Data Flow Presentation
Introduction to GCP Data Flow PresentationIntroduction to GCP Data Flow Presentation
Introduction to GCP Data Flow PresentationKnoldus Inc.
 
Introduction to GCP DataFlow Presentation
Introduction to GCP DataFlow PresentationIntroduction to GCP DataFlow Presentation
Introduction to GCP DataFlow PresentationKnoldus Inc.
 
EDB Database Servers and Tools
EDB Database Servers and Tools EDB Database Servers and Tools
EDB Database Servers and Tools Ashnikbiz
 
Db2 analytics accelerator technical update
Db2 analytics accelerator  technical updateDb2 analytics accelerator  technical update
Db2 analytics accelerator technical updateCuneyt Goksu
 
Migrate Access to SQL Server/Azure
Migrate Access to SQL Server/AzureMigrate Access to SQL Server/Azure
Migrate Access to SQL Server/AzureADNUG
 
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...Andrejs Prokopjevs
 
An End User Perspective on Implementing Oracle in the Engineering Environment
An End User Perspective on Implementing Oracle in the Engineering EnvironmentAn End User Perspective on Implementing Oracle in the Engineering Environment
An End User Perspective on Implementing Oracle in the Engineering Environmentjeffhobbs
 
The Real Scoop on Migrating from Oracle Databases
The Real Scoop on Migrating from Oracle DatabasesThe Real Scoop on Migrating from Oracle Databases
The Real Scoop on Migrating from Oracle DatabasesEDB
 
DataCluster
DataClusterDataCluster
DataClustergystell
 
Multi-Tenancy: Da Teoria à Prática, do DB ao Middleware
Multi-Tenancy: Da Teoria à Prática, do DB ao MiddlewareMulti-Tenancy: Da Teoria à Prática, do DB ao Middleware
Multi-Tenancy: Da Teoria à Prática, do DB ao MiddlewareBruno Borges
 
Attunity Efficient ODR For Sql Server Using Attunity CDC Suite For SSIS Slide...
Attunity Efficient ODR For Sql Server Using Attunity CDC Suite For SSIS Slide...Attunity Efficient ODR For Sql Server Using Attunity CDC Suite For SSIS Slide...
Attunity Efficient ODR For Sql Server Using Attunity CDC Suite For SSIS Slide...Melissa Kolodziej
 

Semelhante a Database migration from Sybase ASE to PostgreSQL @2013.pgconf.eu (20)

Greenplum Architecture
Greenplum ArchitectureGreenplum Architecture
Greenplum Architecture
 
IMS to DB2 Migration: How a Fortune 500 Company Made the Move in Record Time ...
IMS to DB2 Migration: How a Fortune 500 Company Made the Move in Record Time ...IMS to DB2 Migration: How a Fortune 500 Company Made the Move in Record Time ...
IMS to DB2 Migration: How a Fortune 500 Company Made the Move in Record Time ...
 
Enterprise-class security with PostgreSQL - 2
Enterprise-class security with PostgreSQL - 2Enterprise-class security with PostgreSQL - 2
Enterprise-class security with PostgreSQL - 2
 
The two faces of sql parameter sniffing
The two faces of sql parameter sniffingThe two faces of sql parameter sniffing
The two faces of sql parameter sniffing
 
Enterprise grade deployment and security with PostgreSQL
Enterprise grade deployment and security with PostgreSQLEnterprise grade deployment and security with PostgreSQL
Enterprise grade deployment and security with PostgreSQL
 
The Central View of your Data with Postgres
The Central View of your Data with PostgresThe Central View of your Data with Postgres
The Central View of your Data with Postgres
 
Introduction to GCP Data Flow Presentation
Introduction to GCP Data Flow PresentationIntroduction to GCP Data Flow Presentation
Introduction to GCP Data Flow Presentation
 
Introduction to GCP DataFlow Presentation
Introduction to GCP DataFlow PresentationIntroduction to GCP DataFlow Presentation
Introduction to GCP DataFlow Presentation
 
EDB Database Servers and Tools
EDB Database Servers and Tools EDB Database Servers and Tools
EDB Database Servers and Tools
 
Db2 analytics accelerator technical update
Db2 analytics accelerator  technical updateDb2 analytics accelerator  technical update
Db2 analytics accelerator technical update
 
Migrate Access to SQL Server/Azure
Migrate Access to SQL Server/AzureMigrate Access to SQL Server/Azure
Migrate Access to SQL Server/Azure
 
Webinar on radar
Webinar on radarWebinar on radar
Webinar on radar
 
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
Optimize DR and Cloning with Logical Hostnames in Oracle E-Business Suite (OA...
 
Sql good practices
Sql good practicesSql good practices
Sql good practices
 
An End User Perspective on Implementing Oracle in the Engineering Environment
An End User Perspective on Implementing Oracle in the Engineering EnvironmentAn End User Perspective on Implementing Oracle in the Engineering Environment
An End User Perspective on Implementing Oracle in the Engineering Environment
 
The Real Scoop on Migrating from Oracle Databases
The Real Scoop on Migrating from Oracle DatabasesThe Real Scoop on Migrating from Oracle Databases
The Real Scoop on Migrating from Oracle Databases
 
DataCluster
DataClusterDataCluster
DataCluster
 
Multi-Tenancy: Da Teoria à Prática, do DB ao Middleware
Multi-Tenancy: Da Teoria à Prática, do DB ao MiddlewareMulti-Tenancy: Da Teoria à Prática, do DB ao Middleware
Multi-Tenancy: Da Teoria à Prática, do DB ao Middleware
 
Attunity Efficient ODR For Sql Server Using Attunity CDC Suite For SSIS Slide...
Attunity Efficient ODR For Sql Server Using Attunity CDC Suite For SSIS Slide...Attunity Efficient ODR For Sql Server Using Attunity CDC Suite For SSIS Slide...
Attunity Efficient ODR For Sql Server Using Attunity CDC Suite For SSIS Slide...
 
Boston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptxBoston_sql_kegorman_highIO.pptx
Boston_sql_kegorman_highIO.pptx
 

Último

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersRaghuram Pandurangan
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .Alan Dix
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024BookNet Canada
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Manik S Magar
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxLoriGlavin3
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfAlex Barbosa Coqueiro
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek SchlawackFwdays
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024Stephanie Beckett
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenHervé Boutemy
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsNathaniel Shimoni
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteDianaGray10
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity PlanDatabarracks
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxLoriGlavin3
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxLoriGlavin3
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfAddepto
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demoHarshalMandlekar2
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024Lorenzo Miniero
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Commit University
 

Último (20)

Generative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information DevelopersGenerative AI for Technical Writer or Information Developers
Generative AI for Technical Writer or Information Developers
 
From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .From Family Reminiscence to Scholarly Archive .
From Family Reminiscence to Scholarly Archive .
 
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
New from BookNet Canada for 2024: BNC CataList - Tech Forum 2024
 
Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!Anypoint Exchange: It’s Not Just a Repo!
Anypoint Exchange: It’s Not Just a Repo!
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptxPasskey Providers and Enabling Portability: FIDO Paris Seminar.pptx
Passkey Providers and Enabling Portability: FIDO Paris Seminar.pptx
 
Unraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdfUnraveling Multimodality with Large Language Models.pdf
Unraveling Multimodality with Large Language Models.pdf
 
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
"Subclassing and Composition – A Pythonic Tour of Trade-Offs", Hynek Schlawack
 
What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024What's New in Teams Calling, Meetings and Devices March 2024
What's New in Teams Calling, Meetings and Devices March 2024
 
DevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache MavenDevoxxFR 2024 Reproducible Builds with Apache Maven
DevoxxFR 2024 Reproducible Builds with Apache Maven
 
Time Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directionsTime Series Foundation Models - current state and future directions
Time Series Foundation Models - current state and future directions
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
Take control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test SuiteTake control of your SAP testing with UiPath Test Suite
Take control of your SAP testing with UiPath Test Suite
 
How to write a Business Continuity Plan
How to write a Business Continuity PlanHow to write a Business Continuity Plan
How to write a Business Continuity Plan
 
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptxThe Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
The Fit for Passkeys for Employee and Consumer Sign-ins: FIDO Paris Seminar.pptx
 
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptxDigital Identity is Under Attack: FIDO Paris Seminar.pptx
Digital Identity is Under Attack: FIDO Paris Seminar.pptx
 
Gen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdfGen AI in Business - Global Trends Report 2024.pdf
Gen AI in Business - Global Trends Report 2024.pdf
 
Sample pptx for embedding into website for demo
Sample pptx for embedding into website for demoSample pptx for embedding into website for demo
Sample pptx for embedding into website for demo
 
SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024SIP trunking in Janus @ Kamailio World 2024
SIP trunking in Janus @ Kamailio World 2024
 
Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!Nell’iperspazio con Rocket: il Framework Web di Rust!
Nell’iperspazio con Rocket: il Framework Web di Rust!
 

Database migration from Sybase ASE to PostgreSQL @2013.pgconf.eu

  • 1. Database migration from Sybase ASE to PostgreSQL Achim Eisele and Jens Wilke 1&1 Internet AG 30.10.2013
  • 2. Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects
  • 3. Introduction Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects
  • 4. 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/25
  • 5. Introduction Why PostgreSQL Most advanced Open Source RDBMS Best TCO 1&1 Internet AG 2013 Database migration 2/25
  • 6. Analysis Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects
  • 7. 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/25
  • 8. 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/25
  • 9. Differences between Sybase ASE and PostgreSQL Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects
  • 10. 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/25
  • 11. Differences between Sybase ASE and PostgreSQL Advantages of Postgres 1/3 Postgres’ MVCC vs Sybase’s locking Postgres is conforming to SQL-standard Postgres does know schemes and complex datatypes too 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/25
  • 12. 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/25
  • 13. 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/25
  • 14. Porting the application Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects
  • 15. 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/25
  • 16. Porting the application Sybase vs PostgresSQL Dialect 1/2 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/25
  • 17. Porting the application Sybase vs PostgresSQL Dialect 2/2 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/25
  • 18. Migration strategies Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects
  • 19. Migration strategies Procedures Migration strategies: Dump Reload Replication 1&1 Internet AG 2013 Database migration 12/25
  • 20. 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 indices, 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 13/25
  • 21. 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 14/25
  • 22. 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 15/25
  • 23. 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) (;|$)/12.3 45/g | psql -d $IMPORTDB -c "COPY $tablename from stdin CSV DELIMITER ’;’" alter sequence $seq restart with max(id)+1 create indices and foreign keys 1&1 Internet AG 2013 Database migration 16/25
  • 24. 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 17/25
  • 25. 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 18/25
  • 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 (indices, field lengths) 1&1 Internet AG 2013 Database migration 19/25
  • 27. 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 20/25
  • 28. 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 21/25
  • 29. 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 22/25
  • 30. Migration strategies Pseudo-replication - Data 2/2 Finalisation create indices 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 23/25
  • 31. Retrospects Agenda Introduction Analysis Differences between Sybase ASE and PostgreSQL Porting the application Migration strategies Retrospects
  • 32. 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 24/25
  • 33. Retrospects Questions ??? 1&1 Internet AG 2013 Database migration 25/25