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
200
ElectronでSlackをさらに便利にしちゃう / Slack with Electron
blue0513
3
760
GitHub の README をいい感じにする / Cool Readme
blue0513
3
1.6k
Emacs × Sound やってみた / Emacs with Sound
blue0513
1
930
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
シールドクラスをはじめよう / Getting Started with Sealed Classes
mackey0225
3
390
役立つログに取り組もう
irof
26
8.5k
Sidekiqで実現する 長時間非同期処理の中断と再開 / Pausing and Resuming Long-Running Asynchronous Jobs with Sidekiq
hypermkt
6
2.6k
Synchronizationを支える技術
s_shimotori
1
150
Kotlin2でdataクラスの copyメソッドを禁止する/Data class copy function to have the same visibility as constructor
eichisanden
1
110
Universal Linksの実装方法と陥りがちな罠
kaitokudou
1
220
Vaporモードを大規模サービスに最速導入して学びを共有する
kazukishimamoto
4
4.3k
Tuning GraphQL on Rails
pyama86
2
1k
Webの技術スタックで マルチプラットフォームアプリ開発を可能にするElixirDesktopの紹介
thehaigo
2
880
Vue SFCのtemplateでTypeScriptの型を活用しよう
tsukkee
3
1.5k
Streams APIとTCPフロー制御 / Web Streams API and TCP flow control
tasshi
1
290
Modern Angular: Renovation for Your Applications
manfredsteyer
PRO
0
200
Featured
See All Featured
Fight the Zombie Pattern Library - RWD Summit 2016
marcelosomers
231
17k
The Illustrated Children's Guide to Kubernetes
chrisshort
48
48k
Fontdeck: Realign not Redesign
paulrobertlloyd
81
5.2k
Git: the NoSQL Database
bkeepers
PRO
425
64k
Understanding Cognitive Biases in Performance Measurement
bluesmoon
26
1.4k
Automating Front-end Workflow
addyosmani
1365
200k
Build your cross-platform service in a week with App Engine
jlugia
229
18k
Designing Dashboards & Data Visualisations in Web Apps
destraynor
228
52k
The Art of Delivering Value - GDevCon NA Keynote
reverentgeek
7
150
RailsConf 2023
tenderlove
29
880
Music & Morning Musume
bryan
46
6.1k
What's new in Ruby 2.0
geeforr
342
31k
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: