https://m.blog.naver.com/xogstar/221764283531
Oracle Database ¹é¾÷ & º¹±¸ °³³ä 2
¾È³çÇϼ¼¿ä? ORACLE DBA ÀÌÅÂÈÆÀÔ´Ï´Ù.
Áö³ °ÀÇ¿¡¼´Â Oracle µ¥ÀÌÅͺ£À̽º¸¦ ¹é¾÷ÇÏ´Â ¹æ¹ý¿¡ ´ëÇؼ ¾Ë¾Æº¸¾Ò½À´Ï´Ù.
À̹ø °ÀÇ¿¡¼´Â ¹Þ¾ÆµÐ ¹é¾÷ÆÄÀÏÀ» ÀÌ¿ëÇÏ¿© µ¥ÀÌÅͺ£À̽º¸¦ º¹±¸ÇÏ´Â ¹æ¹ý¿¡ ´ëÇØ ¾Ë¾Æº¼°Ô¿ä.
¹é¾÷À» ¹Þ´Â ¹æ¹ýÀº Å©°Ô ¼¼ °¡Áö·Î ³ª´©¾îº¼ ¼ö ÀÖ½À´Ï´Ù.
1. ¼öµ¿ ¹é¾÷ (User-Managed Backup)
2. RMAN ¹é¾÷ (Recovery Manager)
3. ¹é¾÷ ¼Ö·ç¼ÇÀ» ÀÌ¿ëÇÑ ¹é¾÷ (Third Party Solution)
¶ÇÇÑ, µ¥ÀÌÅͺ£À̽º¸¦ ¿î¿µ(Open) Áß¿¡ ¹ÞÀ»Áö ÁßÁöÇÏ°í ¹ÞÀ»Áö¿¡ µû¶ó
Hot Backup, Cold BackupÀ¸·Î ³ª´©¾î »ý°¢Çغ¼ ¼ö ÀÖ´Ù°í ¼³¸í µå·È½À´Ï´Ù.
1. Hot Backup = Open »óÅ¿¡¼ ¹Þ´Â ¹é¾÷(=Online Backup, Inconsistent Backup)
2. Cold Backup = Shutdown »óÅ¿¡¼ ¹Þ´Â ¹é¾÷(=Offline Backup, Consistent Backup)
°¢ »çÀÌÆ®¸¶´Ù »óȲ¿¡ ¸Â°Ô ´Ù¾çÇÑ ¹é¾÷ Àü·«À» »ç¿ëÇÕ´Ï´Ù¸¸,
ÀϹÝÀûÀ¸·Î Oracle ¹é¾÷Àº ÁÖ·Î Hot backupÀ¸·Î ÀÌ·ç¾îÁö¸ç,
(Cold Backup½Ã SGA¸¦ ÃʱâÈÇؾßÇϱ⠶§¹®¿¡ ºñÈ¿À²ÀÌ Å)
RMANÀ» ÀÌ¿ëÇϰųª ¼öµ¿ ¹é¾÷ ½ºÅ©¸³Æ®¸¦ ÀÛ¼ºÇÏ¿© ¿î¿µÇÏ´Â °æ¿ì°¡ ´ëºÎºÐÀÔ´Ï´Ù.
µû¶ó¼ À̹ø ½Ã°£¿¡´Â ¼öµ¿À¸·Î ¹é¾÷µÈ ÆÄÀϵé°ú RMANÀ¸·Î ¹é¾÷µÈ ÆÄÀϵéÀ» ÀÌ¿ëÇÏ¿©
µ¥ÀÌÅͺ£À̽º¸¦ º¹±¸ÇÏ´Â ¹æ¹ý¿¡ ´ëÇØ ¾Ë¾Æº¸°Ú½À´Ï´Ù.
¸ÕÀú, ¼öµ¿ ¹é¾÷À» ¹Þ±â À§Çؼ±, µ¥ÀÌÅͺ£À̽º¿¡ Á¢¼ÓÇÏ¿© Begin Backup ¸ðµå·Î
µ¥ÀÌÅͺ£À̽º(ȤÀº Å×ÀÌºí½ºÆäÀ̽º ´ÜÀ§µµ °¡´É)ÀÇ »óŸ¦ ÀüȯÇØÁÖ¾î¾ß ÇÕ´Ï´Ù.
Backup Mode·Î ÀüȯÇÒ ¶§´Â [ALTER DATABASE BEGIN BACKUP;] ¸í·É¾î¸¦ ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
µ¥ÀÌÅͺ£À̽º°¡ ¹é¾÷¸ðµå·Î ÀüȯµÇ¸é ¹é¾÷¸ðµå°¡ Á¾·áµÉ ¶§±îÁö DB¸¦ Á¾·áÇÒ ¼ö ¾øÀ¸¸ç
°Á¦·Î Á¾·á¸¦ ÇØÁ־ ´ÙÀ½¹ø ±âµ¿ ½Ã °¢ µ¥ÀÌÅÍÆÄÀÏ¿¡ °É·ÁÀÖ´Â ¹é¾÷¸ðµå¸¦ Ç®¾îÁà¾ß
µ¥ÀÌÅͺ£À̽º¸¦ OPEN »óÅ·ΠÁøÀÔ½Ãų ¼ö ÀÖ½À´Ï´Ù.
Begin Backup ¸í·É¾î¸¦ ÅëÇØ ¹é¾÷¸ðµå·Î µé¾î¿Ô´Ù¸é
C/D/R(Control File, Data File, Redo Log File)ÀÌ ÀúÀåµÇ¾îÀÖ´Â ¼¹ö °æ·Î·Î À̵¿ÇÏ¿©
cp ¸í·É¾î¸¦ ÅëÇØ º°µµÀÇ ÀúÀå¸Åü·Î º¹»çÇØÁÖ¸é µË´Ï´Ù.
º¹»çÀÛ¾÷ÀÌ ³¡³ ÈÄ¿¡ ´Ù½Ã µ¥ÀÌÅͺ£À̽º¿¡ Á¢¼ÓÇÏ¿©
[ALTER DATABASE END BACKUP;] ¸í·É¾î¸¦ ÀÔ·ÂÇØÁÖ¸é ¹é¾÷ ¸ðµå°¡ Ç®¸®°Ô µÇ°í,
Á¤»óÀûÀÎ µ¥ÀÌÅͺ£À̽º Á¾·á°¡ °¡´ÉÇÕ´Ï´Ù.
ÇÑ °¡Áö ÁÖÀÇÇؾßÇÒ »çÇ×Àº Begin Backup ¸ðµå°¡ ½ÃÀ۵Ǹé
Redo Log¿¡ Redo Data¸¦ ¾²´Â °ÍÀÌ ¾Æ´Ï¶ó,
Buffer Cache¿¡ ¿Ã¶ó¿ÍÀÖ´Â Dirty »óÅÂÀÇ ¹öÆÛµéÀ» °í½º¶õÈ÷ ³»·Á¾²±â ¶§¹®¿¡
Redo Log FileÀÇ Å©±â°¡ Áõ°¡ÇÏ´Â ¼Óµµ°¡ 8¹è ÀÌ»ó Áõ°¡ÇÏ°Ô µË´Ï´Ù.
µû¶ó¼ ¹é¾÷À» ¹Þ´Â µ¿¾È º¹»ç ´ë»óÀÇ ÆÄÀÏÀÌ ÀúÀåµÉ °ø°£ÀÌ ÃæºÐÇÏÁö,
Redo Log¿Í Archived Log°¡ ½×ÀÏ °ø°£¿¡ µð½ºÅ© ¿ë·®¿¡ ¿©À¯°¡ ÀÖ´ÂÁö
¹Ýµå½Ã È®ÀÎÇÏ°í ¹é¾÷À» ¼öÇàÇØÁÖ¾î¾ß ÇÕ´Ï´Ù.
¼öµ¿ ¹é¾÷À» ¼öÇàÇÒ ¶§ µ¥ÀÌÅͺ£À̽º Àüü¸¦ ¹é¾÷¸ðµå·Î µÎ°í ¸ðµç µ¥ÀÌÅÍÆÄÀÏÀ»
ÀÏ°ýÀûÀ¸·Î º¹»çÇÏ´Â ¹æ¹ýµµ ÀÖÁö¸¸, ½Ç¹«¿¡¼´Â Àß »ç¿ëµÇÁö ¾Ê´Â ¹æ¹ýÀÔ´Ï´Ù.
¿î¿µ ¸Á¿¡¼´Â ÁÖ·Î Å×ÀÌºí½ºÆäÀ̽º ´ÜÀ§ÀÇ ¹é¾÷ÀÌ ÀÌ·ç¾îÁö¸ç,
ÀÌ´Â Redo Log File°ú Archived Log Å©±â°¡ Æø¹ßÀûÀ¸·Î Áõ°¡ÇÏ´Â Çö»óÀ»
¾î´À Á¤µµ ¹æÁöÇØÁÙ ¼ö ÀÖ½À´Ï´Ù.
1. µ¥ÀÌÅͺ£À̽º Àüü ¹é¾÷ ¹æ¹ý
SQL> ALTER DATABASE BEGIN BACKUP;
$ cp [º¹»çÇÒ ÆÄÀϸí] [´ë»ó °æ·Î/À̸§]
SQL > ALTER DATABASE END BACKUP;
2. Å×ÀÌºí½ºÆäÀ̽º ¹é¾÷ ¹æ¹ý
SQL> ALTER TABLESPACE [Å×ÀÌºí ½ºÆäÀ̽º¸í] BEGIN BACKUP;
$ cp [º¹»çÇÒ Å×ÀÌºí½ºÆäÀ̽º¸¦ ±¸¼ºÇÏ´Â µ¥ÀÌÅÍÆÄÀÏ] [´ë»ó °æ·Î/À̸§]
SQL> ALTER TABLESPACE [Å×ÀÌºí ½ºÆäÀ̽º¸í] END BACKUP;
¹é¾÷ÀÌ ¿Ï·áµÈ ÈÄ¿¡ Àå¾Ö°¡ ¹ß»ýÇϸé,
±âÁ¸ µ¥ÀÌÅÍÆÄÀÏÀÌ ÀÖ´ø °÷¿¡ cp ¸í·É¾î¸¦ ÅëÇؼ
¹é¾÷ÆÄÀÏÀ» ¹°¸®ÀûÀ¸·Î À§Ä¡½ÃÅ°°í(Restore)
RestoreµÈ ¹é¾÷ÆÄÀÏ(C/D/R µî)ÀÇ ½ÃÁ¡(SCN)À» Recovery ÀÛ¾÷À» ÅëÇØ
¹é¾÷ ÆÄÀÏÀÇ SCNÀ» ³í¸®ÀûÀ¸·Î ÀüÁø(Roll Forward)½ÃÅ°¸é µË´Ï´Ù.
Recovery¿¡ ÇÊ¿äÇÑ ¸í·É¾î´Â [RECOVER DATABASE]¶ó´Â ¸í·É¾îÀ̸ç,
ÇØ´ç ¸í·É¾î¸¦ ¼öÇàÇϸé SMON¿¡ ÀÇÇØ Control File°ú Data File¿¡
Redo¸¦ ApplyÇÏ´Â Recover ÀÛ¾÷ÀÌ ¼öÇàµË´Ï´Ù.
Restore¿Í Recover´Â µ¥ÀÌÅͺ£À̽º¿¡¼ ÀüÇô ´Ù¸¥ ¿ë¾î·Î »ç¿ëµÇ¹Ç·Î
ÇØ´ç ´Ü¾îÀÇ Àǹ̸¦ Á¤È®ÇÏ°Ô ÀÌÇØÇÏ´Â °ÍÀÌ ¸Å¿ì Áß¿äÇÕ´Ï´Ù.
1. Restore : ¹é¾÷¹Þ¾Ò´ø ÆÄÀÏÀ» ½ÇÁ¦ µ¥ÀÌÅÍ °æ·Î¿¡ ¹°¸®ÀûÀ¸·Î À§Ä¡½ÃÅ°´Â °Í
2. Recover : ¹°¸®ÀûÀ¸·Î ¿Å°ÜÁø ÆÄÀÏÀÇ SCNÀ» ³í¸®ÀûÀ¸·Î ÀüÁø½ÃÅ°´Â °Í
Recover ¸í·É¾î·Î µ¥ÀÌÅͺ£À̽º°¡
Archived Log¸¦ ã¾Æ¼ ÀÚµ¿À¸·Î º¹±¸¸¦ ÇÒ ¼ö ¾ø´Â °æ¿ì¿¡´Â
[RECOVER DATABASE UNTIL CANCEL] ¸í·É¾î¸¦ ÅëÇØ
¼öµ¿À¸·Î Archived LogÀÇ °æ·Î¸¦ ÀÔ·ÂÇØÁÙ ¼ö ÀÖ½À´Ï´Ù.
ÀÌ ¸í·É¾î´Â Archived LogÀÇ À§Ä¡¸¦ ¼öµ¿À¸·Î ÀÔ·ÂÇØÁÖ´Â °Í ¿Ü¿¡µµ
ƯÁ¤ ½ÃÁ¡À¸·Î º¹±¸¸¦ ¼öÇàÇÏ´Â PITR º¹±¸[Point-In-Time Recovery] ±â¹ý¿¡µµ ÀÌ¿ëµË´Ï´Ù.
¼öµ¿¹é¾÷¿¡¼ °¡Àå Áß¿äÇÏ°Ô »ý°¢ÇؾßÇÒ °ÍÀº ¹Ù·Î
[¹é¾÷ ´ç½ÃÀÇ Redo°¡ ´ã±ä Archive Log]ÀÔ´Ï´Ù.
¹é¾÷ ¹ÞÀ» ´ç½ÃÀÇ Redo Log´Â ÈÄ¿¡ Archived µÇ¾î º°µµÀÇ ÀúÀå °ø°£¿¡ ÀúÀåµÉ °ÍÀÔ´Ï´Ù.
±×¸®°í ÀÌ ÆÄÀÏÀº Èʳ¯ Àå¾Ö »óȲ ½Ã¿¡ RestoreµÈ ¹é¾÷À» RecoverÇÏ´Â
°¡Àå ù ´ÜÃß ¿ªÇÒÀ» ¼öÇàÇÏ°Ô µË´Ï´Ù.
¸¸¾à ÀÌ ÆÄÀÏÀÌ ¾øÀ» °æ¿ì C/D/RÀÇ SCNÀÌ ´Ù¸£±â ¶§¹®¿¡
¾î¶°ÇÑ ¹æ¹ýÀ¸·Îµµ OPEN½Ãų ¼ö ¾ø°í ÇØ´ç DB´Â 100%·Î µ¥ÀÌÅÍ À¯½ÇÀ» °Þ°Ô µË´Ï´Ù.
µû¶ó¼ ¹é¾÷¹ÞÀ» ´ç½ÃÀÇ Redo Log°¡ ´ã±ä Archive Log¸¦
¹é¾÷º»°ú °°ÀÌ ¾ÈÀüÇÏ°Ô º¸°üÇÏ´Â °ÍÀº ¹«¾ùº¸´Ù Áß¿äÇÏ´Ù°í ¸»¾¸À» µå¸± ¼ö ÀÖ½À´Ï´Ù.
RMANÀ» ÅëÇØ ¹é¾÷/º¹±¸¸¦ ¼öÇàÇÏ´Â °æ¿ì¿¡´Â
[rman target /]¶ó´Â ¸í·É¾î¸¦ ÅëÇØ RMAN ÇÁ·ÒÇÁÆ®·Î Á¢¼ÓÇÏ¿© ÁøÇàÇÒ ¼ö ÀÖ½À´Ï´Ù.
RMAN¿¡ Á¢¼ÓÇÑ ÈÄ¿¡´Â º°µµÀÇ RMAN Àü¿ë ¸í·É¾îµéÀ» »ç¿ëÇÏ¿©
¹é¾÷/º¹±¸¸¦ ÁøÇàÇÏ°Ô µÇ´Âµ¥ ÁÖ·Î ¾²ÀÌ´Â ¸í·É¾î´Â ´ÙÀ½°ú °°½À´Ï´Ù.
1. LIST BACKUP; - ¹é¾÷µÈ ÆÄÀÏ ¸®½ºÆ® Á¶È¸
2. LIST ARCHIVELOG ALL; - ¹é¾÷µÈ ¾ÆÄ«ÀÌºê ¸ñ·Ï Á¶È¸
3. BACKUP DATABASE; - µ¥ÀÌÅͺ£À̽º Àüü ¹é¾÷ ½ÃÀÛ
4. BACKUP ARCHIVELOG ALL; - ¾ÆÄ«À̺ê·Î±× Àüü ¹é¾÷ ½ÃÀÛ
5. SHOW ALL; - ÇöÀç ¼³Á¤µÈ RMAN ConfigurationÀ» ¸ðµÎ Á¶È¸
6. CROSSCHECK BACKUP; - Control File¿¡ ±â·ÏµÈ ¹é¾÷ÆÄÀÏÀÇ ½ÇÁ¸¿©ºÎ È®ÀÎ
7. CROSSCHECK ARCHIVELOG ALL; - Control File¿¡ ±â·ÏµÈ Archived LogµéÀÇ ½ÇÁ¸¿©ºÎ È®ÀÎ
8. LIST FAILURE; - ÇöÀç Database¿¡ ÀÏ¾î³ Àå¾Ö »óȲÀ» ÀÚµ¿À¸·Î °Ë»çÇØÁÜ
9. ADVISE FAILURE; - Àå¾Ö »óȲ¿¡ ´ëÇÑ Trouble Shooting °¡À̵å Á¦°ø
10. REPAIR FAILURE; - Á¦°øµÈ Trouble Shooting °¡À̵忡 µû¶ó µ¥ÀÌÅͺ£À̽º º¹±¸
11. DELETE BACKUP; - ¹é¾÷µÈ ÆÄÀÏ »èÁ¦
12. DELETE ARCHIVELOG ALL; - ¹é¾÷µÈ ¾ÆÄ«À̺ê·Î±× »èÁ¦
13. DELETE OBSOLETE; - Control File°ú ½ÇÁ¦ FileÀ» CROSSCHECKÇÏ¿© ¹ÌÁ¸Àç ±â·Ï/ÆÄÀÏ »èÁ¦
RMANÀ» ÅëÇØ ¹é¾÷ º¹±¸¸¦ ¼öÇàÇÏ°Ô µÇ¸é
Control File¿¡ ±âÀçµÈ ±â·ÏÀÌ ¸÷½Ã Áß¿äÇϱ⠶§¹®¿¡
Control FileÀ» Àß º¸°ü/°ü¸®ÇÏ´Â °ÍÀÌ ¹«¾ùº¸´Ù Áß¿äÇÕ´Ï´Ù.
Control FileÀº ÀϹÝÀûÀ¸·Î ¾à 1ÁÖÀÏ Á¤µµÀÇ º¸°üÁֱ⸦ °¡Áö¹Ç·Î,
1ÁÖÀÏ ÀÌ»ó ±â·ÏÀ» À¯ÁöÇÒ ÇÊ¿ä°¡ ÀÖ´Â °æ¿ì´Â ¹é¾÷/º¹±¸¸¦ À§ÇÑ
Catalog Database¸¦ ±¸¼ºÇÒ ¼ö ÀÖ½À´Ï´Ù.
RMANÀ¸·Î ¹é¾÷µÈ ÆÄÀÏÀ» ÀÌ¿ëÇÏ¿© RESTORE / RECOVER ÀÛ¾÷ÀÌ ÇÊ¿äÇÑ °æ¿ì
¾Æ·¡¿Í °°Àº ¸í·É¾î¸¦ ÀÌ¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù.
RECOVER±îÁö ¿Ï·áµÈ ÀÌÈÄ¿¡´Â
$ ALTER DATABASE OPEN [RESETLOGS / NORESETLOGS] ¸í·É¾î·Î
µ¥ÀÌÅͺ£À̽º ¿ÀÇÂÀ» ÁøÇàÇÒ ¼ö ÀÖ½À´Ï´Ù.
14. RESTORE DATABASE; - µ¥ÀÌÅͺ£À̽º ¹é¾÷ º»À» ¿î¿µ À§Ä¡·Î µ¤¾î¾²±â
15. RECOVER DATABASE; - µ¤¾î¾´ ÆÄÀÏÀ» ³í¸®ÀûÀ¸·Î º¹±¸½ÃÅ´(Redo Apply)
°¨»çµå¸®¸ç, ¿À´Ãµµ ÁÁÀº Àϵ鸸 °¡µæÇÏ±æ ¹Ù¶ø´Ï´Ù.😎
|