본문 바로가기

Database/Oracle Database

18c 신기능 - 오라클 샤딩 (Sharding) - #5 설치 사례 - System-Managed Sharded Database 생성

이전 글: 2022.04.19 - [Database/Oracle Database] - 18c 신기능 - 오라클 샤딩 (Sharding) - #4 설치 사례 - Sharding Management & Routing Tier 설정

System-Managed Sharded Database 생성

이번 테스트에서는 system-managed sharded database 생성합니다. 이를 위해서 아래와 같은 작업이 필요합니다.

-        shardgroup shard 생성

-        데이터베이스가 shard 사용되도록 설정

-        DELPOY 명령 수행

-        role-based global service 생성

 

Shard Director 호스트에 접속해서 현재 세션에 대한 global service manager 설정합니다.

GDSCTL> set gsm -gsm sdirector
GDSCTL> connect mysdbadmin/Welcome123##
Catalog connection is established

 

“primary_shardgroup” 이라는 이름으로 shardgroup 생성합니다. 이번 테스트에서는 Data Guard, Oracle Golden Gate replication 설정은 하지 않았습니다.

shardgroup 생성할 "-deploy_as primary" 옵션을 줘야 합니다. 그러지 않을 경우 shard 생성 시점에 "CATALOG:ORA-03783: no new shard to deploy" 발생합니다. 이에 기존 디폴트로 생성되어 있는 primary group 삭제했습니다.

GDSCTL> add shardgroup -shardgroup primary_shardgroup
The operation completed successfully

 

shard 호스트를 catalog VNCR(valid node checking for registration) 리스트에 등록 , 앞서 만든 shard group shard 생성합니다. VNCR shard director에서 등록이 허용된 IP주소, 호스트명, 서브넷 등을 설정하고 동적으로 업데이트 하는 역할을 합니다.

“add invitenode”, “add shard” 사용되는 shard 정보는 shard 호스트명입니다. shard 호스트 1, 2 대해 shard 생성합니다.

GDSCTL> add invitednode inst-shard1
GDSCTL> create shard -shardgroup primary_shardgroup -destination inst-shard1 -credential oracle_cred
The operation completed successfully
DB Unique Name: sh1
GDSCTL> add invitednode inst-shard2
GDSCTL> create shard -shardgroup primary_shardgroup -destination inst-shard2 -credential oracle_cred
The operation completed successfully
DB Unique Name: sh2

 

설정을 확인합니다. shard 이름(sh1, sh2) 시스템이 생성한 이름입니다.

GDSCTL> config

Regions
------------------------
regionora

GSMs
------------------------
sdirector

Sharded Database
------------------------
demo_sdb

Databases
------------------------
sh1
sh2

Shard Groups
------------------------
primary_shardgroup
shardspaceora_regionora

Shard spaces
------------------------
shardspaceora

Services
------------------------

GDSCTL pending requests
------------------------
Command                       Object                        Status
-------                       ------                        ------

Global properties
------------------------
Name: oradbcloud
Master GSM: sdirector
DDL sequence #: 0


GDSCTL> config vncr
Name                          Group ID
----                          --------
10.0.2.2
inst-shard1
inst-shard2

GDSCTL> config shardspace
Shard space                   Chunks
-----------                   ------
shardspaceora

GDSCTL> config shardgroup
Shard Group         Chunks Region              Shard space
-----------         ------ ------              -----------
primary_shardgroup         regionora           shardspaceora
shardspaceora_regio        regionora           shardspaceora
nora

GDSCTL> config shard
Name                Shard Group         Status    State       Region    Availability
----                -----------         ------    -----       ------    ------------
sh1                 primary_shardgroup  U         none        regionora -
sh2                 primary_shardgroup  U         none        regionora -

 

설정한 내용대로 deploy 합니.

GDSCTL> deploy
deploy: examining configuration...
deploy: deploying primary shard 'sh1' ...
deploy: network listener configuration successful at destination 'inst_shard1'
deploy: starting DBCA at destination 'inst_shard1' to create primary shard 'sh1' ...
deploy: deploying primary shard 'sh2' ...
deploy: network listener configuration successful at destination 'inst_shard2'
deploy: starting DBCA at destination 'inst_shard2' to create primary shard 'sh2' ...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: waiting for 2 DBCA primary creation job(s) to complete...
deploy: DBCA primary creation job succeeded at destination 'inst_shard1' for shard 'sh1'
deploy: waiting for 1 DBCA primary creation job(s) to complete...
deploy: DBCA primary creation job succeeded at destination 'inst_shard2' for shard 'sh2'
deploy: requesting Data Guard configuration on shards via GSM
deploy: shards configured successfully
The operation completed successfully

 

deploy 결과를 확인합니다. shard 모두 등록되었는 확인합니다.

GDSCTL> config shard
Name                Shard Group         Status    State       Region    Availability
----                -----------         ------    -----       ------    ------------
sh3                 primary_shardgroup  Ok        Deployed    regionora ONLINE
sh4                 primary_shardgroup  Ok        Deployed    regionora ONLINE
GDSCTL> databases
Database: "sh1" Registered: Y State: Ok ONS: N. Role: PRIMARY Instances: 1 Region: regionora
   Registered instances:
     demo_sdb%1
Database: "sh1" Registered: Y State: Ok ONS: N. Role: PRIMARY Instances: 1 Region: regionora
   Registered instances:
     demo_sdb%11
GDSCTL> config shard -shard sh1
Name: sh1
Shard Group: primary_shardgroup
Status: Ok
State: Deployed
Region: regionora
Connection string: inst-shard1.subnetshard.demovcn.oraclevcn.com:1521/sh1.subnetshard.demovcn.oraclevcn.com:dedicated
SCAN address:
ONS remote port: 0
Disk Threshold, ms: 20
CPU Threshold, %: 75
Version: 19.0.0.0
Failed DDL:
DDL Error: ---
Failed DDL id:
Availability: ONLINE
Rack:


Supported services
------------------------
Name                                                            Preferred Status
----                                                            --------- ------

GDSCTL> config shard -shard sh2
Name: sh2
Shard Group: primary_shardgroup
Status: Ok
State: Deployed
Region: regionora
Connection string: inst-shard2.subnetshard.demovcn.oraclevcn.com:1521/sh2.subnetshard.demovcn.oraclevcn.com:dedicated
SCAN address:
ONS remote port: 0
Disk Threshold, ms: 20
CPU Threshold, %: 75
Version: 19.0.0.0
Failed DDL:
DDL Error: ---
Failed DDL id:
Availability: ONLINE
Rack:


Supported services
------------------------
Name                                                            Preferred Status
----                                                            --------- ------

 

primary shard에서 수행될 global service 생성합니다.

GDSCTL> add service -service oltp_rw_srvc -role primary
The operation completed successfully
GDSCTL> config service


Name           Network name                  Pool           Started Preferred all
----           ------------                  ----           ------- -------------
oltp_rw_srvc   oltp_rw_srvc.demo_sdb.oradbcl demo_sdb       No      Yes
               oud

 

global service 시작합니다.

GDSCTL> start service -service oltp_rw_srvc
The operation completed successfully
GDSCTL> status service
Service "oltp_rw_srvc.demo_sdb.oradbcloud" has 2 instance(s). Affinity: ANYWHERE
   Instance "demo_sdb%1", name: "sh1", db: "sh1", region: "regionora", status: ready.
   Instance "demo_sdb%11", name: "sh2", db: "sh2", region: "regionora", status: ready.

 

<END>

다음 글로 이어집니다:

2022.04.19 - [Database/Oracle Database] - 18c 신기능 - 오라클 샤딩 (Sharding) - #6 설치 사례 - Shard 스키마 생성 및 테스트