Upgrade to Pro
— share decks privately, control downloads, hide ads and more …
Speaker Deck
Features
Speaker Deck
PRO
Sign in
Sign up for free
Search
Search
本番運用中 Oracle を破壊してしまった話 ~ 破壊と創世 ~ / Oracle Des...
Search
Taiju Aoki
November 20, 2020
Programming
0
2.8k
本番運用中 Oracle を破壊してしまった話 ~ 破壊と創世 ~ / Oracle Destruction and Creation
M3 techtalk
Taiju Aoki
November 20, 2020
Tweet
Share
More Decks by Taiju Aoki
See All by Taiju Aoki
オンプレ to オンプレした話/on-premises2on-premises
blue0513
0
2.8k
GitもCIもテストもないプロジェクトでデプロイを自動化するまでの道 / rebuild of DevOps
blue0513
0
3k
Git & GitLab & コードレビューって? / about Git, GitLab, CodeReview
blue0513
0
210
ElectronでSlackをさらに便利にしちゃう / Slack with Electron
blue0513
3
770
GitHub の README をいい感じにする / Cool Readme
blue0513
3
1.6k
Emacs × Sound やってみた / Emacs with Sound
blue0513
1
940
Slack を TweetDeck にしてみた件 / slackdeck-proto
blue0513
0
2.8k
知ってるとお得な iTerm2 と zsh/bash の小技
blue0513
2
770
クラウド電子カルテを支える魂の技術
blue0513
0
2.3k
Other Decks in Programming
See All in Programming
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
1k
弊社の「意識チョット低いアーキテクチャ」10選
texmeijin
5
24k
みんなでプロポーザルを書いてみた
yuriko1211
0
260
詳細解説! ArrayListの仕組みと実装
yujisoftware
0
580
ヤプリ新卒SREの オンボーディング
masaki12
0
130
Laravel や Symfony で手っ取り早く OpenAPI のドキュメントを作成する
azuki
2
110
3 Effective Rules for Using Signals in Angular
manfredsteyer
PRO
1
100
役立つログに取り組もう
irof
28
9.6k
Better Code Design in PHP
afilina
PRO
0
120
ECS Service Connectのこれまでのアップデートと今後のRoadmapを見てみる
tkikuc
2
250
Amazon Qを使ってIaCを触ろう!
maruto
0
400
CSC509 Lecture 12
javiergs
PRO
0
160
Featured
See All Featured
Product Roadmaps are Hard
iamctodd
PRO
49
11k
10 Git Anti Patterns You Should be Aware of
lemiorhan
654
59k
Six Lessons from altMBA
skipperchong
27
3.5k
Designing the Hi-DPI Web
ddemaree
280
34k
Testing 201, or: Great Expectations
jmmastey
38
7.1k
Measuring & Analyzing Core Web Vitals
bluesmoon
4
120
Into the Great Unknown - MozCon
thekraken
32
1.5k
実際に使うSQLの書き方 徹底解説 / pgcon21j-tutorial
soudai
169
50k
Writing Fast Ruby
sferik
627
61k
Practical Tips for Bootstrapping Information Extraction Pipelines
honnibal
PRO
10
720
What's new in Ruby 2.0
geeforr
343
31k
Docker and Python
trallard
40
3.1k
Transcript
ຊ൪ӡ༻த Oracle Λഁյͯ͠͠·ͬͨ ~ ഁյͱੈ ~ @blue_1617
ࢲ୭ʁ blue (@blue_1617) https://blue0513.github.io/show_room/ 2 ࠷ۙϋϚ͍ͬͯΔͷ ‣ ϚΠϯΫϥϑτʢSwitch ൛ʣ ‣
ϐΫϛϯ3 ‣ ΑΙ͜ͷ˓˓Ͱ˓˓ੜ׆
͜ͷʁ 3 https://speakerdeck.com/blue0513/on-premises2on-premises άϧʔϓاۀͷ“ΦϯϓϨ to ΦϯϓϨͨ͠” ͷޙஊ 1. Oracle DB
Λ֎ઌ͔ΒάϧʔϓاۀʹҠߦ 2. ӡ༻։࢝ 3. ͓ɺOracle ͷ༷ࢠ͕….. <= ͔͜͜Βͷ͓
࣍ 4 ୈ1࣍εʔύʔ Oracle Ҡߦ࡞ઓ ~ ഁյἫ ~ OMR ~
ΦϥΫϧϛεςϦʔௐࠪ൝ ~ ΧΠΪ ϑΝΠφϧήʔϜ Oracle SARABA ~ ੈฤ ~ ·ͱΊ
ୈ1࣍εʔύʔ Oracle Ҡߦ࡞ઓ ~ ഁյἫ ~
ୈ1࣍εʔύʔ Oracle Ҡߦ࡞ઓ ~ ഁյἫ ~ 6 ·ͣɺࣄલʹՔಇத DB Λ
clone ͯ͠४උΛͨ͠ Քಇத DB Clone DB
ୈ1࣍εʔύʔ Oracle Ҡߦ࡞ઓ ~ ഁյἫ ~ 7 Ϩίʔυ: X Sequence:
Y Քಇத DB Clone DB Ϩίʔυ: X Sequence: Y
ୈ1࣍εʔύʔ Oracle Ҡߦ࡞ઓ ~ ഁյἫ ~ 8 Ϩίʔυ: X +
a Sequence: Y + b Քಇத DB Clone DB Ϩίʔυ: X Sequence: Y Clone ޙՔಇΛଓ͚ΔͱɺϨίʔυͳͲʹࠩҟ
ୈ1࣍εʔύʔ Oracle Ҡߦ࡞ઓ ~ ഁյἫ ~ 9 Քಇத DB Clone
DB Ҡߦɺexport / import Λ࣮ߦ $ expdp full=y $ impdp full=y dump file
ୈ1࣍εʔύʔ Oracle Ҡߦ࡞ઓ ~ ഁյἫ ~ 10 https://docs.oracle.com/cd/E11882_01/server.112/e22490/dp_export.htm#SUTIL825 https://docs.oracle.com/cd/B19306_01/server.102/b14215/dp_import.htm Full
Export / Improt Mode DB ͷதΛ”શͯ” export / import ͯ͘͠ΕΔ Ϣʔβʔ͕࡞ͬͨ schema Ҏ֎ͷ system schema ͬͯ͘ΕΔ Role Sequence ͳͲରʹͳ͍ͬͯΔ ͜ΕҰݸͰͯ͑͢Δ͍ͭ͢͝
ୈ1࣍εʔύʔ Oracle Ҡߦ࡞ઓ ~ ഁյἫ ~ 11 Ϩίʔυ: X +
a Քಇத DB Clone DB Ϩίʔυ: X + a ϨίʔυͷҠߦશޭʂʂͬͨͥʂʂ
ΧΠΪ ϑΝΠφϧήʔϜ
ΧΠΪ ϑΝΠφϧήʔϜ 13 ҠߦཌɺΤϥʔ͕ൃੜ Ϩίʔυ id: 9999 Sequence Last Number:
9000ʢϨίʔυʹൺͯখ͍͞ʣ INSERT ͠Α͏ͱ͢ΔͱɺUnique key violation
ΧΠΪ ϑΝΠφϧήʔϜ 14 ҠߦཌɺۀεΩʔϚͰΤϥʔ͕ൃੜ expdp / impdp full=y Ͱ Sequence
͕ಉظ͞Εͳ͔ͬͨ Ϩίʔυ: X + a Sequence: Y + b Քಇத DB Clone DB Ϩίʔυ: X + a Sequence: Y $ expdp full=y $ impdp full=y
ΧΠΪ ϑΝΠφϧήʔϜ 15 Ϩίʔυ: X + a Sequence: Y +
b Քಇத DB Clone DB Ϩίʔυ: X + a Sequence: Y + b खಈͰ Sequence Λ Inc ͨ͠
ΧΠΪ ϑΝΠφϧήʔϜ 16 Ϩίʔυ: X + a Sequence: Y +
b Քಇத DB Clone DB Ϩίʔυ: X + a Sequence: Y + b खಈͰ Sequence Λ Inc ͨ͠ ੈͳͯ͜ͱͳ͠ʂʂʂ
ΧΠΪ ϑΝΠφϧήʔϜ 17 ཌिͷձٞʹͯ VPoE CTO ଞͷεΩʔϚେৎͳͷʁ ͛ͳงғؾ͕͢Δ
OMR ~ ΦϥΫϧϛεςϦʔௐࠪ൝ ~
19 Full Export / Improt Mode Ϣʔβʔ͕࡞ͬͨ schema Ҏ֎ͷ system
schema ͬͯ͘ΕΔ Ϩίʔυ: X + a Sequence: Y + b Քಇத DB Clone DB Ϩίʔυ: X + a Sequence: Y System ܥεΩʔϚ System ܥεΩʔϚ OMR ~ ΦϥΫϧϛεςϦʔௐࠪ൝ ~
20 Full Export / Improt Mode Ϣʔβʔ͕࡞ͬͨ schema Ҏ֎ͷ system
schema ͬͯ͘ΕΔ Ϩίʔυ: X + a Sequence: Y + b Քಇத DB Clone DB Ϩίʔυ: X + a Sequence: Y System ܥεΩʔϚ System ܥεΩʔϚ ੩͔ʹ Unique key violation OMR ~ ΦϥΫϧϛεςϦʔௐࠪ൝ ~
21 System ܥεΩʔϚ SYSTEM ORDDATA PERFSTAT etc ….. γεςϜཧݖݶ ౷ܭใऔಘ
ϝλσʔλཧ http://www.oracle-wiki.net/premium:startdocsdefaultschemas#toc2 etc…. OMR ~ ΦϥΫϧϛεςϦʔௐࠪ൝ ~
22 System ܥεΩʔϚ SYSTEM ORDDATA PERFSTAT etc ….. γεςϜཧݖݶ ౷ܭใऔಘ
ϝλσʔλཧ http://www.oracle-wiki.net/premium:startdocsdefaultschemas#toc2 etc…. ͜ΕΒ͕ਖ਼ৗʹಈ͔ͳ͍Մೳੑ͕͋Δͱ…….ʁ OMR ~ ΦϥΫϧϛεςϦʔௐࠪ൝ ~
OMR ~ ΦϥΫϧϛεςϦʔௐࠪ൝ ~ 23 Log User ౷ܭใऔಘࣦഊ͠ͱΔͰ ͳΜ͔લʹൺ͍ͯ…… ͜Ε·͍ͣɻͦͷ͏ͪେരൃ͢Δ͔͠Εͳ͍
Oracle SARABA ~ ੈฤ ~
Oracle SARABA ~ ੈฤ ~ 25 աڈͷεφοϓγϣοτ ͔Β෮ݩ Քಇத DB
ຊ൪DBɺաڈʹεφοϓγϣοτΛऔ͍ͬͯͨ ͦΕΛ༻͍ͯ৽͘͠ DB Λ࡞ εφοϓγϣοτͷ࣌Ͱ system ܥεΩʔϚഁյ͞Ε͍ͯͳ͍ ʢ៉ྷͳ DBʣ
Oracle SARABA ~ ੈฤ ~ 26 աڈͷεφοϓγϣοτ ͔Β෮ݩ Քಇத DB
system ܥεΩʔϚ *Ҏ֎* ͷϨίʔυͷΈimport system ܥεΩʔϚ *Ҏ֎* ͷ sequence ͷΈ import جຊઓུ
Oracle SARABA ~ ੈฤ ~ 27 աڈͷεφοϓγϣοτ ͔Β෮ݩ system ܥεΩʔϚ
*Ҏ֎* ͷεΩʔϚΛରʹ͢Δ (system ܥεΩʔϚ៉ྷͳͷͰ no touch ͰϤγ) 1. TRUNCATE table 2. DROP sequence Քಇத DB
Oracle SARABA ~ ੈฤ ~ 28 աڈͷεφοϓγϣοτ ͔Β෮ݩ system ܥεΩʔϚ
*Ҏ֎* ͷεΩʔϚΛରʹ͢Δ (system ܥεΩʔϚ៉ྷͳͷͰ no touch ͰϤγ) 1. TRUNCATE table 2. DROP sequence ςʔϒϧۭ εΩʔϚఆٛଘࡏ Role, Synonym ͦͷ·· Քಇத DB
Oracle SARABA ~ ੈฤ ~ 29 աڈͷεφοϓγϣοτ ͔Β෮ݩ system ܥεΩʔϚ
*Ҏ֎* ͷεΩʔϚΛରʹ͢Δ (system ܥεΩʔϚ៉ྷͳͷͰ no touch ͰϤγ) 3. expdp full=y Քಇத DB ςʔϒϧใ Sequence, Schema etc ͯ͢Λग़ྗ
Oracle SARABA ~ ੈฤ ~ 30 աڈͷεφοϓγϣοτ ͔Β෮ݩ system ܥεΩʔϚ
*Ҏ֎* ͷεΩʔϚΛରʹ͢Δ (system ܥεΩʔϚ៉ྷͳͷͰ no touch ͰϤγ) 4. impdp schemas data_only 5. impdp schemas include=SEQUENCE Քಇத DB ςʔϒϧͷϨίʔυΛ import Sequence object Λ import
Oracle SARABA ~ ੈฤ ~ 31 աڈͷεφοϓγϣοτ ͔Β෮ݩ Քಇத DB
system ܥεΩʔϚ => ͦͷ··ͳͷͰ៉ྷ system ܥ *Ҏ֎ͷ* ςʔϒϧ => σʔλͷΈߋ৽ system ܥ *Ҏ֎ͷ* sequence => ߋ৽
Oracle SARABA ~ ੈฤ ~ 32 ᘳͳ DB ͷ
·ͱΊ
·ͱΊ 34 DB ͷҠߦͳͲͷਖ਼֬ੑ͕ٻΊΒΕΔ࡞ۀͰԲͤͣ ઐՈͷҙݟΛڼ͝͏ ใ࿙ӮۀσʔλഁଛͷΑ͏ͳෆՄٯͳࣄଶͰͳ ͚Εόάमਖ਼ϦΧόϦ͕Ͱ͖Δ͔Βɺམͪண͜͏ ڠྗ͍͍ͯͨͩͨ͠ SRE νʔϜͷํʑɺCTO
͋Γ͕ͱ͏͍͟͝·ͨ͠ :bow: