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
780
クラウド電子カルテを支える魂の技術
blue0513
0
2.3k
Other Decks in Programming
See All in Programming
聞き手から登壇者へ: RubyKaigi2024 LTでの初挑戦が 教えてくれた、可能性の星
mikik0
1
130
RubyLSPのマルチバイト文字対応
notfounds
0
120
WebフロントエンドにおけるGraphQL(あるいはバックエンドのAPI)との向き合い方 / #241106_plk_frontend
izumin5210
4
1.4k
ローコードSaaSのUXを向上させるためのTypeScript
taro28
1
630
2024/11/8 関西Kaggler会 2024 #3 / Kaggle Kernel で Gemma 2 × vLLM を動かす。
kohecchi
5
940
Less waste, more joy, and a lot more green: How Quarkus makes Java better
hollycummins
0
100
EMになってからチームの成果を最大化するために取り組んだこと/ Maximize team performance as EM
nashiusagi
0
100
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
2
350
Click-free releases & the making of a CLI app
oheyadam
2
120
Generative AI Use Cases JP (略称:GenU)奮闘記
hideg
1
300
A Journey of Contribution and Collaboration in Open Source
ivargrimstad
0
1k
見せてあげますよ、「本物のLaravel批判」ってやつを。
77web
7
7.8k
Featured
See All Featured
Learning to Love Humans: Emotional Interface Design
aarron
273
40k
Raft: Consensus for Rubyists
vanstee
136
6.6k
Designing Experiences People Love
moore
138
23k
The Pragmatic Product Professional
lauravandoore
31
6.3k
Docker and Python
trallard
40
3.1k
Making Projects Easy
brettharned
115
5.9k
Fantastic passwords and where to find them - at NoRuKo
philnash
50
2.9k
I Don’t Have Time: Getting Over the Fear to Launch Your Podcast
jcasabona
28
2k
Music & Morning Musume
bryan
46
6.2k
10 Git Anti Patterns You Should be Aware of
lemiorhan
655
59k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Teambox: Starting and Learning
jrom
133
8.8k
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: