SlideShare a Scribd company logo
1 of 32
Download to read offline
ORACLESHARDINGLEARNINGMORE
Oracle 12.2 Sharded Database Management
ABOUT ME
➤ Kamus@Enmotech 张乐奕
➤ Travel and Starbucks
➤ Travel: Japan
➤ Starbucks: Venti Caramel Macchiato
➤ Games: Blizzard fans, Hearthstone
➤ Channel[K]: http://www.dbform.com
WHAT IS
ORACLESHARDING
Every shard is a part of logical database
WHAT IS SHARDING EXACTLY
//Query single row
select User_Name from T1 where User_ID=1;
//Query all
create view T as select * from T1 union all select * from T2;
select count(*) from T;
Database “DB” Database “DB”
Split Table
Table “T”
User_ID User_Name
1 Kim
2 Tim
3 Jim
4 Sim
Table “T1”
User_ID User_Name
1 Kim
3 Jim
Table “T2”
User_ID User_Name
2 Tim
4 Sim
WHAT IS SHARDING EXACTLY
//Query single row
select User_Name from T where User_ID=1;
//Query all
select count(*) from T;
Database “DB” Database “DB”
Partition Table
Table “T”
User_ID User_Name
1 Kim
2 Tim
3 Jim
4 Sim
Partition “P1”
User_ID User_Name
1 Kim
3 Jim
Partition“P2”
User_ID User_Name
2 Tim
4 Sim
Table “T”
WHAT IS SHARDING EXACTLY
//Query single row
select User_Name from T where User_ID=1;
//Query all
select count(*) from T;
Database “DB” Database “DB1”
Shard Table
Table “T”
User_ID User_Name
1 Kim
2 Tim
3 Jim
4 Sim
Shard “S1”
User_ID User_Name
1 Kim
3 Jim
Shard “S2”
User_ID User_Name
2 Tim
4 Sim
Database “DB2”
Table “T”
➤ Greater scalability and fault isolation than possible with RAC
➤ Large billing systems
➤ Airline ticketing systems
➤ Online financial services
➤ Media companies
➤ Online information services
➤ Social media companies
WHICH SYSTEM WILL NEED SHARDING?
0
100000
200000
300000
400000
500000
600000
700000
800000
900000
1000000
OLTP	Throughput
APPLICATION DESIGNED FOR SHARDING
➤ Sharding is not application transparent
➤ Application must specify a sharding key for optimal performance
➤ e.g. customer_id, account_id etc
➤ Primary usage pattern
➤ Direct routing to a shard based on sharding key
➤ Single-shard operations for highest performance
➤ Ancillary usage pattern
➤ Proxy routing for multi-shard queries (reporting)
➤ Able to tolerate lesser performance than direct routing used for single-shard
operations
HOW LINKEDIN USE ORACLE SHARDING
Copy of Slide from Oracle Corp.
SHARDING ARCHITECTURE: LINKEDIN
Copy of Slide from Oracle Corp.
DEPLOYMENT OF
ORACLE SHARDING
Every shard is a part of logical database
DEPLOYMENT OF A SYSTEM-MANAGED SDB
SIMPLE ENV FOR TESTING
shard director + shard catalog
shard node1, shard node2
SDB DEPLOYMENT OVERVIEW
➤ 1.Oracle Sharding Prerequisites
➤ 2.Installing Oracle Database Software (database)
➤ 3.Installing the Shard Director Software (gsm)
➤ 4.Installing schagent in all Shard Node (database)
➤ 4.Creating the Shard Catalog Database (dbca)
➤ 5.Setting Up the Oracle Sharding Management and GDS
➤ 6.Deploying and Managing a System-Managed SDB (gdsctl)
https://oracleblog.org/working-case/deployoracle-sharding-database/
创建Oracle sharding database - ⼩荷OracleBlog 天堂向左,DBA向右
REQUIRED MEDIA
➤ database.zip, gsm.zip
db software, for shardcat database
db software on every shard node
GDS framework and GSM service
Scheduler Agent on shard node
ORACLE SHARDING PREREQUISITES
➤ 12.2 Enterprise Edition
➤ Non-cdb
➤ Filesystem, no ASM (12.2 Beta)
➤ every shard node IP resolved in every node’s hosts file
➤ A whole new machine without any Oracle software preinstallation
WHAT DOES DEPLOY DO?
➤ Creates shards and listeners
➤ DBMS_SCHEDULER package (executed on shard catalog) communicates with
Scheduler Agents on remote hosts
➤ Agents run DBCA and NETCA to create shards and listeners
➤ Creates the Data Guard configuration
➤ Primaries are created first, RMAN duplicate is used to create corresponding standbys
➤ Redo transport and broker are configured, observers are started on shard director
hosts and Fast-Start Failover is enabled
➤ Optionally, deploys GoldenGate bi-directional replication (OGG 12.3)
➤ Replication pipelines are configured and replication is started
CENTRALIZED SCHEMA MANAGEMENT
connect to GDS$CATALOG service
alter session enable shard ddl;
create tablespace set …
create tablespace …
create user ...
create sharded table … tablespace set
Create duplicated table … tablespace
Shard	Director
Shard		1 Shard	2 Shard	n
Shard	
Catalog
UNDERSTANDING CHUNKS AND TABLESPACE
➤ Chunk is the Unit of Data Movement in a Sharded Database
➤ Simple form: 1 chunk = 1 tablespace = 1 datafile
➤ The number of chunks is defined during the creation of shard catalog
UNDERSTANDING CHUNKS AND TABLESPACE
//Log in GSM
GDSCTL>config chunks
Chunks
------------------------
Database From To
-------- ---- --
sh1 1 6
sh2 7 12
UNDERSTANDING CHUNKS AND TABLESPACE
//Log in shard node database sh1
SQL> select tablespace_name from dba_tablespaces where tablespace_name like '%TSSET%';
TABLESPACE_NAME
--------------------
TSSET1
C001TSSET1
C002TSSET1
C003TSSET1
C004TSSET1
C005TSSET1
C006TSSET1
7 rows selected.
UNDERSTANDING CHUNKS AND TABLESPACE
//Log in shard node database sh2
SQL> select tablespace_name from dba_tablespaces where tablespace_name like '%TSSET%';
TABLESPACE_NAME
------------------------------
TSSET1
C007TSSET1
C008TSSET1
C009TSSET1
C00ATSSET1
C00BTSSET1
C00CTSSET1
7 rows selected.
UNDERSTANDING CHUNKS AND TABLESPACE
//Log in catalog database
//Where is sharded table
SQL> select table_name from dba_tables where tablespace_name='TSSET1';
no rows selected
//Where is duplicated table
SQL> select table_name from dba_tables where tablespace_name='TS1';
TABLE_NAME
--------------------
PRODUCTS
MLOG$_PRODUCTS
UNDERSTANDING CHUNKS AND TABLESPACE AND DATAFILE
//Log in shard node database sh1
SQL> select partition_name, tablespace_name from dba_tab_partitions where table_name='CUSTOMERS' and tablespace_name like 'C%TSSET%'
order by tablespace_name;
PARTITION_NAME TABLESPACE_NAME
-------------------- --------------------
CUSTOMERS_P1 C001TSSET1
CUSTOMERS_P2 C002TSSET1
CUSTOMERS_P3 C003TSSET1
CUSTOMERS_P4 C004TSSET1
CUSTOMERS_P5 C005TSSET1
CUSTOMERS_P6 C006TSSET1
6 rows selected.
SQL> select table_name from dba_tables where tablespace_name='TS1';
TABLE_NAME
--------------------
PRODUCTS
UNDERSTANDING CHUNKS AND TABLESPACE
//Log in shard node database sh2
SQL> select partition_name, tablespace_name from dba_tab_partitions where table_name='CUSTOMERS' and tablespace_name like 'C%TSSET%'
order by tablespace_name;
PARTITION_NAME TABLESPACE_NAME
---------------------------------------- ------------------------------
CUSTOMERS_P7 C007TSSET1
CUSTOMERS_P8 C008TSSET1
CUSTOMERS_P9 C009TSSET1
CUSTOMERS_P10 C00ATSSET1
CUSTOMERS_P11 C00BTSSET1
CUSTOMERS_P12 C00CTSSET1
6 rows selected.
SQL> select table_name from dba_tables where tablespace_name='TS1';
TABLE_NAME
--------------------
PRODUCTS
AND … DATAFILES AND TABLESPACE
//Log in shard node database sh1
SQL> select TABLESPACE_NAME,FILE_NAME from dba_data_files where TABLESPACE_NAME like
'C%TSSET%' order by tablespace_name;
TABLESPACE_NAME FILE_NAME
-------------------- ----------------------------------------------------------------------
C001TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c001tsse_d1rfod3l_.dbf
C002TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c002tsse_d1rfofj6_.dbf
C003TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c003tsse_d1rfogs5_.dbf
C004TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c004tsse_d1rfoht8_.dbf
C005TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c005tsse_d1rfojs6_.dbf
C006TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c006tsse_d1rfokv6_.dbf
6 rows selected.
RESHARDING
ROUTING OF
ORACLE SHARDING
Every shard is a part of logical database
ROUTING IN AN ORACLE SHARDED ENVIRONMENT
➤ Direct Routing
➤ For OLTP workloads that specify sharding_key (e.g. customer_id) during connect
➤ Connect string must contain: (SHARD_KEY=...)
➤ JDBC: connection.setShardKey(<shard_key>,<shard_group_key>);
➤ Support for OCI/OCCI (C++)/ODP.NET
➤ Support for PHP, Python, Perl, and Node.js
➤ Proxy Routing
➤ Multi-shard queries – e.g. reporting workloads
➤ Workloads that cannot specify sharding_key as part of connection
DIRECT ROUTING VIA SHARDING KEY
➤ The connection pool maintains a shard topology
cache=a mapping of key ranges to shards
➤ DB requests for a key in a cached range go
directly to the shard (i.e., bypasses shard
director)
➤ Or a new connection is created by forwarding
the request with the sharding key to the shard
director
Shard Key	
Ranges
Chunk	Name Shards
1	-- 10 Chunk 1 Shard	1,	Shard	2
10 -- 20 Chunk	2 Shard	1,	Shard	2
20 -- 30 Chunk	3 Shard	3,	Shard	4
30	– 40	 Chunk	4 Shard	3,	Shard	4
PROXY ROUTING VIA COORDINATOR (SHARD CATALOG)
➤ Multi-shard Queries & Non-shard Key
Access
➤ Connection is made to the coordinator
➤ Coordinator parses SQL and will

proxy/route request to correct shard
➤ SQL statements rewritten to get much
of the query processing done on the
participating shards and as little as
possible on the coordinator shard
➤ For developer convenience and not for

high performance
Coordinator	
(shard	catalog)
Application	
Server
Shard	
Directors
App Tier
Routing	Tier
Data	Tier
EXECUTION PLAN
Execution Plan
----------------------------------------------------------
Plan hash value: 2953441084
--------------------------------------------------------------
| Id | Operation | Name | Cost (%CPU)| Inst |IN-OUT|
--------------------------------------------------------------
| 0 | SELECT STATEMENT | | 0 (0)| | |
| 1 | SHARD ITERATOR | | | | |
| 2 | REMOTE | | | ORA_S~ | R->S |
--------------------------------------------------------------
Remote SQL Information (identified by operation id):
----------------------------------------------------
2 - EXPLAIN PLAN SET STATEMENT_ID='PLUS630005' INTO PLAN_TABLE@! FOR
SELECT "A1"."CUSTID" FROM "CUSTOMERS" "A1" /*
coord_sql_id=0zpg825w625yn */ (accessing
'ORA_SHARD_POOL@ORA_MULTI_TARGET' )

More Related Content

What's hot

Time for Change: Migrate your Non-RAC Database to RAC
Time for Change: Migrate your Non-RAC Database to RACTime for Change: Migrate your Non-RAC Database to RAC
Time for Change: Migrate your Non-RAC Database to RAC
Satishbabu Gunukula
 

What's hot (20)

Oracle 12c - Multitenant Feature
Oracle 12c - Multitenant FeatureOracle 12c - Multitenant Feature
Oracle 12c - Multitenant Feature
 
Oracle database 12c intro
Oracle database 12c introOracle database 12c intro
Oracle database 12c intro
 
Oracle Database 12c - New Features for Developers and DBAs
Oracle Database 12c  - New Features for Developers and DBAsOracle Database 12c  - New Features for Developers and DBAs
Oracle Database 12c - New Features for Developers and DBAs
 
Time for Change: Migrate your Non-RAC Database to RAC
Time for Change: Migrate your Non-RAC Database to RACTime for Change: Migrate your Non-RAC Database to RAC
Time for Change: Migrate your Non-RAC Database to RAC
 
Oracle GoldenGate for Oracle DBAs
Oracle GoldenGate for Oracle DBAsOracle GoldenGate for Oracle DBAs
Oracle GoldenGate for Oracle DBAs
 
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIESORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
ORACLE 12C DATA GUARD: FAR SYNC, REAL-TIME CASCADE STANDBY AND OTHER GOODIES
 
Rapid Home Provisioning
Rapid Home ProvisioningRapid Home Provisioning
Rapid Home Provisioning
 
Install oracle binaris or clonse oracle home
Install oracle binaris or clonse oracle homeInstall oracle binaris or clonse oracle home
Install oracle binaris or clonse oracle home
 
Database-Migration and -Upgrade with Transportable Tablespaces
Database-Migration and -Upgrade with Transportable TablespacesDatabase-Migration and -Upgrade with Transportable Tablespaces
Database-Migration and -Upgrade with Transportable Tablespaces
 
Oracle 12c Multitenant architecture
Oracle 12c Multitenant architectureOracle 12c Multitenant architecture
Oracle 12c Multitenant architecture
 
Oracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTSOracle 21c: New Features and Enhancements of Data Pump & TTS
Oracle 21c: New Features and Enhancements of Data Pump & TTS
 
RACAttack 12c Advanced Lab: Server Pools and Policy-managed databases
RACAttack 12c Advanced Lab: Server Pools and Policy-managed databasesRACAttack 12c Advanced Lab: Server Pools and Policy-managed databases
RACAttack 12c Advanced Lab: Server Pools and Policy-managed databases
 
Convert single instance to RAC
Convert single instance to RACConvert single instance to RAC
Convert single instance to RAC
 
Crating a Robust Performance Strategy
Crating a Robust Performance StrategyCrating a Robust Performance Strategy
Crating a Robust Performance Strategy
 
12 Things about Oracle WebLogic Server 12c
12 Things	 about Oracle WebLogic Server 12c12 Things	 about Oracle WebLogic Server 12c
12 Things about Oracle WebLogic Server 12c
 
Architecture of exadata database machine – Part II
Architecture of exadata database machine – Part IIArchitecture of exadata database machine – Part II
Architecture of exadata database machine – Part II
 
Doag data replication with oracle golden gate: Looking behind the scenes
Doag data replication with oracle golden gate: Looking behind the scenesDoag data replication with oracle golden gate: Looking behind the scenes
Doag data replication with oracle golden gate: Looking behind the scenes
 
Oracle Rac Performance Tunning Tips&Tricks
Oracle Rac Performance Tunning Tips&TricksOracle Rac Performance Tunning Tips&Tricks
Oracle Rac Performance Tunning Tips&Tricks
 
Migrating to Oracle Database 12c: 300 DBs in 300 days.
Migrating to Oracle Database 12c: 300 DBs in 300 days.Migrating to Oracle Database 12c: 300 DBs in 300 days.
Migrating to Oracle Database 12c: 300 DBs in 300 days.
 
Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?Oracle Drivers configuration for High Availability, is it a developer's job?
Oracle Drivers configuration for High Availability, is it a developer's job?
 

Viewers also liked

DataGuard_architecture
DataGuard_architectureDataGuard_architecture
DataGuard_architecture
Moeen_uddin
 

Viewers also liked (20)

Mac & Oracle
Mac & OracleMac & Oracle
Mac & Oracle
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
 
Oracle RAC 12c Release 2 - Overview
Oracle RAC 12c Release 2 - OverviewOracle RAC 12c Release 2 - Overview
Oracle RAC 12c Release 2 - Overview
 
DataGuard_architecture
DataGuard_architectureDataGuard_architecture
DataGuard_architecture
 
Virtual Directory
Virtual DirectoryVirtual Directory
Virtual Directory
 
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...
Lessons Learnt from Oracle Unified Directory implementation with Oracle E-Bus...
 
A Deep Dive into ASM Redundancy in Exadata
A Deep Dive into ASM Redundancy in ExadataA Deep Dive into ASM Redundancy in Exadata
A Deep Dive into ASM Redundancy in Exadata
 
Implementing Oracle Identity Management Using External Authentication Plug-In
Implementing Oracle Identity Management Using External Authentication Plug-InImplementing Oracle Identity Management Using External Authentication Plug-In
Implementing Oracle Identity Management Using External Authentication Plug-In
 
Oracle database 12c 2 day + real application clusters guide
Oracle database 12c 2 day + real application clusters guideOracle database 12c 2 day + real application clusters guide
Oracle database 12c 2 day + real application clusters guide
 
12 Things About WebLogic 12.1.3 #oow2014 #otnla15
12 Things About WebLogic 12.1.3 #oow2014 #otnla1512 Things About WebLogic 12.1.3 #oow2014 #otnla15
12 Things About WebLogic 12.1.3 #oow2014 #otnla15
 
Oracle rac cachefusion - High Availability Day 2015
Oracle rac cachefusion - High Availability Day 2015Oracle rac cachefusion - High Availability Day 2015
Oracle rac cachefusion - High Availability Day 2015
 
MongoDB
MongoDBMongoDB
MongoDB
 
Cloud conference - mongodb
Cloud conference - mongodbCloud conference - mongodb
Cloud conference - mongodb
 
Aman sharma hyd_12crac High Availability Day 2015
Aman sharma hyd_12crac High Availability Day 2015Aman sharma hyd_12crac High Availability Day 2015
Aman sharma hyd_12crac High Availability Day 2015
 
Oracle ORAchk - An Overview Guide to Oracle Stack Health Checks
Oracle ORAchk - An Overview Guide to Oracle Stack Health ChecksOracle ORAchk - An Overview Guide to Oracle Stack Health Checks
Oracle ORAchk - An Overview Guide to Oracle Stack Health Checks
 
RACATTACK Lab Handbook - Enable Flex Cluster and Flex ASM
RACATTACK Lab Handbook - Enable Flex Cluster and Flex ASMRACATTACK Lab Handbook - Enable Flex Cluster and Flex ASM
RACATTACK Lab Handbook - Enable Flex Cluster and Flex ASM
 
Database Sharding the Right Way: Easy, Reliable, and Open source - HighLoad++...
Database Sharding the Right Way: Easy, Reliable, and Open source - HighLoad++...Database Sharding the Right Way: Easy, Reliable, and Open source - HighLoad++...
Database Sharding the Right Way: Easy, Reliable, and Open source - HighLoad++...
 
Spark Application for Time Series Analysis
Spark Application for Time Series AnalysisSpark Application for Time Series Analysis
Spark Application for Time Series Analysis
 
Oracle RAC on Extended Distance Clusters - Presentation
Oracle RAC on Extended Distance Clusters - PresentationOracle RAC on Extended Distance Clusters - Presentation
Oracle RAC on Extended Distance Clusters - Presentation
 
Flex Your Database on 12c's Flex ASM and Flex Cluster
Flex Your Database on 12c's Flex ASM and Flex ClusterFlex Your Database on 12c's Flex ASM and Flex Cluster
Flex Your Database on 12c's Flex ASM and Flex Cluster
 

Similar to Oracle 12.2 sharding learning more

11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
Karam Abuataya
 
Scaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersScaling MySQL Strategies for Developers
Scaling MySQL Strategies for Developers
Jonathan Levin
 

Similar to Oracle 12.2 sharding learning more (20)

SequoiaDB Distributed Relational Database
SequoiaDB Distributed Relational DatabaseSequoiaDB Distributed Relational Database
SequoiaDB Distributed Relational Database
 
Spark streaming
Spark streamingSpark streaming
Spark streaming
 
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
Apache Spark - Dataframes & Spark SQL - Part 1 | Big Data Hadoop Spark Tutori...
 
Riak add presentation
Riak add presentationRiak add presentation
Riak add presentation
 
Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!Pluggable Databases: What they will break and why you should use them anyway!
Pluggable Databases: What they will break and why you should use them anyway!
 
Oracle goldengate 11g schema replication from standby database
Oracle goldengate 11g schema replication from standby databaseOracle goldengate 11g schema replication from standby database
Oracle goldengate 11g schema replication from standby database
 
Spark Programming
Spark ProgrammingSpark Programming
Spark Programming
 
RocksDB Performance and Reliability Practices
RocksDB Performance and Reliability PracticesRocksDB Performance and Reliability Practices
RocksDB Performance and Reliability Practices
 
Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.Distributed Queries in IDS: New features.
Distributed Queries in IDS: New features.
 
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
Big Data Day LA 2015 - Compiling DSLs for Diverse Execution Environments by Z...
 
Spark And Cassandra: 2 Fast, 2 Furious
Spark And Cassandra: 2 Fast, 2 FuriousSpark And Cassandra: 2 Fast, 2 Furious
Spark And Cassandra: 2 Fast, 2 Furious
 
Spark and Cassandra 2 Fast 2 Furious
Spark and Cassandra 2 Fast 2 FuriousSpark and Cassandra 2 Fast 2 Furious
Spark and Cassandra 2 Fast 2 Furious
 
My SQL Skills Killed the Server
My SQL Skills Killed the ServerMy SQL Skills Killed the Server
My SQL Skills Killed the Server
 
Sql killedserver
Sql killedserverSql killedserver
Sql killedserver
 
SQL on Hadoop
SQL on HadoopSQL on Hadoop
SQL on Hadoop
 
11thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp0111thingsabout11g 12659705398222 Phpapp01
11thingsabout11g 12659705398222 Phpapp01
 
11 Things About11g
11 Things About11g11 Things About11g
11 Things About11g
 
Introduction to Spark with Python
Introduction to Spark with PythonIntroduction to Spark with Python
Introduction to Spark with Python
 
iceberg introduction.pptx
iceberg introduction.pptxiceberg introduction.pptx
iceberg introduction.pptx
 
Scaling MySQL Strategies for Developers
Scaling MySQL Strategies for DevelopersScaling MySQL Strategies for Developers
Scaling MySQL Strategies for Developers
 

More from Leyi (Kamus) Zhang (9)

Vim - Amazing Editor for DBAs
Vim - Amazing Editor for DBAsVim - Amazing Editor for DBAs
Vim - Amazing Editor for DBAs
 
Hanganalyze presentation
Hanganalyze presentationHanganalyze presentation
Hanganalyze presentation
 
Vldb Statistics Gathering Strategy
Vldb Statistics Gathering StrategyVldb Statistics Gathering Strategy
Vldb Statistics Gathering Strategy
 
Exadata
ExadataExadata
Exadata
 
Kamus silde for summit
Kamus silde for summitKamus silde for summit
Kamus silde for summit
 
Oracle Resource Manager
Oracle Resource ManagerOracle Resource Manager
Oracle Resource Manager
 
Understanding histogramppt.prn
Understanding histogramppt.prnUnderstanding histogramppt.prn
Understanding histogramppt.prn
 
数据库性能诊断的七种武器
数据库性能诊断的七种武器数据库性能诊断的七种武器
数据库性能诊断的七种武器
 
DTCC Rac Load Balancing Failover
DTCC Rac Load Balancing FailoverDTCC Rac Load Balancing Failover
DTCC Rac Load Balancing Failover
 

Recently uploaded

Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
panagenda
 

Recently uploaded (20)

TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data DiscoveryTrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
TrustArc Webinar - Unlock the Power of AI-Driven Data Discovery
 
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost SavingRepurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
Repurposing LNG terminals for Hydrogen Ammonia: Feasibility and Cost Saving
 
Exploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone ProcessorsExploring the Future Potential of AI-Enabled Smartphone Processors
Exploring the Future Potential of AI-Enabled Smartphone Processors
 
Why Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire businessWhy Teams call analytics are critical to your entire business
Why Teams call analytics are critical to your entire business
 
Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024Axa Assurance Maroc - Insurer Innovation Award 2024
Axa Assurance Maroc - Insurer Innovation Award 2024
 
GenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdfGenAI Risks & Security Meetup 01052024.pdf
GenAI Risks & Security Meetup 01052024.pdf
 
presentation ICT roal in 21st century education
presentation ICT roal in 21st century educationpresentation ICT roal in 21st century education
presentation ICT roal in 21st century education
 
A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)A Domino Admins Adventures (Engage 2024)
A Domino Admins Adventures (Engage 2024)
 
Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024Partners Life - Insurer Innovation Award 2024
Partners Life - Insurer Innovation Award 2024
 
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, AdobeApidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
Apidays New York 2024 - Scaling API-first by Ian Reasor and Radu Cotescu, Adobe
 
How to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected WorkerHow to Troubleshoot Apps for the Modern Connected Worker
How to Troubleshoot Apps for the Modern Connected Worker
 
AWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of TerraformAWS Community Day CPH - Three problems of Terraform
AWS Community Day CPH - Three problems of Terraform
 
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
Apidays New York 2024 - The Good, the Bad and the Governed by David O'Neill, ...
 
Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...Apidays New York 2024 - The value of a flexible API Management solution for O...
Apidays New York 2024 - The value of a flexible API Management solution for O...
 
Strategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a FresherStrategies for Landing an Oracle DBA Job as a Fresher
Strategies for Landing an Oracle DBA Job as a Fresher
 
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
Connector Corner: Accelerate revenue generation using UiPath API-centric busi...
 
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin WoodPolkadot JAM Slides - Token2049 - By Dr. Gavin Wood
Polkadot JAM Slides - Token2049 - By Dr. Gavin Wood
 
Data Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt RobisonData Cloud, More than a CDP by Matt Robison
Data Cloud, More than a CDP by Matt Robison
 
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot TakeoffStrategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
Strategize a Smooth Tenant-to-tenant Migration and Copilot Takeoff
 
Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)Powerful Google developer tools for immediate impact! (2023-24 C)
Powerful Google developer tools for immediate impact! (2023-24 C)
 

Oracle 12.2 sharding learning more

  • 2. ABOUT ME ➤ Kamus@Enmotech 张乐奕 ➤ Travel and Starbucks ➤ Travel: Japan ➤ Starbucks: Venti Caramel Macchiato ➤ Games: Blizzard fans, Hearthstone ➤ Channel[K]: http://www.dbform.com
  • 3. WHAT IS ORACLESHARDING Every shard is a part of logical database
  • 4. WHAT IS SHARDING EXACTLY //Query single row select User_Name from T1 where User_ID=1; //Query all create view T as select * from T1 union all select * from T2; select count(*) from T; Database “DB” Database “DB” Split Table Table “T” User_ID User_Name 1 Kim 2 Tim 3 Jim 4 Sim Table “T1” User_ID User_Name 1 Kim 3 Jim Table “T2” User_ID User_Name 2 Tim 4 Sim
  • 5. WHAT IS SHARDING EXACTLY //Query single row select User_Name from T where User_ID=1; //Query all select count(*) from T; Database “DB” Database “DB” Partition Table Table “T” User_ID User_Name 1 Kim 2 Tim 3 Jim 4 Sim Partition “P1” User_ID User_Name 1 Kim 3 Jim Partition“P2” User_ID User_Name 2 Tim 4 Sim Table “T”
  • 6. WHAT IS SHARDING EXACTLY //Query single row select User_Name from T where User_ID=1; //Query all select count(*) from T; Database “DB” Database “DB1” Shard Table Table “T” User_ID User_Name 1 Kim 2 Tim 3 Jim 4 Sim Shard “S1” User_ID User_Name 1 Kim 3 Jim Shard “S2” User_ID User_Name 2 Tim 4 Sim Database “DB2” Table “T”
  • 7. ➤ Greater scalability and fault isolation than possible with RAC ➤ Large billing systems ➤ Airline ticketing systems ➤ Online financial services ➤ Media companies ➤ Online information services ➤ Social media companies WHICH SYSTEM WILL NEED SHARDING? 0 100000 200000 300000 400000 500000 600000 700000 800000 900000 1000000 OLTP Throughput
  • 8. APPLICATION DESIGNED FOR SHARDING ➤ Sharding is not application transparent ➤ Application must specify a sharding key for optimal performance ➤ e.g. customer_id, account_id etc ➤ Primary usage pattern ➤ Direct routing to a shard based on sharding key ➤ Single-shard operations for highest performance ➤ Ancillary usage pattern ➤ Proxy routing for multi-shard queries (reporting) ➤ Able to tolerate lesser performance than direct routing used for single-shard operations
  • 9. HOW LINKEDIN USE ORACLE SHARDING Copy of Slide from Oracle Corp.
  • 10. SHARDING ARCHITECTURE: LINKEDIN Copy of Slide from Oracle Corp.
  • 11. DEPLOYMENT OF ORACLE SHARDING Every shard is a part of logical database
  • 12. DEPLOYMENT OF A SYSTEM-MANAGED SDB
  • 13. SIMPLE ENV FOR TESTING shard director + shard catalog shard node1, shard node2
  • 14. SDB DEPLOYMENT OVERVIEW ➤ 1.Oracle Sharding Prerequisites ➤ 2.Installing Oracle Database Software (database) ➤ 3.Installing the Shard Director Software (gsm) ➤ 4.Installing schagent in all Shard Node (database) ➤ 4.Creating the Shard Catalog Database (dbca) ➤ 5.Setting Up the Oracle Sharding Management and GDS ➤ 6.Deploying and Managing a System-Managed SDB (gdsctl) https://oracleblog.org/working-case/deployoracle-sharding-database/ 创建Oracle sharding database - ⼩荷OracleBlog 天堂向左,DBA向右
  • 15. REQUIRED MEDIA ➤ database.zip, gsm.zip db software, for shardcat database db software on every shard node GDS framework and GSM service Scheduler Agent on shard node
  • 16. ORACLE SHARDING PREREQUISITES ➤ 12.2 Enterprise Edition ➤ Non-cdb ➤ Filesystem, no ASM (12.2 Beta) ➤ every shard node IP resolved in every node’s hosts file ➤ A whole new machine without any Oracle software preinstallation
  • 17. WHAT DOES DEPLOY DO? ➤ Creates shards and listeners ➤ DBMS_SCHEDULER package (executed on shard catalog) communicates with Scheduler Agents on remote hosts ➤ Agents run DBCA and NETCA to create shards and listeners ➤ Creates the Data Guard configuration ➤ Primaries are created first, RMAN duplicate is used to create corresponding standbys ➤ Redo transport and broker are configured, observers are started on shard director hosts and Fast-Start Failover is enabled ➤ Optionally, deploys GoldenGate bi-directional replication (OGG 12.3) ➤ Replication pipelines are configured and replication is started
  • 18. CENTRALIZED SCHEMA MANAGEMENT connect to GDS$CATALOG service alter session enable shard ddl; create tablespace set … create tablespace … create user ... create sharded table … tablespace set Create duplicated table … tablespace Shard Director Shard 1 Shard 2 Shard n Shard Catalog
  • 19. UNDERSTANDING CHUNKS AND TABLESPACE ➤ Chunk is the Unit of Data Movement in a Sharded Database ➤ Simple form: 1 chunk = 1 tablespace = 1 datafile ➤ The number of chunks is defined during the creation of shard catalog
  • 20. UNDERSTANDING CHUNKS AND TABLESPACE //Log in GSM GDSCTL>config chunks Chunks ------------------------ Database From To -------- ---- -- sh1 1 6 sh2 7 12
  • 21. UNDERSTANDING CHUNKS AND TABLESPACE //Log in shard node database sh1 SQL> select tablespace_name from dba_tablespaces where tablespace_name like '%TSSET%'; TABLESPACE_NAME -------------------- TSSET1 C001TSSET1 C002TSSET1 C003TSSET1 C004TSSET1 C005TSSET1 C006TSSET1 7 rows selected.
  • 22. UNDERSTANDING CHUNKS AND TABLESPACE //Log in shard node database sh2 SQL> select tablespace_name from dba_tablespaces where tablespace_name like '%TSSET%'; TABLESPACE_NAME ------------------------------ TSSET1 C007TSSET1 C008TSSET1 C009TSSET1 C00ATSSET1 C00BTSSET1 C00CTSSET1 7 rows selected.
  • 23. UNDERSTANDING CHUNKS AND TABLESPACE //Log in catalog database //Where is sharded table SQL> select table_name from dba_tables where tablespace_name='TSSET1'; no rows selected //Where is duplicated table SQL> select table_name from dba_tables where tablespace_name='TS1'; TABLE_NAME -------------------- PRODUCTS MLOG$_PRODUCTS
  • 24. UNDERSTANDING CHUNKS AND TABLESPACE AND DATAFILE //Log in shard node database sh1 SQL> select partition_name, tablespace_name from dba_tab_partitions where table_name='CUSTOMERS' and tablespace_name like 'C%TSSET%' order by tablespace_name; PARTITION_NAME TABLESPACE_NAME -------------------- -------------------- CUSTOMERS_P1 C001TSSET1 CUSTOMERS_P2 C002TSSET1 CUSTOMERS_P3 C003TSSET1 CUSTOMERS_P4 C004TSSET1 CUSTOMERS_P5 C005TSSET1 CUSTOMERS_P6 C006TSSET1 6 rows selected. SQL> select table_name from dba_tables where tablespace_name='TS1'; TABLE_NAME -------------------- PRODUCTS
  • 25. UNDERSTANDING CHUNKS AND TABLESPACE //Log in shard node database sh2 SQL> select partition_name, tablespace_name from dba_tab_partitions where table_name='CUSTOMERS' and tablespace_name like 'C%TSSET%' order by tablespace_name; PARTITION_NAME TABLESPACE_NAME ---------------------------------------- ------------------------------ CUSTOMERS_P7 C007TSSET1 CUSTOMERS_P8 C008TSSET1 CUSTOMERS_P9 C009TSSET1 CUSTOMERS_P10 C00ATSSET1 CUSTOMERS_P11 C00BTSSET1 CUSTOMERS_P12 C00CTSSET1 6 rows selected. SQL> select table_name from dba_tables where tablespace_name='TS1'; TABLE_NAME -------------------- PRODUCTS
  • 26. AND … DATAFILES AND TABLESPACE //Log in shard node database sh1 SQL> select TABLESPACE_NAME,FILE_NAME from dba_data_files where TABLESPACE_NAME like 'C%TSSET%' order by tablespace_name; TABLESPACE_NAME FILE_NAME -------------------- ---------------------------------------------------------------------- C001TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c001tsse_d1rfod3l_.dbf C002TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c002tsse_d1rfofj6_.dbf C003TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c003tsse_d1rfogs5_.dbf C004TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c004tsse_d1rfoht8_.dbf C005TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c005tsse_d1rfojs6_.dbf C006TSSET1 /u01/app/oracle/oradata/SH1/datafile/o1_mf_c006tsse_d1rfokv6_.dbf 6 rows selected.
  • 28. ROUTING OF ORACLE SHARDING Every shard is a part of logical database
  • 29. ROUTING IN AN ORACLE SHARDED ENVIRONMENT ➤ Direct Routing ➤ For OLTP workloads that specify sharding_key (e.g. customer_id) during connect ➤ Connect string must contain: (SHARD_KEY=...) ➤ JDBC: connection.setShardKey(<shard_key>,<shard_group_key>); ➤ Support for OCI/OCCI (C++)/ODP.NET ➤ Support for PHP, Python, Perl, and Node.js ➤ Proxy Routing ➤ Multi-shard queries – e.g. reporting workloads ➤ Workloads that cannot specify sharding_key as part of connection
  • 30. DIRECT ROUTING VIA SHARDING KEY ➤ The connection pool maintains a shard topology cache=a mapping of key ranges to shards ➤ DB requests for a key in a cached range go directly to the shard (i.e., bypasses shard director) ➤ Or a new connection is created by forwarding the request with the sharding key to the shard director Shard Key Ranges Chunk Name Shards 1 -- 10 Chunk 1 Shard 1, Shard 2 10 -- 20 Chunk 2 Shard 1, Shard 2 20 -- 30 Chunk 3 Shard 3, Shard 4 30 – 40 Chunk 4 Shard 3, Shard 4
  • 31. PROXY ROUTING VIA COORDINATOR (SHARD CATALOG) ➤ Multi-shard Queries & Non-shard Key Access ➤ Connection is made to the coordinator ➤ Coordinator parses SQL and will
 proxy/route request to correct shard ➤ SQL statements rewritten to get much of the query processing done on the participating shards and as little as possible on the coordinator shard ➤ For developer convenience and not for
 high performance Coordinator (shard catalog) Application Server Shard Directors App Tier Routing Tier Data Tier
  • 32. EXECUTION PLAN Execution Plan ---------------------------------------------------------- Plan hash value: 2953441084 -------------------------------------------------------------- | Id | Operation | Name | Cost (%CPU)| Inst |IN-OUT| -------------------------------------------------------------- | 0 | SELECT STATEMENT | | 0 (0)| | | | 1 | SHARD ITERATOR | | | | | | 2 | REMOTE | | | ORA_S~ | R->S | -------------------------------------------------------------- Remote SQL Information (identified by operation id): ---------------------------------------------------- 2 - EXPLAIN PLAN SET STATEMENT_ID='PLUS630005' INTO PLAN_TABLE@! FOR SELECT "A1"."CUSTID" FROM "CUSTOMERS" "A1" /* coord_sql_id=0zpg825w625yn */ (accessing 'ORA_SHARD_POOL@ORA_MULTI_TARGET' )