1 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
2 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Embracing Database Diversity:
The New Oracle / MySQL DBA
Keith Hollman
MySQL Principal Sales Consultant EMEA
3 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
The following is intended to outline our general product direction. It is
intended for information purposes only, and may not be incorporated
into any contract. It is not a commitment to deliver any material, code,
or functionality, and should not be relied upon in making purchasing
decision. The development, release, and timing of any features or
functionality described for Oracle’s products remains at the sole
discretion of Oracle.
Safe Harbor Statement
4 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Program Agenda
Today
When is it appropriate to use one or the other.
What assumptions do I have to leave behind?
What assumptions is it safe to bring forward with me?
What is a storage engine and why should I care?
What are the equivalent tools MySQL has for monitoring and backup? What are big
differences from Oracle equivalents?
What other tools work with MySQL.
And what about High Availability?
What is Carrier Grade Edition and why do you call it that? When would I use it?
What do I need to know about MySQL security?
5 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Today
• Classic Oracle DBA’s & MySQL DBA’s.
• Wide ranges of Oracle solutions and doubts appear
concerning 2 of the most popular databases on the
planet.
– Main focus points.
– Similarities of both RDBMS'.
• The power of tools
– Housekeeping & how to make it easier for all.
7 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Overview
MySQL Server (mysqld_safe mysqld)
• my.cnf / my.ini: datadir (db dirs, .frm, .MYD, .MYI) / socket / port / user
/ pid-file.
Starting | Stopping:
# mysql.server | /etc/init.d/mysql start | stop
Accessing:
# mysql –uroot –ppassword ([client],[mysql] options in
my.cnf)
mysql> use sakila;
mysql> show tables;
9 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
One or the Other…
10 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
When is it appropriate to use one or the
other.
• GPL / Opensource / LAMP stack.
• Enterprise Edition
• Speed / quick to market vs existing application complexity.
– Web-based, SaaS / Cloud, customized apps, embedded.
– High-end Enterprise Packaged apps, ERP, HRMS, CRM, etc.
• Specific use cases vs “one-size-fits-all”.
– Offload certain functionalities for specific use: Web, OLTP, BI, etc.
• TCO: Reduced / limited / unknown budget.
• Mix: ETL use of both: ODI / GG.
11 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What assumptions is it safe to bring
forward with me? • Standard SQL (S/I/U/D, joins, etc.) …… sql_mode=‘ORACLE’
• OLTP VLDB, Replication & HA, memory preferred, IO fine tuning, thread conc.
• Buffers & caches, datatypes, statements & functions.
• Locks, rollbacks, redo (InnoDB), event logging.
• Hot non-blocking backup, Monitoring, Thread pool, Security, other features..
• 1 main configuration / options file.
• Data flexibility: Export / Import (5.6 RC transportable tablespaces)
• GUI Tools do exist.
• Oracle Certified Professional certification path (Dev, DBA, Cluster).
• My Oracle Support: 1-Stop for Oracle RDBMS Server & MySQL Server. … & some other “nice things to have” (dummy mode, mysqld_safe, …)
12 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What assumptions do I have to leave
behind? • Controlfiles
• Listener
• Replication (X platform)
• User = Schema
• Install pre-reqs & go-live time.
• A Database instance = Database
• MySQL Databases to Server
instance is n:1 (per sw install)
• Multiple .ora’s: tnsnames, sqlnet,..
• Localizations: Charset at DB level.
• .. from DUAL;
• Commodity Hardware. Scale-out vs
scale-up.
• Lot’s of ‘tablespaces’.
• Table partitioning vs sharding & Tb
per table = Application is db-aware.
• Certified and/or Supported
platforms.
• Technical Comparison.
13 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What is a Storage Engine
• Performance, Concurrency, & Locking (careful……).
• Processing model.
– Upper tier, mysqld parses & optimizes SQL in order to retrieve / store.
– Lower tier: Storage Engine dependant.
• Transparent to the end user.
– Except: Create | Alter table ENGINE option; Index types; commit/rollback.
• What IS storage engine dependent:
– Storage, transactional, locking, BnR, optimization (data retrieval/storing), special
features.
• Forks.
and why should I care?
14 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What is a Storage Engine
• InnoDB (default >5.5.5)
– OLTP, Referential Integrity, Row Locking, FullText (5.6), crash recoverable, Multiple Buffers &
Caches.
• MyISAM (default <5.5.5)
– .MYD/.MYI portable files, high compression, FullText & GIS search, Fixed row format for
speed, concurrent inserts, writes precede over selects.
• MEMORY
– fast performance, .frm files on disk, fixed length rows, hash & btree indexes, table contents
temporary*, --init-file.
• NDB (Cluster)
– Specific to Cluster: HA, OLTP, replicas, partitions & fragments, server aware, etc.
• CSV, BLACKHOLE, EXAMPLE, ARCHIVE, MERGE/MRG_MYISAM...
and why should I care? Types.
15 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What are the equivalent MySQL tools
• CLI: mysql, mysqladmin (..shutdown_timeout..), mysqlcheck(c,r,o,a)
mysqldump (backup), mysqlimport, innochecksum, myisam_ftdump,
myisamchk, mysqlbinlog, mysqlshow, mysqlhotcopy (MyISAM+unix)…
• Oracle Packs != MySQL Enterprise Edition Components / Tools.
• Enterprise Monitor
– Agent / Server: Query Analyzer / Replication /
• Enterprise Backup
– mysqlbackup: Any table-type / auto-locking / full, Incremental / Disk, tape /
compression / Oracle Secure Backup integration, …
• Binlog usage (D&R, Replication, auto-purging, viewing ops on a particular
database, etc.)
…for monitoring and backup?
16 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What other tools work with MySQL.
• MySQL Workbench
– Server, User & Object administration.
– Reverse Engineering of Data models: GUI & Exportable.
– Utilities: Migration, Replication admin switch|fail-over (5.6 GTIDs), etc.
– Other Admin uses: diskfree, mysqlserverclone, mysqluserclone,
mysqldiff...
• Oracle VM / Oracle Linux (KSplice) HA deployment, templates, etc.
• CLI cont.: mysqlaccess, mysqlbug, mysqlslap, mysqldumpslow, mysql_zap,
mysql_convert_table_format, mysql_find_rows, mysql_fix_extensions, ..
17 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What do I need to know about security?
# mysql –uroot
mysql> grant all on *.* to ‘root’@’192.168.1.1’ identified by
‘password’;
• mysql_secure_installation script.
• SSL Keys & Certificates parametrization.
• Proxy (non GA)
• Enterprise Security: PAM & External Authentication.
– LDAP integration.
• Oracle Secure Backup integration.
• MEM Security Advisor
18 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
And what about High Availability?
• 5 nine’s: 99.999%
• Community:
– MySQL Replication (async & semi-sync) <> Oracle Replication
• Binlogs (Archivelogs), relay log.
– MySQL in clustered environments, heartbeats, SAN, etc.
• Enterprise
– Active–Passive: DRBD & Oracle Linux (pacemaker & corosync)
– Shared disk (o.s. cluster or virtualization)
– Replication & MySQL Utilities (GTIDs, mysqlrpladmin, switchover)
– Enterprise Monitor Replication Advisor.
– MySQL Cluster Carrier Grade Edition. Shared nothing.
Overview
19 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
MySQL Carrier Grade
Edition
20 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
“I came in contact with every known Indian anarchist in
London. Their bravery impressed me, but I felt that their
zeal was misguided. I felt that violence was no remedy
for India's ills, and that her civilisation required the use of
a different and higher weapon for self-protection.”
Mohandas Karamchand Gandhi, Hind Swaraj 1908.
21 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
What is Carrier Grade Edition
• MySQL Cluster Enterprise Edition / “Carrier Grade” extensively used in Telco
solutions: HLR, SDP, HSS, AAA, etc.
• CGE = MySQL Cluster EE <> MySQL in Cluster
• HA measured in “nine’s”: 99.999%
• ACID compliant.
• Shared nothing / Datanodes, Replica’s, Partitions ‘n’ Fragments.
• Self healing.
• MySQL Cluster Manager arbitrators.
• Online: Please don’t use any NF until all nodes have been upgraded.
• Memcached & NDB API
• Assign core Cluster component processes to CPU ‘cores’ for speed.
Why do you call it that? When would I use it?
22 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Cluster Architecture
23 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Cluster Architecture
• More?
Datanodes, Replicas, Node groups, Fragments…
24 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
Data Node 3
Data Node 4 - A partition is portion of a table
- Number of partitions = number of data nodes
- Horizontal partitioning
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
P1
Automatic Data Partitioning
25 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
Data Node 3
Data Node 4 A fragment is a copy of a partition
Number of fragments = # of partitions * # of replicas
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
P1
Automatic Data Partitioning
26 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
Data Node 3
Data Node 4 A fragment is a copy of a partition
Number of fragments = # of partitions * # of replicas
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
27 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1
Primary Fragment
Secondary Fragment
Data Node 3
Data Node 4 Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
28 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1
Primary Fragment
Secondary Fragment
F1
Data Node 3
Data Node 4 Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
29 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4 Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
30 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4 Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
31 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4
F2
Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
32 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4
F2
F2
Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
33 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4
F2
F4 F2
4 Partitions * 2 Replicas = 8 Fragments
Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
P1
Automatic Data Partitioning
34 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
35 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F3
Primary Fragment
Secondary Fragment
F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Fx
Fx
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
F1
F3
Automatic Data Partitioning
36 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2 Fx
Fx
- Node groups are created automatically
- # of groups = # of data nodes / # of replicas
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
37 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2 Fx
Fx
As long as one data node in each node group
is running we have a complete copy of the
data
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
38 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2 Fx
Fx
As long as one data node in each node group
is running we have a complete copy of the
data
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
39 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2 Fx
Fx
As long as one data node in each node group
is running we have a complete copy of the
data
Table T1
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
4 Partitions * 2 Replicas = 8 Fragments
P1
Automatic Data Partitioning
40 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Table T1
Data Node 1
Data Node 2
F1 F3
Primary Fragment
Secondary Fragment
ID FirstName LastName Email Phone
P2
P3
P4
Px Partition
F3 F1
Data Node 3
Data Node 4
F2 F4
F4 F2
Node Group 1
Node Group 2
4 Partitions * 2 Replicas = 8 Fragments
Fx
Fx
- No complete copy of the data
- Cluster shutdowns
automatically
P1
Automatic Data Partitioning
41 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Key Concepts • Partition
– Horizontal partitioning
– A portion of a table, each partition contains a set of rows
– Number of partitions = number of data nodes
• Fragment
– A copy of a partition
• Replica
– A complete copy
of the data
• Node Group
– Created automatically
– # of groups = # of data nodes / # of replicas
– As long as there is one data node in each
node group we have a complete copy of the data
42 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Questions? [email protected]
43 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
My turn to ask…
• Do you always need a storage
engine.
• What is a schema.
• How could I ‘pretend’ to use an
Oracle type db.
• What’s the equivalent of an
archivelog.
• Is MySQL open-source.
• Why would we use the
MEMORY storage engine.
• How could we simulate table
snapshots.
• Other than Cluster, what HA
solutions are there.
• What’s the difference between
Community & Enterprise.
44 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
Learn More
• mysql.com
- MySQL Products and Editions
- TCO calculator
- Customer use cases and success stories
• dev.mysql.com
- Downloads, Documentation
- Forums
- PlanetMySQL
• eDelivery.oracle.com
- Download and evaluate all MySQL products
45 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.
46 Copyright © 2012, Oracle and/or its affiliates. All rights reserved.