SlideShare a Scribd company logo
2
Most read
3
Most read
4
Most read
Oracle 12c Sharding
Part 2 – Installation & Configuration
Shared catalog
db1
db2
SDB
Connection
Pool Search
Distributed
Metadata
The requested
data is
distributed to
shard1 – db1
Select
custid,customernum
ner,product,qty
from
customer_orders
where
cust_id=11030;
Takes the hash key
of this customer id
Global
Service
Shard Director
Customer_orders Partition1
Customer_orders Partition2
Oracle Sharding Architecture (12c R2)
1521
shard2
1521
shard1
1521
Primary
Primary
db1
db2
Customer_orders Partition1
Customer_orders Partition2
shard2
shard1
Standby
Standby
High Availability
Dataguard
Broder
Dataguard
Broder
Configuring Oracle Sharding – Environment Planning
Node Type IP Address Home Ports DB Name Scheduler Agent
Shard
Catalog
Node
192.168.56.150
Host: shardcat
Oracle Home: /u01/app/oracle/12.2.0.1/db_1
GSM home: /u01/app/oracle/12.2.0.1/GSM
GSM Listener 1539
DB Listener 1521
SCAT
Shard1 192.168.56.151
Host: shard1
Oracle Home: /u01/app/oracle/12.2.0.1/db_1 DB Listener 1521 sh1 Scheduler Agent -
Shard2 192.168.56.152
Host: shard2
Oracle Home: /u01/app/oracle/12.2.0.1/db_1 DB Listener 1521 sh2 Scheduler Agent -
Steps to Configure Oracle Sharding
Step Nodes/Hosts Step Details
1 shardcat/Shard1/Shard2 Install Oracle Software Only 12cR2 – Preferably Same Location
2 shardcat Create Database SCAT using DBCA (NON CDB)
3 shardcat Install GSM Software as Separate Home
4 shardcat Create Environment Setup
5 Shardcat Prepare SCAT database for Sharding - Prerequisities
6 shardcat Configure Shard Catalog using GSDCTL – Create Shard Catalog in SCAT
7 shard1/shard2 Start the SCH Agent & Register Shard nodes to SCAT database
8 shardcat Create Shard Group/Director/Add Shards
9 shardcat Deploy Shards using GSDCTL – This will eventually create databases in shard1/shard2
10 shardcat Verify Shard Configuration
11 shardcat Create Global Service using GSDCTL
12 shardcat Create sample schema and Tablespace set and see that propagate to shard1/shard2
13 shardcat Connect to sample schema and create shard table
14 Shardcat/shard1/shard2 Verify the sample table is created across shards
Step 1 : Install Oracle 12c R2 Software
• Install Oracle 12cR2 Software on all three nodes shardcat/shard1/shard2
• Complete Pre-requisities
• Install with Software only option
• Sample options to change in <softwarelocation>/response/db_install.rsp
oracle.install.option=INSTALL_DB_SWONLY
ORACLE_HOSTNAME=Geek DBA11g
UNIX_GROUP_NAME=oinstall
INVENTORY_LOCATION=/u02/app/oraInventory
ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1
ORACLE_BASE=/u01/app/oracle
oracle.install.db.InstallEdition=EE
oracle.install.db.DBA_GROUP=dba
oracle.install.db.OPER_GROUP=oper
oracle.install.db.BACKUPDBA_GROUP=dba
oracle.install.db.DGDBA_GROUP=asmadmin
oracle.install.db.KMDBA_GROUP=dba
SECURITY_UPDATES_VIA_MYORACLESUPPORT=false
DECLINE_SECURITY_UPDATES=true
• Create Oracle Home Directories
mkdir -p /u01/app/oracle/product/12.1.0/db_1
mkdir -p /u02/app/oraInventory
chown -R oracle:oinstall /u02/app/oraInventory
• Sample Run Installer Command
./runInstaller -silent -ignoresysprereqs -responsefile /home/oracle/database/response/db_install.rsp
Step 2: Create ShardCatalog Database
On shardcat Node:-
• Create Directories
mkdir –p /u01/app/oracle/flash_recover_area/SCAT
mkdir –p /u01/app/oracle/fast_recovery_area/SCAT
mkdir –p /u01/oradata/SCAT
mkdir –p /u01/app/oracle/admin/SCAT/adump
• Run DBCA
./dbca -silent 
-createDatabase 
-templateName General_Purpose.dbc 
-gdbName SCAT 
-sid SCAT 
-SysPassword ****
-createAsContainerDatabase false
-SystemPassword ***
-emConfiguration NONE
-redoLogFileSize 100 
-recoveryAreaDestination /u01/app/oracle/SCAT 
-DatafileDestination /u01/app/oracle/SCAT
-storageType FS 
-listeners LISTENER12 
-registerWithDirService false 
-characterSet AL32UTF8 
-nationalCharacterSet AL16UTF16 
-databaseType MULTIPURPOSE 
-memoryPercentage 40 
-memoryType AUTO
Step 3: Install GSM Software in Shardcat
On Shardcat Node:-
• Download from Oracle Downloads page or Edelivery.oracle.com
• Unzip the GSM Software
• Install as separate Home
Step 4: Create Environment Setup in Shardcat
Step 5 : Prepare SCAT database for Sharding - Prerequisities
On Shardcat : SCAT Database
alter system set db_create_file_dest='/u01/ora12c/app/oracle/oradata' scope=both;
alter system set open_links=16 scope=spfile;
alter system set open_links_per_instance=16 scope=spfile;
startup force
alter user gsmcatuser account unlock;
alter user gsmcatuser identified by oracle;
CREATE USER mygdsadmin IDENTIFIED BY oracle;
GRANT connect, create session, gsmadmin_role to mygdsadmin;
grant inherit privileges on user SYS to GSMADMIN_INTERNAL;
execute dbms_xdb.sethttpport(8080);
commit;
@?/rdbms/admin/prvtrsch.plb
exec DBMS_SCHEDULER.SET_AGENT_REGISTRATION_PASS('oracleagent');
Step 6:– Create Shard Catalog in SCAT
On Shardcat node, in SCAT Database & Set environment to GSM Home
# gdsctl
GDSCTL> create shardcatalog -database shardcat:1521:SCAT -chunks 12 -user mygdsadmin/oracle -sdb SCAT -region region1
GDSCTL>add gsm -gsm sharddirector1 -listener 1571 -pwd oracle -catalog shardcat:1521:SCAT -region region1
GDSCTL>start gsm -gsm sharddirector1
GDSCTL>add credential -credential oracle_cred -osaccount oracle -ospassword ****
GDSCTL> exit
Step 7: Start the Scheduler Agent on Shard Nodes
On Shard1 & 2 :
Scheduler Agent is already installed if you install oracle database software just start it
#Set Oracle Home
#schagent start
#schagent status
# echo oracleagent | schagent –resiterdatabase shardcat 8080  provide name of host not database
Step 8 : Create Shard Group/Director/Add Shards
GDSCTL>set gsm -gsm sharddirector1
GDSCTL>connect mygdsadmin/oracle
Catalog connection is established
GDSCTL>-- add shard group
GDSCTL>add shardgroup -shardgroup primary_shardgroup -deploy_as primary -region region1
The operation completed successfully
GDSCTL>-- add shard1
GDSCTL>add invitednode shard1
GDSCTL>create shard -shardgroup primary_shardgroup -destination shard1 -credential oracle_cred
DB Unique Name: sh1
GDSCTL> --add shard2
GDSCTL>add invitednode shard2
GDSCTL>create shard -shardgroup primary_shardgroup -destination shard2 -credential oracle_cred
DB Unique Name: sh2
Step 8 : Deploy Shards
• In shardcat node, using
gsdctl, run
gsdctl> deploy
Note: This will create the
databases in shard1 and
shard2 using dbca and create
listeners automatically
Step 10: Verify Shard Status
Step 11 : Create Global Service using GSDCTL
Using GDSCTL on shardcat
gdsctl> add service –service test_srv –role primar
gdsctl> config service
gdsctl> start service
gdsctl> status service
Step 12: Create sample schema and Tablespace
set and see that propagate to shard1/shard2
#[oracle12c@sdb1 ~]$ db_env
Sqlplus / as sysdba
alter session enable shard ddl;
create user app_schema identified by oracle;
grant all privileges to app_schema;
grant gsmadmin_role to app_schema;
grant select_catalog_role to app_schema;
grant connect, resource to app_schema;
grant dba to app_schema;
grant execute on dbms_crypto to app_schema;
#Create Sharded Tablespace & Test out
conn app_schema/oracle
alter session enable shard ddl;
CREATE TABLESPACE SET TSP_SET_1 using template (datafile size 100m extent management local segment space management auto );
CREATE TABLESPACE products_tsp datafile size 100m extent management local uniform size 1m;
Note: For any command that need to be shard, you must enable shard ddl at session level before running the sql command
Step 13: Create Shard Tables
Step 14: Verify Distribution of Tables to shards
• On Shard Catalog SDB Database
Step 14: Verify Distribution of Tables to Shards
On Shard1, SH1 database the customer table is partitioned and
some of the partitions created here
On Shard2, SH2 database the customer table is partitioned and
some of the partitions created here
Thanks
• In Next Post/Presentation we will be seeing
• Managing Shards
• Adding / Deleting Shards
• Verify Data Distribution
• Shard Restrictions

More Related Content

What's hot (20)

PDF
Snowflake free trial_lab_guide
slidedown1
 
PDF
Oracle MAA (Maximum Availability Architecture) 18c - An Overview
Markus Michalewicz
 
PPTX
Fast Start Failover DataGuard
Borsaniya Vaibhav
 
PPTX
Optimizing Alert Monitoring with Oracle Enterprise Manager
Datavail
 
PPT
Sql injection
Nitish Kumar
 
PDF
Oracle Client Failover - Under The Hood
Ludovico Caldara
 
PPTX
High Availability & Disaster Recovery with SQL Server 2012 AlwaysOn Availabil...
turgaysahtiyan
 
PDF
MySQL Monitoring with Zabbix
FromDual GmbH
 
PDF
From Query Plan to Query Performance: Supercharging your Apache Spark Queries...
Databricks
 
PDF
Oracle Database performance tuning using oratop
Sandesh Rao
 
PPT
Oracle backup and recovery
Yogiji Creations
 
PDF
MySQL Group Replication: Handling Network Glitches - Best Practices
Frederic Descamps
 
PPT
Oracle Transparent Data Encryption (TDE) 12c
Nabeel Yoosuf
 
PPSX
Oracle Performance Tools of the Trade
Carlos Sierra
 
PDF
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz
 
PDF
Using Release(deallocate) and Painful Lessons to be learned on DB2 locking
John Campbell
 
PDF
Using Vault to decouple MySQL Secrets
Derek Downey
 
PDF
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder
 
PDF
Advanced SQL injection to operating system full control (whitepaper)
Bernardo Damele A. G.
 
PPT
Oracle Architecture
Neeraj Singh
 
Snowflake free trial_lab_guide
slidedown1
 
Oracle MAA (Maximum Availability Architecture) 18c - An Overview
Markus Michalewicz
 
Fast Start Failover DataGuard
Borsaniya Vaibhav
 
Optimizing Alert Monitoring with Oracle Enterprise Manager
Datavail
 
Sql injection
Nitish Kumar
 
Oracle Client Failover - Under The Hood
Ludovico Caldara
 
High Availability & Disaster Recovery with SQL Server 2012 AlwaysOn Availabil...
turgaysahtiyan
 
MySQL Monitoring with Zabbix
FromDual GmbH
 
From Query Plan to Query Performance: Supercharging your Apache Spark Queries...
Databricks
 
Oracle Database performance tuning using oratop
Sandesh Rao
 
Oracle backup and recovery
Yogiji Creations
 
MySQL Group Replication: Handling Network Glitches - Best Practices
Frederic Descamps
 
Oracle Transparent Data Encryption (TDE) 12c
Nabeel Yoosuf
 
Oracle Performance Tools of the Trade
Carlos Sierra
 
Nabil Nawaz Oracle Oracle 12c Data Guard Deep Dive Presentation
Nabil Nawaz
 
Using Release(deallocate) and Painful Lessons to be learned on DB2 locking
John Campbell
 
Using Vault to decouple MySQL Secrets
Derek Downey
 
Tanel Poder - Performance stories from Exadata Migrations
Tanel Poder
 
Advanced SQL injection to operating system full control (whitepaper)
Bernardo Damele A. G.
 
Oracle Architecture
Neeraj Singh
 

Viewers also liked (20)

PDF
Oracle 12.2 sharded database management
Leyi (Kamus) Zhang
 
PDF
Oracle 12.2 sharding learning more
Leyi (Kamus) Zhang
 
PDF
Oracle 12c New Features
Guatemala User Group
 
KEY
Mac & Oracle
Leyi (Kamus) Zhang
 
PPTX
La transformacion digital en nuestra vida cotidiana. Un vistazo a las APIs
Guatemala User Group
 
PDF
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Markus Michalewicz
 
DOCX
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Yury Velikanov
 
PDF
Oracle RAC 12c Release 2 - Overview
Markus Michalewicz
 
ODP
How we setup Rsync-powered Incremental Backups
nicholaspaun
 
ODP
Barcamp Gent 2: rsnapshot
Peter Dedecker
 
PDF
Deduplication and single instance storage
Interop
 
PDF
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Zhaoyang Wang
 
PPT
Text mode Linux Installation Part 01
Subhasis Nayak
 
PDF
154090896 installation-of-oracle-database-12c
Venkatesh Ramiya Krishnamoorthy
 
DOCX
Installation of oracle 12c RAC on linux vm
Ron Morgan
 
PDF
Step by Step Installation of Oracle11gR2 on OEL5 and VMware
Jorge Batista
 
PPT
Installing Linux CentOs 5.0 Step-by-Step
Mehdi Poustchi Amin
 
PDF
Sap r3 installation on windows oracle database
ricardopabloasensio
 
PDF
Weblogic 12c installation (oracle linux)
Osama Mustafa
 
Oracle 12.2 sharded database management
Leyi (Kamus) Zhang
 
Oracle 12.2 sharding learning more
Leyi (Kamus) Zhang
 
Oracle 12c New Features
Guatemala User Group
 
Mac & Oracle
Leyi (Kamus) Zhang
 
La transformacion digital en nuestra vida cotidiana. Un vistazo a las APIs
Guatemala User Group
 
Oracle RAC 12c (12.1.0.2) Operational Best Practices - A result of true colla...
Markus Michalewicz
 
Oracle 12c RAC On your laptop Step by Step Implementation Guide 1.0
Yury Velikanov
 
Oracle RAC 12c Release 2 - Overview
Markus Michalewicz
 
How we setup Rsync-powered Incremental Backups
nicholaspaun
 
Barcamp Gent 2: rsnapshot
Peter Dedecker
 
Deduplication and single instance storage
Interop
 
Oracle enterprise manager cloud control 12c release 5 installation on oracle ...
Zhaoyang Wang
 
Text mode Linux Installation Part 01
Subhasis Nayak
 
154090896 installation-of-oracle-database-12c
Venkatesh Ramiya Krishnamoorthy
 
Installation of oracle 12c RAC on linux vm
Ron Morgan
 
Step by Step Installation of Oracle11gR2 on OEL5 and VMware
Jorge Batista
 
Installing Linux CentOs 5.0 Step-by-Step
Mehdi Poustchi Amin
 
Sap r3 installation on windows oracle database
ricardopabloasensio
 
Weblogic 12c installation (oracle linux)
Osama Mustafa
 
Ad

Similar to Oracle sharding : Installation & Configuration (20)

PPTX
Using oracle12c pluggable databases to archive
Secure-24
 
DOCX
Installing 12c R1 database on oracle linux
Anar Godjaev
 
PDF
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Osama Mustafa
 
PDF
Database Cloud Services Office Hours : Oracle sharding hyperscale globally d...
Tammy Bednar
 
PDF
UKOUG Tech15 - Deploying Oracle 12c Cloud Control in Maximum Availability Arc...
Zahid Anwar (OCM)
 
PDF
Oracle RAC 12c Best Practices with Appendices DOAG2013
Markus Michalewicz
 
PDF
Oracle bi 10g_install_migration
Mlx Le
 
DOCX
Oracle 12cR2 RAC Database Software Installation and Create Database
Monowar Mukul
 
PDF
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Markus Michalewicz
 
PDF
2017 10-oow-fma-application-containers-v01-final
Markus Flechtner
 
PDF
Oracle Application Containers
Markus Flechtner
 
PDF
Oracle RAC 12c Best Practices Sanger OOW13 [CON8805]
Markus Michalewicz
 
PDF
Cdb part i
DerejeBalcha7
 
PDF
Exploring Oracle Multitenant in Oracle Database 12c
Zohar Elkayam
 
PDF
Oracle 12c PDB insights
Kirill Loifman
 
PDF
Database-as-a-Service with Oracle Enterprise Manager Cloud Control 12c and Or...
Leighton Nelson
 
PDF
Introduction to MySQL Cluster
Abel Flórez
 
PDF
Oracle cluster installation with grid and nfs
Chanaka Lasantha
 
DOCX
Oracle 12cR2 Grid Infrastructure Installation
Monowar Mukul
 
PDF
Create non-cdb (traditional) oracle database 12c on windows
Biju Thomas
 
Using oracle12c pluggable databases to archive
Secure-24
 
Installing 12c R1 database on oracle linux
Anar Godjaev
 
Step by Step to Install oracle grid 11.2.0.3 on solaris 11.1
Osama Mustafa
 
Database Cloud Services Office Hours : Oracle sharding hyperscale globally d...
Tammy Bednar
 
UKOUG Tech15 - Deploying Oracle 12c Cloud Control in Maximum Availability Arc...
Zahid Anwar (OCM)
 
Oracle RAC 12c Best Practices with Appendices DOAG2013
Markus Michalewicz
 
Oracle bi 10g_install_migration
Mlx Le
 
Oracle 12cR2 RAC Database Software Installation and Create Database
Monowar Mukul
 
Oracle RAC 12c Collaborate Best Practices - IOUG 2014 version
Markus Michalewicz
 
2017 10-oow-fma-application-containers-v01-final
Markus Flechtner
 
Oracle Application Containers
Markus Flechtner
 
Oracle RAC 12c Best Practices Sanger OOW13 [CON8805]
Markus Michalewicz
 
Cdb part i
DerejeBalcha7
 
Exploring Oracle Multitenant in Oracle Database 12c
Zohar Elkayam
 
Oracle 12c PDB insights
Kirill Loifman
 
Database-as-a-Service with Oracle Enterprise Manager Cloud Control 12c and Or...
Leighton Nelson
 
Introduction to MySQL Cluster
Abel Flórez
 
Oracle cluster installation with grid and nfs
Chanaka Lasantha
 
Oracle 12cR2 Grid Infrastructure Installation
Monowar Mukul
 
Create non-cdb (traditional) oracle database 12c on windows
Biju Thomas
 
Ad

Recently uploaded (20)

PPTX
How to Add Columns and Rows in an R Data Frame
subhashenia
 
PPTX
big data eco system fundamentals of data science
arivukarasi
 
PPTX
apidays Singapore 2025 - From Data to Insights: Building AI-Powered Data APIs...
apidays
 
PDF
apidays Singapore 2025 - How APIs can make - or break - trust in your AI by S...
apidays
 
PDF
Business implication of Artificial Intelligence.pdf
VishalChugh12
 
PDF
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
PPTX
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
PPTX
apidays Singapore 2025 - Generative AI Landscape Building a Modern Data Strat...
apidays
 
PPTX
SHREYAS25 INTERN-I,II,III PPT (1).pptx pre
swapnilherage
 
PPTX
apidays Helsinki & North 2025 - From Chaos to Clarity: Designing (AI-Ready) A...
apidays
 
PPTX
apidays Singapore 2025 - The Quest for the Greenest LLM , Jean Philippe Ehre...
apidays
 
PPTX
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
PPTX
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
PDF
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
PDF
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
PPT
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
PPTX
01_Nico Vincent_Sailpeak.pptx_AI_Barometer_2025
FinTech Belgium
 
PPTX
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
PDF
1750162332_Snapshot-of-Indias-oil-Gas-data-May-2025.pdf
sandeep718278
 
PPTX
apidays Helsinki & North 2025 - Running a Successful API Program: Best Practi...
apidays
 
How to Add Columns and Rows in an R Data Frame
subhashenia
 
big data eco system fundamentals of data science
arivukarasi
 
apidays Singapore 2025 - From Data to Insights: Building AI-Powered Data APIs...
apidays
 
apidays Singapore 2025 - How APIs can make - or break - trust in your AI by S...
apidays
 
Business implication of Artificial Intelligence.pdf
VishalChugh12
 
Optimizing Large Language Models with vLLM and Related Tools.pdf
Tamanna36
 
apidays Singapore 2025 - Designing for Change, Julie Schiller (Google)
apidays
 
apidays Singapore 2025 - Generative AI Landscape Building a Modern Data Strat...
apidays
 
SHREYAS25 INTERN-I,II,III PPT (1).pptx pre
swapnilherage
 
apidays Helsinki & North 2025 - From Chaos to Clarity: Designing (AI-Ready) A...
apidays
 
apidays Singapore 2025 - The Quest for the Greenest LLM , Jean Philippe Ehre...
apidays
 
03_Ariane BERCKMOES_Ethias.pptx_AIBarometer_release_event
FinTech Belgium
 
apidays Helsinki & North 2025 - API access control strategies beyond JWT bear...
apidays
 
Development and validation of the Japanese version of the Organizational Matt...
Yoga Tokuyoshi
 
Technical-Report-GPS_GIS_RS-for-MSF-finalv2.pdf
KPycho
 
Growth of Public Expendituuure_55423.ppt
NavyaDeora
 
01_Nico Vincent_Sailpeak.pptx_AI_Barometer_2025
FinTech Belgium
 
b6057ea5-8e8c-4415-90c0-ed8e9666ffcd.pptx
Anees487379
 
1750162332_Snapshot-of-Indias-oil-Gas-data-May-2025.pdf
sandeep718278
 
apidays Helsinki & North 2025 - Running a Successful API Program: Best Practi...
apidays
 

Oracle sharding : Installation & Configuration

  • 1. Oracle 12c Sharding Part 2 – Installation & Configuration
  • 2. Shared catalog db1 db2 SDB Connection Pool Search Distributed Metadata The requested data is distributed to shard1 – db1 Select custid,customernum ner,product,qty from customer_orders where cust_id=11030; Takes the hash key of this customer id Global Service Shard Director Customer_orders Partition1 Customer_orders Partition2 Oracle Sharding Architecture (12c R2) 1521 shard2 1521 shard1 1521 Primary Primary db1 db2 Customer_orders Partition1 Customer_orders Partition2 shard2 shard1 Standby Standby High Availability Dataguard Broder Dataguard Broder
  • 3. Configuring Oracle Sharding – Environment Planning Node Type IP Address Home Ports DB Name Scheduler Agent Shard Catalog Node 192.168.56.150 Host: shardcat Oracle Home: /u01/app/oracle/12.2.0.1/db_1 GSM home: /u01/app/oracle/12.2.0.1/GSM GSM Listener 1539 DB Listener 1521 SCAT Shard1 192.168.56.151 Host: shard1 Oracle Home: /u01/app/oracle/12.2.0.1/db_1 DB Listener 1521 sh1 Scheduler Agent - Shard2 192.168.56.152 Host: shard2 Oracle Home: /u01/app/oracle/12.2.0.1/db_1 DB Listener 1521 sh2 Scheduler Agent -
  • 4. Steps to Configure Oracle Sharding Step Nodes/Hosts Step Details 1 shardcat/Shard1/Shard2 Install Oracle Software Only 12cR2 – Preferably Same Location 2 shardcat Create Database SCAT using DBCA (NON CDB) 3 shardcat Install GSM Software as Separate Home 4 shardcat Create Environment Setup 5 Shardcat Prepare SCAT database for Sharding - Prerequisities 6 shardcat Configure Shard Catalog using GSDCTL – Create Shard Catalog in SCAT 7 shard1/shard2 Start the SCH Agent & Register Shard nodes to SCAT database 8 shardcat Create Shard Group/Director/Add Shards 9 shardcat Deploy Shards using GSDCTL – This will eventually create databases in shard1/shard2 10 shardcat Verify Shard Configuration 11 shardcat Create Global Service using GSDCTL 12 shardcat Create sample schema and Tablespace set and see that propagate to shard1/shard2 13 shardcat Connect to sample schema and create shard table 14 Shardcat/shard1/shard2 Verify the sample table is created across shards
  • 5. Step 1 : Install Oracle 12c R2 Software • Install Oracle 12cR2 Software on all three nodes shardcat/shard1/shard2 • Complete Pre-requisities • Install with Software only option • Sample options to change in <softwarelocation>/response/db_install.rsp oracle.install.option=INSTALL_DB_SWONLY ORACLE_HOSTNAME=Geek DBA11g UNIX_GROUP_NAME=oinstall INVENTORY_LOCATION=/u02/app/oraInventory ORACLE_HOME=/u01/app/oracle/product/12.1.0/db_1 ORACLE_BASE=/u01/app/oracle oracle.install.db.InstallEdition=EE oracle.install.db.DBA_GROUP=dba oracle.install.db.OPER_GROUP=oper oracle.install.db.BACKUPDBA_GROUP=dba oracle.install.db.DGDBA_GROUP=asmadmin oracle.install.db.KMDBA_GROUP=dba SECURITY_UPDATES_VIA_MYORACLESUPPORT=false DECLINE_SECURITY_UPDATES=true • Create Oracle Home Directories mkdir -p /u01/app/oracle/product/12.1.0/db_1 mkdir -p /u02/app/oraInventory chown -R oracle:oinstall /u02/app/oraInventory • Sample Run Installer Command ./runInstaller -silent -ignoresysprereqs -responsefile /home/oracle/database/response/db_install.rsp
  • 6. Step 2: Create ShardCatalog Database On shardcat Node:- • Create Directories mkdir –p /u01/app/oracle/flash_recover_area/SCAT mkdir –p /u01/app/oracle/fast_recovery_area/SCAT mkdir –p /u01/oradata/SCAT mkdir –p /u01/app/oracle/admin/SCAT/adump • Run DBCA ./dbca -silent -createDatabase -templateName General_Purpose.dbc -gdbName SCAT -sid SCAT -SysPassword **** -createAsContainerDatabase false -SystemPassword *** -emConfiguration NONE -redoLogFileSize 100 -recoveryAreaDestination /u01/app/oracle/SCAT -DatafileDestination /u01/app/oracle/SCAT -storageType FS -listeners LISTENER12 -registerWithDirService false -characterSet AL32UTF8 -nationalCharacterSet AL16UTF16 -databaseType MULTIPURPOSE -memoryPercentage 40 -memoryType AUTO
  • 7. Step 3: Install GSM Software in Shardcat On Shardcat Node:- • Download from Oracle Downloads page or Edelivery.oracle.com • Unzip the GSM Software • Install as separate Home
  • 8. Step 4: Create Environment Setup in Shardcat
  • 9. Step 5 : Prepare SCAT database for Sharding - Prerequisities On Shardcat : SCAT Database alter system set db_create_file_dest='/u01/ora12c/app/oracle/oradata' scope=both; alter system set open_links=16 scope=spfile; alter system set open_links_per_instance=16 scope=spfile; startup force alter user gsmcatuser account unlock; alter user gsmcatuser identified by oracle; CREATE USER mygdsadmin IDENTIFIED BY oracle; GRANT connect, create session, gsmadmin_role to mygdsadmin; grant inherit privileges on user SYS to GSMADMIN_INTERNAL; execute dbms_xdb.sethttpport(8080); commit; @?/rdbms/admin/prvtrsch.plb exec DBMS_SCHEDULER.SET_AGENT_REGISTRATION_PASS('oracleagent');
  • 10. Step 6:– Create Shard Catalog in SCAT On Shardcat node, in SCAT Database & Set environment to GSM Home # gdsctl GDSCTL> create shardcatalog -database shardcat:1521:SCAT -chunks 12 -user mygdsadmin/oracle -sdb SCAT -region region1 GDSCTL>add gsm -gsm sharddirector1 -listener 1571 -pwd oracle -catalog shardcat:1521:SCAT -region region1 GDSCTL>start gsm -gsm sharddirector1 GDSCTL>add credential -credential oracle_cred -osaccount oracle -ospassword **** GDSCTL> exit
  • 11. Step 7: Start the Scheduler Agent on Shard Nodes On Shard1 & 2 : Scheduler Agent is already installed if you install oracle database software just start it #Set Oracle Home #schagent start #schagent status # echo oracleagent | schagent –resiterdatabase shardcat 8080  provide name of host not database
  • 12. Step 8 : Create Shard Group/Director/Add Shards GDSCTL>set gsm -gsm sharddirector1 GDSCTL>connect mygdsadmin/oracle Catalog connection is established GDSCTL>-- add shard group GDSCTL>add shardgroup -shardgroup primary_shardgroup -deploy_as primary -region region1 The operation completed successfully GDSCTL>-- add shard1 GDSCTL>add invitednode shard1 GDSCTL>create shard -shardgroup primary_shardgroup -destination shard1 -credential oracle_cred DB Unique Name: sh1 GDSCTL> --add shard2 GDSCTL>add invitednode shard2 GDSCTL>create shard -shardgroup primary_shardgroup -destination shard2 -credential oracle_cred DB Unique Name: sh2
  • 13. Step 8 : Deploy Shards • In shardcat node, using gsdctl, run gsdctl> deploy Note: This will create the databases in shard1 and shard2 using dbca and create listeners automatically
  • 14. Step 10: Verify Shard Status
  • 15. Step 11 : Create Global Service using GSDCTL Using GDSCTL on shardcat gdsctl> add service –service test_srv –role primar gdsctl> config service gdsctl> start service gdsctl> status service
  • 16. Step 12: Create sample schema and Tablespace set and see that propagate to shard1/shard2 #[oracle12c@sdb1 ~]$ db_env Sqlplus / as sysdba alter session enable shard ddl; create user app_schema identified by oracle; grant all privileges to app_schema; grant gsmadmin_role to app_schema; grant select_catalog_role to app_schema; grant connect, resource to app_schema; grant dba to app_schema; grant execute on dbms_crypto to app_schema; #Create Sharded Tablespace & Test out conn app_schema/oracle alter session enable shard ddl; CREATE TABLESPACE SET TSP_SET_1 using template (datafile size 100m extent management local segment space management auto ); CREATE TABLESPACE products_tsp datafile size 100m extent management local uniform size 1m; Note: For any command that need to be shard, you must enable shard ddl at session level before running the sql command
  • 17. Step 13: Create Shard Tables
  • 18. Step 14: Verify Distribution of Tables to shards • On Shard Catalog SDB Database
  • 19. Step 14: Verify Distribution of Tables to Shards On Shard1, SH1 database the customer table is partitioned and some of the partitions created here On Shard2, SH2 database the customer table is partitioned and some of the partitions created here
  • 20. Thanks • In Next Post/Presentation we will be seeing • Managing Shards • Adding / Deleting Shards • Verify Data Distribution • Shard Restrictions