SlideShare a Scribd company logo
Workshop
Oracle to Postgres Migration
Part 2 - Running Postgres
2016-06-22 @IDM
Chris Mair
http://www.pgtraining.com
2016-06-22OracletoPostgresMigration-part2
The Workshop
very quick walk through for Postgres-DBAs to-be
• installation, getting support, the configuration
files, psql, understanding transactions, the
query-planner and locking, backups, system
tables, streaming replication, hot standbys,
connection pooling, load balancing and even
automatic failover all with life-demos and
condensed into just three hours - will we finish
on time?
2016-06-22OracletoPostgresMigration-part2
Getting Support
• very good community support through mailing
lists: psql.it list / Italian and official list (English)
and many others
• commercial support - in Italy for example from us
at PGtraining (three free lancers) or 2ndQuadrant
(SRL), in Austria from Cypertec (GmbH) et al
• don't forget managed hosting offerings from
Amazon Web Services (PostgreSQL RDS),
Heroku and others
2016-06-22OracletoPostgresMigration-part2
Installing Postgres
• from your distro (note that the second digit is the
major version 9.0 and 9.5 are five years apart
and some distros carry outdated versions)
• from the official repos at www.postgresql.org/
download/ - all major package formats supported
• from source (it is easier than you think:
everything can be compiled in a minute or two)
2016-06-22OracletoPostgresMigration-part2
From Source, You Say?
• yeah, why not?
# Centos 7
yum -y install wget
yum -y install gcc make zlib zlib-devel libxml2 libxml2-devel 
readline readline-devel openssl openssl-libs openssl-devel
useradd -m -s /bin/bash pg95
chmod 755 /home/pg95
su - pg95 -c 'wget https://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.gz'
su - pg95 -c 'tar xf postgresql-9.5.3.tar.gz'
su - pg95 -c 'cd postgresql-9.5.3; ./configure --prefix=/home/pg95 --with-libxml 
--with-openssl'
su - pg95 -c 'cd postgresql-9.5.3; make -j 2 && make install'
2016-06-22OracletoPostgresMigration-part2
Sample Setup (v.1)
2016-06-22OracletoPostgresMigration-part2
Configuration
• use initdb to create the "cluster" (as in "instance
of postgres serving a set of databases", not as in
a set of machines)
• configuration is in $PGDATA/postgresql.conf
(at the very least check out listen_addresses,
max_connections, shared_buffers and
work_mem)
• ACLs are in $PGDATA/pg_hba.conf
su - pg95 -c 'bin/initdb -D data'
# instance is fully contained in PGDATA=/home/pg95/data now
2016-06-22OracletoPostgresMigration-part2
Starting and Connecting
• pg_ctl is your friend (put this line in /etc/rc.local
and make it executable):
• psql is the universal client:
su - pg95 -c 'bin/pg_ctl -D data -l log start'
[root@p0-primary ~]# su - pg95
Last login: Wed Jun 22 08:47:36 UTC 2016 on pts/0
[pg95@p0-primary ~]$ bin/psql postgres
psql (9.5.3)
Type "help" for help.
postgres=# q
[pg95@p0-primary ~]$
2016-06-22OracletoPostgresMigration-part2
Psql Sample Session
[root@p0-primary ~]# su - pg95
Last login: Wed Jun 22 08:47:36 UTC 2016 on pts/0
[pg95@p0-primary ~]$ bin/psql postgres
psql (9.5.3)
Type "help" for help.
postgres=# l
List of databases
Name | Owner | Encoding | Collate | Ctype | Access privileges
-----------+-------+----------+-------------+-------------+-------------------
postgres | pg95 | UTF8 | en_US.UTF-8 | en_US.UTF-8 |
template0 | pg95 | UTF8 | en_US.UTF-8 | en_US.UTF-8 | [...]
template1 | pg95 | UTF8 | en_US.UTF-8 | en_US.UTF-8 | [...]
(3 rows)
postgres=# dn
List of schemas
Name | Owner
--------+-------
public | pg95
(1 row)
postgres=# d
List of relations
Schema | Name | Type | Owner
--------+------------+----------+-------
public | tab | table | pg95
public | tab_id_seq | sequence | pg95
(2 rows)
databases
schemas
tables et.al ?
2016-06-22OracletoPostgresMigration-part2
One Elephant at Work -
understanding transactions
• let's generate a file with single inserts:
• and load it into the database:
• experiments - what happens if:
• you add a begin/commit around the inserts?
• you create an unlogged table?
• you set synchronous_commit to off?
for (( i=0; i < 50000; i++ )) do
echo insert into big values ( $RANDOM ) ;
done
psql postgres -c "drop table big; create table big (x int);"
time psql postgres --quiet < inserts.sql
} outcome will
pretty much depend
on disk type...
2016-06-22OracletoPostgresMigration-part2
One Elephant at Work -
understanding the planner
• let's generate a large table with an index:
• and look at the plans for queries such as:
• experiment - what happens if:
• you switch off auto-analyze (parameter autovacuum
= off in postgresql.conf), restart the server, drop and
recreate the table and repeat the experiment?
select random() as x into big from generate_series(1, 1000000);
create index ix on big(x);
explain select count(*) from big where x < 0.00001;
2016-06-22OracletoPostgresMigration-part2
One Elephant at Work -
understanding MVCC and locking
• thanks to MVCC, "normal" operations such as update/delete/insert
do not need to lock a table, you can do a:
in one session while the table is fully usable on another session.
only if you try to update/delete THE SAME row, will the second
session be blocked.
• there are, however, operations that need locks on whole tables,
typically I've seen:
• truncate
• DDL statements such as ALTER TABLE
• I've seen situations were postgres instances were very "laggy", while
the system load was low due to lock contention
begin;
update person set name = 'Chris' where id = 1;
-- wait
2016-06-22OracletoPostgresMigration-part2
Useful System Tables
• pg_stat_activity - list of sessions and what they're doing:
select pid, usename, state, query from pg_stat_activity;
• pg_locks (beware for example of AccessExclusiveLock locks on
user tables):
select locktype, database, relation, (select relname from pg_class where
oid = relation), pid, mode from pg_locks;
• pg_stat_all_tables - to check among other things auto-analyze is
good:
select relname, last_analyze, last_autoanalyze from pg_stat_user_tables;
• and many more
2016-06-22OracletoPostgresMigration-part2
Backups
• cold backups - just shut the server down and archive the
$PGDATA directory
• online backups - pg_dump or pg_dumpall:
• pg_dump is per database (or table) with options, for example
binary output
• pg_dumpall is needed to backup the cluster-wide info such
as users
• psql and possibly pg_restore (to read the binary format) are
needed to restore the DBs
• demo as time permits
2016-06-22OracletoPostgresMigration-part2
No More Elephants
• Have a look at Josh Berkus' 7 ways to crash Postgres:
• no updates
• out of disk space
• deleting stuff
• out of RAM
• bad hardware
• too many connections
• zombie locks
2016-06-22OracletoPostgresMigration-part2
More Than One Elephant
• the other meaning of the word "cluster" is somewhat vague - here are some
Postgres features that I currently like to use:
• streaming replication: stream database operations to other nodes in real time
(optionally as 2-safe replication - i.e. at least one slave must have ack’ed a
transaction), this can be cascading too
• hot standby: issue queries on any secondary node (this includes doing online
backups on a secondary to save load from the primary)
• instant failover: promote a hot standby node to primary node instantly with a
single operation for high availability setups
• third party software allows much more, including master-master setups
• recent developments have much enhanced the streaming capabilities, for
example pglogical and BDR - eventually these will be merged into Postgres
(see for example my presentation on BDR)
2016-06-22OracletoPostgresMigration-part2
We've Been Doing it the
Whole Time ;)
2016-06-22OracletoPostgresMigration-part2
Setting up Streaming
Replication with a Hot Standby
• 5 minutes instruction by Cybertec
• our setup scripted for reference:
PRIMARY_IP=10.0.1.123
SECONDARY_IP=10.0.1.124
# primary setup
su - pg95 -c 'bin/initdb -D data'
sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /home/pg95/data/postgresql.conf
sed -i "s/#wal_level = minimal/wal_level = hot_standby/" /home/pg95/data/postgresql.conf
sed -i "s/#max_wal_senders = 0/max_wal_senders = 3/" /home/pg95/data/postgresql.conf
sed -i "s/#wal_keep_segments = 0/wal_keep_segments = 1024/" /home/pg95/data/postgresql.conf
sed -i "s/#hot_standby = off/hot_standby = on/" /home/pg95/data/postgresql.conf
echo "host replication all $SECONDARY_IP/32 trust" >> /home/pg95/data/pg_hba.conf
su - pg95 -c 'bin/pg_ctl -D data -l log start'
# note: use ssl and don't use trust auth in production, also have a look at the feature "replication slots"
# and if you're doing online backups on the standby see 25.5.2. Handling Query Conflicts in the manual
# secondary setup
su - pg95 -c 'mkdir data && chmod 700 data'
su - pg95 -c "bin/pg_basebackup -h $PRIMARY_IP -D /home/pg95/data --xlog-method=stream"
su - pg95 -c "echo 'standby_mode = on' > data/recovery.conf"
su - pg95 -c "echo "primary_conninfo = 'host=$PRIMARY_IP'" >> data/recovery.conf"
su - pg95 -c "echo "trigger_file = '/tmp/promoteme'" >> data/recovery.conf"
2016-06-22OracletoPostgresMigration-part2
Streaming Experiments
• screenshot from another demo (with machines
africa and asia):
2016-06-22OracletoPostgresMigration-part2
L'Appetito vien mangiando
• from the point of view of the application:
• hey, a connection pool would be handy!
• mmm.... in case of failover to the standby, how
am I notified that I need to change my JDBC
URL?
• come to think of it, it would be cool to off-load
read-only queries to the secondary server(s),
but I don't want to handle that logic by myself...
2016-06-22OracletoPostgresMigration-part2
Enter pgpool-II
• pgpool-II is a middleware that does exactly this:
• it hides Postgres servers behind one port 5432
• it does connection pooling
• it does load balancing with the ability to pre-parse queries and send read-only
once to the standbys
• and much more:
• it can do replication by sending the same queries to multiple servers (this is
master-master replication even, but it is less efficient and more fragile than doing
it with streaming replication)
• it has a built-in watchdog for high availability setups with two pgool-II servers and
virtual IPs
• etc.
2016-06-22OracletoPostgresMigration-part2
pgpool-II
• here is a pgpool-II presentation from the author of the software - this is
what we want to do (from the linked presentation):
2016-06-22OracletoPostgresMigration-part2
The pool is ready!
2016-06-22OracletoPostgresMigration-part2
Experiments
• demo what we have on p2, enable query logging
on p0 and p1 to see the load balancing in action,
see what happens if p0 or p1 goes down!
• our setup for reference:
# note: make a db user nobdody for the monitoring and make a pg_hba.conf entry on p0 and 01 too...
useradd -m -s /bin/bash pgpool
su - pgpool -c 'wget -O pgpool-II-3.5.3.tar.gz http://www.pgpool.net/download.php?f=pgpool-II-3.5.3.tar.gz'
su - pgpool -c 'tar xf pgpool-II-3.5.3.tar.gz'
su - pgpool -c 'cd pgpool-II-3.5.3; ./configure --prefix=/home/pgpool --with-openssl --with-pgsql=/home/pg95'
su - pgpool -c 'cd pgpool-II-3.5.3; make -j 2 && make install'
su - pgpool -c 'cp etc/pgpool.conf.sample-stream etc/pgpool.conf'
su - pgpool -c 'cp etc/pool_hba.conf.sample etc/pool_hba.conf'
su - pgpool -c 'cp etc/pcp.conf.sample etc/pcp.conf'
sed -i "s/^backend_/#backend_/" /home/pgpool/etc/pgpool.conf
sed -i "s/^pid_file_name = '/var/run/pgpool/pgpool.pid'/pid_file_name = '/home/pgpool/pgpool.pid'/" /home/pgpool/etc/pgpool.conf
sed -i "s/^logdir = '/tmp'/logdir = '/home/pgpool'/" /home/pgpool/etc/pgpool.conf
sed -i "s/^health_check_period = 0/health_check_period = 1/" /home/pgpool/etc/pgpool.conf
echo "backend_hostname0 = '$PRIMARY_IP'" >> /home/pgpool/etc/pgpool.conf
echo "backend_port0 = 5432" >> /home/pgpool/etc/pgpool.conf
echo "backend_weight0 = 1" >> /home/pgpool/etc/pgpool.conf
echo "backend_hostname1 = '$SECONDARY_IP'" >> /home/pgpool/etc/pgpool.conf
echo "backend_port1 = 5432" >> /home/pgpool/etc/pgpool.conf
echo "backend_weight1 = 1" >> /home/pgpool/etc/pgpool.conf
echo "pgpool:d41d8cd98f00b204e9800998ecf8427e" >> /home/pgpool/etc/pcp.conf # empty password
su - pgpool -c 'nohup pgpool -n 2> log &'
2016-06-22OracletoPostgresMigration-part2
Failover
• one of the cool features of pgpool-II is that
events from nodes attaching/detaching can be
scripted
• demo (if time permits) how to instruct pgpool-II to
connect to the standby over SSH and touch the
trigger file to trigger a promotion to primary
• however, always be aware that automatic failover
can be tricky (test well!)
2016-06-22OracletoPostgresMigration-part2
A Simpler Pool
• if you don't need load balancing and automatic
failover, I recommend PgBouncer
• PgBouncer is "only" a connection pool, but it
does that job really well
• you can also combine pgpool-II and PgBouncer
2016-06-22OracletoPostgresMigration-part2
'k thx bye ;)

More Related Content

What's hot

Accelerate Oracle to Aurora PostgreSQL Migration (GPSTEC313) - AWS re:Invent ...
Accelerate Oracle to Aurora PostgreSQL Migration (GPSTEC313) - AWS re:Invent ...Accelerate Oracle to Aurora PostgreSQL Migration (GPSTEC313) - AWS re:Invent ...
Accelerate Oracle to Aurora PostgreSQL Migration (GPSTEC313) - AWS re:Invent ...Amazon Web Services
 
Oracle RAC 19c - the Basis for the Autonomous Database
Oracle RAC 19c - the Basis for the Autonomous DatabaseOracle RAC 19c - the Basis for the Autonomous Database
Oracle RAC 19c - the Basis for the Autonomous DatabaseMarkus Michalewicz
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insightsKirill Loifman
 
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech TalksMigrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech TalksAmazon Web Services
 
Oracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONMarkus Michalewicz
 
Migration from Oracle to PostgreSQL: NEED vs REALITY
Migration from Oracle to PostgreSQL: NEED vs REALITYMigration from Oracle to PostgreSQL: NEED vs REALITY
Migration from Oracle to PostgreSQL: NEED vs REALITYAshnikbiz
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresqlbotsplash.com
 
Migration to Oracle Multitenant
Migration to Oracle MultitenantMigration to Oracle Multitenant
Migration to Oracle MultitenantJitendra Singh
 
Migrating from Oracle to Postgres
Migrating from Oracle to PostgresMigrating from Oracle to Postgres
Migrating from Oracle to PostgresEDB
 
A Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiA Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiDatabricks
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cSatishbabu Gunukula
 
Lakehouse Analytics with Dremio
Lakehouse Analytics with DremioLakehouse Analytics with Dremio
Lakehouse Analytics with DremioDimitarMitov4
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Sandesh Rao
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsAnil Nair
 
2019 - OOW - Database Migration Methods from On-Premise to Cloud
2019 - OOW - Database Migration Methods from On-Premise to Cloud2019 - OOW - Database Migration Methods from On-Premise to Cloud
2019 - OOW - Database Migration Methods from On-Premise to CloudMarcus Vinicius Miguel Pedro
 
Oracle Multitenant meets Oracle RAC - IOUG 2014 Version
Oracle Multitenant meets Oracle RAC - IOUG 2014 VersionOracle Multitenant meets Oracle RAC - IOUG 2014 Version
Oracle Multitenant meets Oracle RAC - IOUG 2014 VersionMarkus Michalewicz
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentationVimlendu Kumar
 
Achieving Continuous Availability for Your Applications with Oracle MAA
Achieving Continuous Availability for Your Applications with Oracle MAAAchieving Continuous Availability for Your Applications with Oracle MAA
Achieving Continuous Availability for Your Applications with Oracle MAAMarkus Michalewicz
 

What's hot (20)

Accelerate Oracle to Aurora PostgreSQL Migration (GPSTEC313) - AWS re:Invent ...
Accelerate Oracle to Aurora PostgreSQL Migration (GPSTEC313) - AWS re:Invent ...Accelerate Oracle to Aurora PostgreSQL Migration (GPSTEC313) - AWS re:Invent ...
Accelerate Oracle to Aurora PostgreSQL Migration (GPSTEC313) - AWS re:Invent ...
 
Oracle RAC 19c - the Basis for the Autonomous Database
Oracle RAC 19c - the Basis for the Autonomous DatabaseOracle RAC 19c - the Basis for the Autonomous Database
Oracle RAC 19c - the Basis for the Autonomous Database
 
Oracle 12c PDB insights
Oracle 12c PDB insightsOracle 12c PDB insights
Oracle 12c PDB insights
 
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech TalksMigrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
Migrating Your Oracle Database to PostgreSQL - AWS Online Tech Talks
 
Oracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLONOracle RAC 19c and Later - Best Practices #OOWLON
Oracle RAC 19c and Later - Best Practices #OOWLON
 
Migration from Oracle to PostgreSQL: NEED vs REALITY
Migration from Oracle to PostgreSQL: NEED vs REALITYMigration from Oracle to PostgreSQL: NEED vs REALITY
Migration from Oracle to PostgreSQL: NEED vs REALITY
 
Getting started with postgresql
Getting started with postgresqlGetting started with postgresql
Getting started with postgresql
 
Migration to Oracle Multitenant
Migration to Oracle MultitenantMigration to Oracle Multitenant
Migration to Oracle Multitenant
 
Migrating from Oracle to Postgres
Migrating from Oracle to PostgresMigrating from Oracle to Postgres
Migrating from Oracle to Postgres
 
A Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and HudiA Thorough Comparison of Delta Lake, Iceberg and Hudi
A Thorough Comparison of Delta Lake, Iceberg and Hudi
 
Why oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19cWhy oracle data guard new features in oracle 18c, 19c
Why oracle data guard new features in oracle 18c, 19c
 
Lakehouse Analytics with Dremio
Lakehouse Analytics with DremioLakehouse Analytics with Dremio
Lakehouse Analytics with Dremio
 
PostgreSQL
PostgreSQLPostgreSQL
PostgreSQL
 
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
Oracle Real Application Clusters 19c- Best Practices and Internals- EMEA Tour...
 
Oracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret InternalsOracle RAC 19c: Best Practices and Secret Internals
Oracle RAC 19c: Best Practices and Secret Internals
 
2019 - OOW - Database Migration Methods from On-Premise to Cloud
2019 - OOW - Database Migration Methods from On-Premise to Cloud2019 - OOW - Database Migration Methods from On-Premise to Cloud
2019 - OOW - Database Migration Methods from On-Premise to Cloud
 
Oracle Multitenant meets Oracle RAC - IOUG 2014 Version
Oracle Multitenant meets Oracle RAC - IOUG 2014 VersionOracle Multitenant meets Oracle RAC - IOUG 2014 Version
Oracle Multitenant meets Oracle RAC - IOUG 2014 Version
 
Dataguard presentation
Dataguard presentationDataguard presentation
Dataguard presentation
 
Achieving Continuous Availability for Your Applications with Oracle MAA
Achieving Continuous Availability for Your Applications with Oracle MAAAchieving Continuous Availability for Your Applications with Oracle MAA
Achieving Continuous Availability for Your Applications with Oracle MAA
 
Postgresql tutorial
Postgresql tutorialPostgresql tutorial
Postgresql tutorial
 

Viewers also liked

Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Gabriele Bartolini
 
Key Methodologies for Migrating from Oracle to Postgres
Key Methodologies for Migrating from Oracle to PostgresKey Methodologies for Migrating from Oracle to Postgres
Key Methodologies for Migrating from Oracle to PostgresEDB
 
Love Your Database (ESC 2k16)
Love Your Database (ESC 2k16)Love Your Database (ESC 2k16)
Love Your Database (ESC 2k16)PgTraining
 
Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017EDB
 
PGADMIN, Aplicaciones
PGADMIN, AplicacionesPGADMIN, Aplicaciones
PGADMIN, AplicacionesIsabelAlisson
 
Shaping Optimizer's Search Space
Shaping Optimizer's Search SpaceShaping Optimizer's Search Space
Shaping Optimizer's Search SpaceGerger
 
PostgreSQL for Oracle Developers and DBA's
PostgreSQL for Oracle Developers and DBA'sPostgreSQL for Oracle Developers and DBA's
PostgreSQL for Oracle Developers and DBA'sGerger
 
Reducing Database Pain & Costs with Postgres
Reducing Database Pain & Costs with PostgresReducing Database Pain & Costs with Postgres
Reducing Database Pain & Costs with PostgresEDB
 
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle Ashnikbiz
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQLSatoshi Nagayasu
 
Optimizing Your Postgres ROI Through Best Practices
Optimizing Your Postgres ROI Through Best PracticesOptimizing Your Postgres ROI Through Best Practices
Optimizing Your Postgres ROI Through Best PracticesEDB
 
EDB Postgres DBA Best Practices
EDB Postgres DBA Best PracticesEDB Postgres DBA Best Practices
EDB Postgres DBA Best PracticesEDB
 
5 Postgres DBA Tips
5 Postgres DBA Tips5 Postgres DBA Tips
5 Postgres DBA TipsEDB
 
Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!PGConf APAC
 
In-Database Analyticsの必要性と可能性
In-Database Analyticsの必要性と可能性In-Database Analyticsの必要性と可能性
In-Database Analyticsの必要性と可能性Satoshi Nagayasu
 

Viewers also liked (16)

Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
Agile Oracle to PostgreSQL migrations (PGConf.EU 2013)
 
Key Methodologies for Migrating from Oracle to Postgres
Key Methodologies for Migrating from Oracle to PostgresKey Methodologies for Migrating from Oracle to Postgres
Key Methodologies for Migrating from Oracle to Postgres
 
Love Your Database (ESC 2k16)
Love Your Database (ESC 2k16)Love Your Database (ESC 2k16)
Love Your Database (ESC 2k16)
 
Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017Product Update: EDB Postgres Platform 2017
Product Update: EDB Postgres Platform 2017
 
PGADMIN, Aplicaciones
PGADMIN, AplicacionesPGADMIN, Aplicaciones
PGADMIN, Aplicaciones
 
Shaping Optimizer's Search Space
Shaping Optimizer's Search SpaceShaping Optimizer's Search Space
Shaping Optimizer's Search Space
 
PostgreSQL for Oracle Developers and DBA's
PostgreSQL for Oracle Developers and DBA'sPostgreSQL for Oracle Developers and DBA's
PostgreSQL for Oracle Developers and DBA's
 
Reducing Database Pain & Costs with Postgres
Reducing Database Pain & Costs with PostgresReducing Database Pain & Costs with Postgres
Reducing Database Pain & Costs with Postgres
 
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
Ashnik EnterpriseDB PostgreSQL - A real alternative to Oracle
 
Why use PostgreSQL?
Why use PostgreSQL?Why use PostgreSQL?
Why use PostgreSQL?
 
10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL10 Reasons to Start Your Analytics Project with PostgreSQL
10 Reasons to Start Your Analytics Project with PostgreSQL
 
Optimizing Your Postgres ROI Through Best Practices
Optimizing Your Postgres ROI Through Best PracticesOptimizing Your Postgres ROI Through Best Practices
Optimizing Your Postgres ROI Through Best Practices
 
EDB Postgres DBA Best Practices
EDB Postgres DBA Best PracticesEDB Postgres DBA Best Practices
EDB Postgres DBA Best Practices
 
5 Postgres DBA Tips
5 Postgres DBA Tips5 Postgres DBA Tips
5 Postgres DBA Tips
 
Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!Why we love pgpool-II and why we hate it!
Why we love pgpool-II and why we hate it!
 
In-Database Analyticsの必要性と可能性
In-Database Analyticsの必要性と可能性In-Database Analyticsの必要性と可能性
In-Database Analyticsの必要性と可能性
 

Similar to Oracle to Postgres Migration - part 2

PERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaPERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaFromDual GmbH
 
What’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributorWhat’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributorMasahiko Sawada
 
Developing with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaDeveloping with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaJoe Stein
 
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRestPGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRestPGDay.Amsterdam
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021Valeriy Kravchuk
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTanel Poder
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLCommand Prompt., Inc
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLMark Wong
 
Demystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live scDemystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live scEmanuel Calvo
 
Eko10 Workshop Opensource Database Auditing
Eko10  Workshop Opensource Database AuditingEko10  Workshop Opensource Database Auditing
Eko10 Workshop Opensource Database AuditingJuan Berner
 
More on gdb for my sql db as (fosdem 2016)
More on gdb for my sql db as (fosdem 2016)More on gdb for my sql db as (fosdem 2016)
More on gdb for my sql db as (fosdem 2016)Valeriy Kravchuk
 
Designing Tracing Tools
Designing Tracing ToolsDesigning Tracing Tools
Designing Tracing ToolsBrendan Gregg
 
Infrastructure review - Shining a light on the Black Box
Infrastructure review - Shining a light on the Black BoxInfrastructure review - Shining a light on the Black Box
Infrastructure review - Shining a light on the Black BoxMiklos Szel
 
How (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureHow (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureMiklos Szel
 
Designing Tracing Tools
Designing Tracing ToolsDesigning Tracing Tools
Designing Tracing ToolsSysdig
 
Eko10 workshop - OPEN SOURCE DATABASE MONITORING
Eko10 workshop - OPEN SOURCE DATABASE MONITORINGEko10 workshop - OPEN SOURCE DATABASE MONITORING
Eko10 workshop - OPEN SOURCE DATABASE MONITORINGPablo Garbossa
 
Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck...
Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck...Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck...
Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck...Ontico
 

Similar to Oracle to Postgres Migration - part 2 (20)

The Accidental DBA
The Accidental DBAThe Accidental DBA
The Accidental DBA
 
PERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schemaPERFORMANCE_SCHEMA and sys schema
PERFORMANCE_SCHEMA and sys schema
 
Backups
BackupsBackups
Backups
 
What’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributorWhat’s new in 9.6, by PostgreSQL contributor
What’s new in 9.6, by PostgreSQL contributor
 
Developing with the Go client for Apache Kafka
Developing with the Go client for Apache KafkaDeveloping with the Go client for Apache Kafka
Developing with the Go client for Apache Kafka
 
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRestPGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
PGDay.Amsterdam 2018 - Stefan Fercot - Save your data with pgBackRest
 
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021Linux  /proc filesystem for MySQL DBAs - FOSDEM 2021
Linux /proc filesystem for MySQL DBAs - FOSDEM 2021
 
Troubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contentionTroubleshooting Complex Performance issues - Oracle SEG$ contention
Troubleshooting Complex Performance issues - Oracle SEG$ contention
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
pg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQLpg_proctab: Accessing System Stats in PostgreSQL
pg_proctab: Accessing System Stats in PostgreSQL
 
Demystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live scDemystifying postgres logical replication percona live sc
Demystifying postgres logical replication percona live sc
 
Eko10 Workshop Opensource Database Auditing
Eko10  Workshop Opensource Database AuditingEko10  Workshop Opensource Database Auditing
Eko10 Workshop Opensource Database Auditing
 
More on gdb for my sql db as (fosdem 2016)
More on gdb for my sql db as (fosdem 2016)More on gdb for my sql db as (fosdem 2016)
More on gdb for my sql db as (fosdem 2016)
 
Designing Tracing Tools
Designing Tracing ToolsDesigning Tracing Tools
Designing Tracing Tools
 
Infrastructure review - Shining a light on the Black Box
Infrastructure review - Shining a light on the Black BoxInfrastructure review - Shining a light on the Black Box
Infrastructure review - Shining a light on the Black Box
 
How (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructureHow (not) to kill your MySQL infrastructure
How (not) to kill your MySQL infrastructure
 
Designing Tracing Tools
Designing Tracing ToolsDesigning Tracing Tools
Designing Tracing Tools
 
Eko10 workshop - OPEN SOURCE DATABASE MONITORING
Eko10 workshop - OPEN SOURCE DATABASE MONITORINGEko10 workshop - OPEN SOURCE DATABASE MONITORING
Eko10 workshop - OPEN SOURCE DATABASE MONITORING
 
Logstash
LogstashLogstash
Logstash
 
Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck...
Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck...Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck...
Peeking into the Black Hole Called PL/PGSQL - the New PL Profiler / Jan Wieck...
 

More from PgTraining

Webminar del 12.03.2012
Webminar del 12.03.2012Webminar del 12.03.2012
Webminar del 12.03.2012PgTraining
 
Webminar del 12.03.2012
Webminar del 12.03.2012Webminar del 12.03.2012
Webminar del 12.03.2012PgTraining
 
Weminar 12.03.2021 . JIT
Weminar 12.03.2021 . JITWeminar 12.03.2021 . JIT
Weminar 12.03.2021 . JITPgTraining
 
Openday - PostgreSQL: primi passi con Json/Jsonb
Openday - PostgreSQL: primi passi con Json/Jsonb Openday - PostgreSQL: primi passi con Json/Jsonb
Openday - PostgreSQL: primi passi con Json/Jsonb PgTraining
 
Pgtraining bdr
Pgtraining bdrPgtraining bdr
Pgtraining bdrPgTraining
 

More from PgTraining (7)

Webminar del 12.03.2012
Webminar del 12.03.2012Webminar del 12.03.2012
Webminar del 12.03.2012
 
Webminar del 12.03.2012
Webminar del 12.03.2012Webminar del 12.03.2012
Webminar del 12.03.2012
 
Weminar 12.03.2021 . JIT
Weminar 12.03.2021 . JITWeminar 12.03.2021 . JIT
Weminar 12.03.2021 . JIT
 
Openday - PostgreSQL: primi passi con Json/Jsonb
Openday - PostgreSQL: primi passi con Json/Jsonb Openday - PostgreSQL: primi passi con Json/Jsonb
Openday - PostgreSQL: primi passi con Json/Jsonb
 
Pgtraining bdr
Pgtraining bdrPgtraining bdr
Pgtraining bdr
 
Messa in rete
Messa in reteMessa in rete
Messa in rete
 
Apcamp
ApcampApcamp
Apcamp
 

Recently uploaded

一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单ewymefz
 
Uber Ride Supply Demand Gap Analysis Report
Uber Ride Supply Demand Gap Analysis ReportUber Ride Supply Demand Gap Analysis Report
Uber Ride Supply Demand Gap Analysis ReportSatyamNeelmani2
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationBoston Institute of Analytics
 
Webinar One View, Multiple Systems No-Code Integration of Salesforce and ERPs
Webinar One View, Multiple Systems No-Code Integration of Salesforce and ERPsWebinar One View, Multiple Systems No-Code Integration of Salesforce and ERPs
Webinar One View, Multiple Systems No-Code Integration of Salesforce and ERPsCEPTES Software Inc
 
Computer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage sComputer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage sMAQIB18
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单ewymefz
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单nscud
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP
 
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...correoyaya
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单enxupq
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单ewymefz
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单ewymefz
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .NABLAS株式会社
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单yhkoc
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhArpitMalhotra16
 
Tabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflowsTabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflowsalex933524
 
tapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive datatapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive datatheahmadsaood
 
How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?DOT TECH
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单vcaxypu
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay
 

Recently uploaded (20)

一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
一比一原版(UofM毕业证)明尼苏达大学毕业证成绩单
 
Uber Ride Supply Demand Gap Analysis Report
Uber Ride Supply Demand Gap Analysis ReportUber Ride Supply Demand Gap Analysis Report
Uber Ride Supply Demand Gap Analysis Report
 
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project PresentationPredicting Product Ad Campaign Performance: A Data Analysis Project Presentation
Predicting Product Ad Campaign Performance: A Data Analysis Project Presentation
 
Webinar One View, Multiple Systems No-Code Integration of Salesforce and ERPs
Webinar One View, Multiple Systems No-Code Integration of Salesforce and ERPsWebinar One View, Multiple Systems No-Code Integration of Salesforce and ERPs
Webinar One View, Multiple Systems No-Code Integration of Salesforce and ERPs
 
Computer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage sComputer Presentation.pptx ecommerce advantage s
Computer Presentation.pptx ecommerce advantage s
 
一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单一比一原版(NYU毕业证)纽约大学毕业证成绩单
一比一原版(NYU毕业证)纽约大学毕业证成绩单
 
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
一比一原版(CBU毕业证)不列颠海角大学毕业证成绩单
 
Criminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdfCriminal IP - Threat Hunting Webinar.pdf
Criminal IP - Threat Hunting Webinar.pdf
 
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
Innovative Methods in Media and Communication Research by Sebastian Kubitschk...
 
一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单一比一原版(YU毕业证)约克大学毕业证成绩单
一比一原版(YU毕业证)约克大学毕业证成绩单
 
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
一比一原版(UMich毕业证)密歇根大学|安娜堡分校毕业证成绩单
 
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
一比一原版(UPenn毕业证)宾夕法尼亚大学毕业证成绩单
 
社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .社内勉強会資料_LLM Agents                              .
社内勉強会資料_LLM Agents                              .
 
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
一比一原版(CU毕业证)卡尔顿大学毕业证成绩单
 
standardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghhstandardisation of garbhpala offhgfffghh
standardisation of garbhpala offhgfffghh
 
Tabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflowsTabula.io Cheatsheet: automate your data workflows
Tabula.io Cheatsheet: automate your data workflows
 
tapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive datatapal brand analysis PPT slide for comptetive data
tapal brand analysis PPT slide for comptetive data
 
How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?How can I successfully sell my pi coins in Philippines?
How can I successfully sell my pi coins in Philippines?
 
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
一比一原版(RUG毕业证)格罗宁根大学毕业证成绩单
 
Opendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptxOpendatabay - Open Data Marketplace.pptx
Opendatabay - Open Data Marketplace.pptx
 

Oracle to Postgres Migration - part 2

  • 1. Workshop Oracle to Postgres Migration Part 2 - Running Postgres 2016-06-22 @IDM Chris Mair http://www.pgtraining.com
  • 2. 2016-06-22OracletoPostgresMigration-part2 The Workshop very quick walk through for Postgres-DBAs to-be • installation, getting support, the configuration files, psql, understanding transactions, the query-planner and locking, backups, system tables, streaming replication, hot standbys, connection pooling, load balancing and even automatic failover all with life-demos and condensed into just three hours - will we finish on time?
  • 3. 2016-06-22OracletoPostgresMigration-part2 Getting Support • very good community support through mailing lists: psql.it list / Italian and official list (English) and many others • commercial support - in Italy for example from us at PGtraining (three free lancers) or 2ndQuadrant (SRL), in Austria from Cypertec (GmbH) et al • don't forget managed hosting offerings from Amazon Web Services (PostgreSQL RDS), Heroku and others
  • 4. 2016-06-22OracletoPostgresMigration-part2 Installing Postgres • from your distro (note that the second digit is the major version 9.0 and 9.5 are five years apart and some distros carry outdated versions) • from the official repos at www.postgresql.org/ download/ - all major package formats supported • from source (it is easier than you think: everything can be compiled in a minute or two)
  • 5. 2016-06-22OracletoPostgresMigration-part2 From Source, You Say? • yeah, why not? # Centos 7 yum -y install wget yum -y install gcc make zlib zlib-devel libxml2 libxml2-devel readline readline-devel openssl openssl-libs openssl-devel useradd -m -s /bin/bash pg95 chmod 755 /home/pg95 su - pg95 -c 'wget https://ftp.postgresql.org/pub/source/v9.5.3/postgresql-9.5.3.tar.gz' su - pg95 -c 'tar xf postgresql-9.5.3.tar.gz' su - pg95 -c 'cd postgresql-9.5.3; ./configure --prefix=/home/pg95 --with-libxml --with-openssl' su - pg95 -c 'cd postgresql-9.5.3; make -j 2 && make install'
  • 7. 2016-06-22OracletoPostgresMigration-part2 Configuration • use initdb to create the "cluster" (as in "instance of postgres serving a set of databases", not as in a set of machines) • configuration is in $PGDATA/postgresql.conf (at the very least check out listen_addresses, max_connections, shared_buffers and work_mem) • ACLs are in $PGDATA/pg_hba.conf su - pg95 -c 'bin/initdb -D data' # instance is fully contained in PGDATA=/home/pg95/data now
  • 8. 2016-06-22OracletoPostgresMigration-part2 Starting and Connecting • pg_ctl is your friend (put this line in /etc/rc.local and make it executable): • psql is the universal client: su - pg95 -c 'bin/pg_ctl -D data -l log start' [root@p0-primary ~]# su - pg95 Last login: Wed Jun 22 08:47:36 UTC 2016 on pts/0 [pg95@p0-primary ~]$ bin/psql postgres psql (9.5.3) Type "help" for help. postgres=# q [pg95@p0-primary ~]$
  • 9. 2016-06-22OracletoPostgresMigration-part2 Psql Sample Session [root@p0-primary ~]# su - pg95 Last login: Wed Jun 22 08:47:36 UTC 2016 on pts/0 [pg95@p0-primary ~]$ bin/psql postgres psql (9.5.3) Type "help" for help. postgres=# l List of databases Name | Owner | Encoding | Collate | Ctype | Access privileges -----------+-------+----------+-------------+-------------+------------------- postgres | pg95 | UTF8 | en_US.UTF-8 | en_US.UTF-8 | template0 | pg95 | UTF8 | en_US.UTF-8 | en_US.UTF-8 | [...] template1 | pg95 | UTF8 | en_US.UTF-8 | en_US.UTF-8 | [...] (3 rows) postgres=# dn List of schemas Name | Owner --------+------- public | pg95 (1 row) postgres=# d List of relations Schema | Name | Type | Owner --------+------------+----------+------- public | tab | table | pg95 public | tab_id_seq | sequence | pg95 (2 rows) databases schemas tables et.al ?
  • 10. 2016-06-22OracletoPostgresMigration-part2 One Elephant at Work - understanding transactions • let's generate a file with single inserts: • and load it into the database: • experiments - what happens if: • you add a begin/commit around the inserts? • you create an unlogged table? • you set synchronous_commit to off? for (( i=0; i < 50000; i++ )) do echo insert into big values ( $RANDOM ) ; done psql postgres -c "drop table big; create table big (x int);" time psql postgres --quiet < inserts.sql } outcome will pretty much depend on disk type...
  • 11. 2016-06-22OracletoPostgresMigration-part2 One Elephant at Work - understanding the planner • let's generate a large table with an index: • and look at the plans for queries such as: • experiment - what happens if: • you switch off auto-analyze (parameter autovacuum = off in postgresql.conf), restart the server, drop and recreate the table and repeat the experiment? select random() as x into big from generate_series(1, 1000000); create index ix on big(x); explain select count(*) from big where x < 0.00001;
  • 12. 2016-06-22OracletoPostgresMigration-part2 One Elephant at Work - understanding MVCC and locking • thanks to MVCC, "normal" operations such as update/delete/insert do not need to lock a table, you can do a: in one session while the table is fully usable on another session. only if you try to update/delete THE SAME row, will the second session be blocked. • there are, however, operations that need locks on whole tables, typically I've seen: • truncate • DDL statements such as ALTER TABLE • I've seen situations were postgres instances were very "laggy", while the system load was low due to lock contention begin; update person set name = 'Chris' where id = 1; -- wait
  • 13. 2016-06-22OracletoPostgresMigration-part2 Useful System Tables • pg_stat_activity - list of sessions and what they're doing: select pid, usename, state, query from pg_stat_activity; • pg_locks (beware for example of AccessExclusiveLock locks on user tables): select locktype, database, relation, (select relname from pg_class where oid = relation), pid, mode from pg_locks; • pg_stat_all_tables - to check among other things auto-analyze is good: select relname, last_analyze, last_autoanalyze from pg_stat_user_tables; • and many more
  • 14. 2016-06-22OracletoPostgresMigration-part2 Backups • cold backups - just shut the server down and archive the $PGDATA directory • online backups - pg_dump or pg_dumpall: • pg_dump is per database (or table) with options, for example binary output • pg_dumpall is needed to backup the cluster-wide info such as users • psql and possibly pg_restore (to read the binary format) are needed to restore the DBs • demo as time permits
  • 15. 2016-06-22OracletoPostgresMigration-part2 No More Elephants • Have a look at Josh Berkus' 7 ways to crash Postgres: • no updates • out of disk space • deleting stuff • out of RAM • bad hardware • too many connections • zombie locks
  • 16. 2016-06-22OracletoPostgresMigration-part2 More Than One Elephant • the other meaning of the word "cluster" is somewhat vague - here are some Postgres features that I currently like to use: • streaming replication: stream database operations to other nodes in real time (optionally as 2-safe replication - i.e. at least one slave must have ack’ed a transaction), this can be cascading too • hot standby: issue queries on any secondary node (this includes doing online backups on a secondary to save load from the primary) • instant failover: promote a hot standby node to primary node instantly with a single operation for high availability setups • third party software allows much more, including master-master setups • recent developments have much enhanced the streaming capabilities, for example pglogical and BDR - eventually these will be merged into Postgres (see for example my presentation on BDR)
  • 18. 2016-06-22OracletoPostgresMigration-part2 Setting up Streaming Replication with a Hot Standby • 5 minutes instruction by Cybertec • our setup scripted for reference: PRIMARY_IP=10.0.1.123 SECONDARY_IP=10.0.1.124 # primary setup su - pg95 -c 'bin/initdb -D data' sed -i "s/#listen_addresses = 'localhost'/listen_addresses = '*'/" /home/pg95/data/postgresql.conf sed -i "s/#wal_level = minimal/wal_level = hot_standby/" /home/pg95/data/postgresql.conf sed -i "s/#max_wal_senders = 0/max_wal_senders = 3/" /home/pg95/data/postgresql.conf sed -i "s/#wal_keep_segments = 0/wal_keep_segments = 1024/" /home/pg95/data/postgresql.conf sed -i "s/#hot_standby = off/hot_standby = on/" /home/pg95/data/postgresql.conf echo "host replication all $SECONDARY_IP/32 trust" >> /home/pg95/data/pg_hba.conf su - pg95 -c 'bin/pg_ctl -D data -l log start' # note: use ssl and don't use trust auth in production, also have a look at the feature "replication slots" # and if you're doing online backups on the standby see 25.5.2. Handling Query Conflicts in the manual # secondary setup su - pg95 -c 'mkdir data && chmod 700 data' su - pg95 -c "bin/pg_basebackup -h $PRIMARY_IP -D /home/pg95/data --xlog-method=stream" su - pg95 -c "echo 'standby_mode = on' > data/recovery.conf" su - pg95 -c "echo "primary_conninfo = 'host=$PRIMARY_IP'" >> data/recovery.conf" su - pg95 -c "echo "trigger_file = '/tmp/promoteme'" >> data/recovery.conf"
  • 19. 2016-06-22OracletoPostgresMigration-part2 Streaming Experiments • screenshot from another demo (with machines africa and asia):
  • 20. 2016-06-22OracletoPostgresMigration-part2 L'Appetito vien mangiando • from the point of view of the application: • hey, a connection pool would be handy! • mmm.... in case of failover to the standby, how am I notified that I need to change my JDBC URL? • come to think of it, it would be cool to off-load read-only queries to the secondary server(s), but I don't want to handle that logic by myself...
  • 21. 2016-06-22OracletoPostgresMigration-part2 Enter pgpool-II • pgpool-II is a middleware that does exactly this: • it hides Postgres servers behind one port 5432 • it does connection pooling • it does load balancing with the ability to pre-parse queries and send read-only once to the standbys • and much more: • it can do replication by sending the same queries to multiple servers (this is master-master replication even, but it is less efficient and more fragile than doing it with streaming replication) • it has a built-in watchdog for high availability setups with two pgool-II servers and virtual IPs • etc.
  • 22. 2016-06-22OracletoPostgresMigration-part2 pgpool-II • here is a pgpool-II presentation from the author of the software - this is what we want to do (from the linked presentation):
  • 24. 2016-06-22OracletoPostgresMigration-part2 Experiments • demo what we have on p2, enable query logging on p0 and p1 to see the load balancing in action, see what happens if p0 or p1 goes down! • our setup for reference: # note: make a db user nobdody for the monitoring and make a pg_hba.conf entry on p0 and 01 too... useradd -m -s /bin/bash pgpool su - pgpool -c 'wget -O pgpool-II-3.5.3.tar.gz http://www.pgpool.net/download.php?f=pgpool-II-3.5.3.tar.gz' su - pgpool -c 'tar xf pgpool-II-3.5.3.tar.gz' su - pgpool -c 'cd pgpool-II-3.5.3; ./configure --prefix=/home/pgpool --with-openssl --with-pgsql=/home/pg95' su - pgpool -c 'cd pgpool-II-3.5.3; make -j 2 && make install' su - pgpool -c 'cp etc/pgpool.conf.sample-stream etc/pgpool.conf' su - pgpool -c 'cp etc/pool_hba.conf.sample etc/pool_hba.conf' su - pgpool -c 'cp etc/pcp.conf.sample etc/pcp.conf' sed -i "s/^backend_/#backend_/" /home/pgpool/etc/pgpool.conf sed -i "s/^pid_file_name = '/var/run/pgpool/pgpool.pid'/pid_file_name = '/home/pgpool/pgpool.pid'/" /home/pgpool/etc/pgpool.conf sed -i "s/^logdir = '/tmp'/logdir = '/home/pgpool'/" /home/pgpool/etc/pgpool.conf sed -i "s/^health_check_period = 0/health_check_period = 1/" /home/pgpool/etc/pgpool.conf echo "backend_hostname0 = '$PRIMARY_IP'" >> /home/pgpool/etc/pgpool.conf echo "backend_port0 = 5432" >> /home/pgpool/etc/pgpool.conf echo "backend_weight0 = 1" >> /home/pgpool/etc/pgpool.conf echo "backend_hostname1 = '$SECONDARY_IP'" >> /home/pgpool/etc/pgpool.conf echo "backend_port1 = 5432" >> /home/pgpool/etc/pgpool.conf echo "backend_weight1 = 1" >> /home/pgpool/etc/pgpool.conf echo "pgpool:d41d8cd98f00b204e9800998ecf8427e" >> /home/pgpool/etc/pcp.conf # empty password su - pgpool -c 'nohup pgpool -n 2> log &'
  • 25. 2016-06-22OracletoPostgresMigration-part2 Failover • one of the cool features of pgpool-II is that events from nodes attaching/detaching can be scripted • demo (if time permits) how to instruct pgpool-II to connect to the standby over SSH and touch the trigger file to trigger a promotion to primary • however, always be aware that automatic failover can be tricky (test well!)
  • 26. 2016-06-22OracletoPostgresMigration-part2 A Simpler Pool • if you don't need load balancing and automatic failover, I recommend PgBouncer • PgBouncer is "only" a connection pool, but it does that job really well • you can also combine pgpool-II and PgBouncer