3. Àå¾ÖÀÇ À¯Çü°ú ¹®Á¦ÇØ°á
¡Ø SCENARIO 0 : TablespaceÀÇ Á¶ÀÛ
¡Ø SCENARIO 1 : Online Redo LogÀÇ Mirroring
¡Ø SCENARIO 2 : Full Offline Backup ¼öÇà
¡Ø SCENARIO 3 : Recovery - Temporary TablespaceÀÇ À¯½Ç
¡Ø SCENARIO 4 : Noarchive Log Mode Recovery - DiskÀÇ À¯½Ç
¡Ø SCENARIO 5 : Read Only TablespaceÀÇ Backup & Recovery
¡Ø SCENARIO 6 : DATABASEÀÇ BACKUP - Control File Mirroring & Archive log mode
¡Ø SCENARIO 7 : Complete Recovery(Archive) - UserÀÇ DATA FILE À¯½Ç
¡Ø SCENARIO 8 : Complete Recovery(ARchive) - Tablespace Recovery
¡Ø SCENARIO 9 : Complete Recovery(ARchive) - Datafile Recovery
¡Ø SCENARIO 10 : Parallel Recovery(Archive)
¡Ø SCENARIO 11 : Complete Recovery - Shutdown ÇÏÁö ¾Ê°í Data File¸¸ Recovery
¡Ø SCENARIO 12 : Online Backup (Hot Backup)
¡Ø SCENARIO 13 : Online Backup ½ÇÆÐ ÈÄ Recovery - Online Backup µµÁß¿¡ Á¤Àü
¡Ø SCENARIO 14 : Incomplete Recovery(Noarchive) - ½Ç¼ö·Î DropÇÑ TableÀÇ º¹±¸
¡Ø SCENARIO 15 : Inactive Online Redo Log GroupÀÇ À¯½Ç
¡Ø SCENARIO 16 : Current Online Redo Log GroupÀÇ À¯½Ç
¡Ø SCENARIO 17 : ¸ðµç Online Redo Log GroupÀÇ À¯½Ç
¡Ø SCENARIO 18 : ¸ðµç Redo Log & Data File À¯½Ç
¡Ø SCENARIO 19 : Control File Recreate
¡Ø SCENARIO 20 : ¸ðµç Control File À¯½Ç
¡Ø SCENARIO 21 : Control File°ú Data File µ¿½Ã¿¡ À¯½Ç
¡Ø SCENARIO 22 : Read Only TablespaceÀÇ »óź¯°æ¿¡ µû¸¥ Recovery -1
¡Ø SCENARIO 23 : Read Only TablespaceÀÇ »óź¯°æ¿¡ µû¸¥ Recovery -2
¡Ø SCENARIO 24 : Read Only TablespaceÀÇ »óź¯°æ¿¡ µû¸¥ Recovery -3
¡Ø SCENARIO 25 : Recovery from Online Backup - Data File, Control File À¯½Ç
¡Ø SCENARIO 26 : Recovery from Online Backup - Fileµé ¸ðµÎ°¡ »ç¶óÁ³´Ù.
°Ô´Ù°¡, Archived Redo Log FileÀÇ ÀϺΰ¡ ¾ø°í,
Data File Backupµµ ÀϺΠ¾ø´Ù.
¡Ø SCENARIO 27 : Recover with No Backup
¡Ø SCENARIO 28 : Incremental export ¿Í direct path
¡Ø SCENARIO 29 : standby database »ý¼º
¡Ø SCENARIO 30 : Catalog DB¸¦ ÀÌ¿ëÇÑ º¹±¸ Oracle8
<SCENARIO 0 : TablespaceÀÇ Á¶ÀÛ>
¨ç »õ·Î¿î Tablespace Create
[/DBA3/DBA/dba¼ýÀÚ]svrmgrl
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> create tablespace test
2> datafile '/DBA3/DBA/dba¼ýÀÚ/u01/test_01.dbf'
3> size 10k;
SVRMGR> select tablespace_name, bytes, file_name from dba_data_files;
¨è Table Create
SVRMGR> create table test(name char(30))
2> tablespace test
3> storage(initial 4k);
¨é Table¿¡ RowµéÀ» Insert
SVRMGR> @?/labs/test100
Statement processed.
SVRMGR> @?/labs/test100
ORA-01653: unable to extend table SYS.TEST by 5 in tablespace TEST
ORA-06512: at line 6
¨ê Tablespace¸¦ ´ÃÀδÙ
SVRMGR> alter tablespace test
2> add datafile '/DBA3/DBA/dba¼ýÀÚ/u01/test_02.dbf' size 30k;
Statement processed.
SVRMGR> @?/labs/test100
Statement processed.
SVRMGR> select tablespace_name, bytes, file_name from dba_data_files;
SVRMGR> !ls -la $ORACLE_HOME/u01 --> "test_02.dbf" file Å©±â È®ÀÎ
total 22563
drwxrwxr-x 2 dbamgr dba 512 Feb 24 13:08 .
drwxrwxr-x 43 dba¼ýÀÚ dba 1024 Feb 20 23:21 ..
-rw-rw---- 1 dba¼ýÀÚ dba 514048 Feb 24 13:05 index_01.dbf
-rw-rw---- 1 dba¼ýÀÚ dba 155648 Feb 24 13:05 log1a.rdo
-rw-rw---- 1 dba¼ýÀÚ dba 155648 Feb 24 13:09 log2a.rdo
-rw-rw---- 1 dba¼ýÀÚ dba 155648 Feb 24 12:55 log3a.rdo
-rw-rw---- 1 dba¼ýÀÚ dba 10487808 Feb 24 13:09 system.dbf
-rw-rw---- 1 dba¼ýÀÚ dba 12288 Feb 24 13:09 test_01.dbf
-rw-rw---- 1 dba¼ýÀÚ dba 32768 Feb 24 13:09 test_02.dbf
¨ë DatafileÀÇ Å©±â¸¦ ´ÃÀδÙ
SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u01/test_02.dbf' resize 50k;
Statement processed.
SVRMGR> select tablespace_name, bytes, file_name from dba_data_files;
SVRMGR> !ls -la $ORACLE_HOME/u01
¨ì Test°¡ ³¡³ª¸é Drop
SVRMGR> drop tablespace test;
drop tablespace test
*
ORA-01549: tablespace not empty, use INCLUDING CONTENTS option
SVRMGR> drop tablespace test including contents;
Statement processed.
SVRMGR> select tablespace_name, bytes, file_name from dba_data_files;
SVRMGR> !ls -la $ORACLE_HOME/u01
total 22611
drwxrwxr-x 2 dbamgr dba 512 Feb 24 13:08 .
drwxrwxr-x 43 dba35 dba 1024 Feb 20 23:21 ..
-rw-rw---- 1 dba35 dba 514048 Feb 24 13:05 index_01.dbf
-rw-rw---- 1 dba35 dba 155648 Feb 24 13:05 log1a.rdo
-rw-rw---- 1 dba35 dba 155648 Feb 24 13:18 log2a.rdo
-rw-rw---- 1 dba35 dba 155648 Feb 24 12:55 log3a.rdo
-rw-rw---- 1 dba35 dba 10487808 Feb 24 13:18 system.dbf
-rw-rw---- 1 dba35 dba 12288 Feb 24 13:18 test_01.dbf
-rw-rw---- 1 dba35 dba 53248 Feb 24 13:18 test_02.dbf
¨í Datafileµµ »èÁ¦
SVRMGR> !rm $ORACLE_HOME/u01/test_0*
SVRMGR> !ls -la $ORACLE_HOME/u01
SVRMGR> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SVRMGR> exit
Server Manager complete.
<SCENARIO 1 : Online Redo LogÀÇ Mirroring>
SVRMGR> select * from v$log;
SVRMGR> select * from v$logfile;
SVRMGR> alter database add logfile member
'/DBA3/DBA/dba¼ýÀÚ/u02//log±×·ì¹øÈ£b.rdo¡¯to ±×·ì¹øÈ£;
-> °¢ ±×·ì¸¶´Ù ¸â¹öÀÇ ¼ö¸¦ °®°Ô ¹Ì·¯¸µÇÑ´Ù.
SVRMGR> select * from v$logfile;
<SCENARIO 2 : Full Offline Backup ¼öÇà>
¨ç database¸¦ shutdownÇÑ »óÅ¿¡¼ init/control/data fileÀ» backup Æú´õ¿¡ copy
¨ç Database¸¦ Startup
[/DBA3/DBA/dba¼ýÀÚ]svrmgrl
SVRMGR> connect internal
SVRMGR> startup
¨è Tablespace Á¤º¸¸¦ È®ÀÎ(DBA_DATA_FILES, V$DATAFILE)
SVRMGR> select TABLESPACE_NAME, FILE_NAME
2> from dba_data_files; --> memo
¨é Log File Á¤º¸¸¦ È®ÀÎ(V$LOGFILE)
SVRMGR> select GROUP#, MEMBER
2> from v$logfile; --> memo
¨ê Control FileÀÇ Á¤º¸¸¦ È®ÀÎ
(V$CONTROLFILE, V$PARAMETER, init<SID>.ora, SHOW PARAMETER command)
¨ë Control FileÀÇ À̸§Àº $ORACLE_HOME/dbs¿¡¼ Parameter File·Î È®ÀÎ
SVRMGR> host more $ORACLE_HOME/dbs/initDBA¼ýÀÚ.ora --> memo
¨ì SystemÀÌ Á¤»óÀÎÁö È®ÀÎ (RowµéÀ» Insert)
SVRMGR> ! more $ORACLE_HOME/labs/more_emp.sql
SVRMGR> @?/labs/more_emp
* Full Offline Backup ¼öÇà
¨í Database Shutdown
SVRMGR> shutdown immediate
SVRMGR> exit
¨î FileµéÀ» Backup
[/DBA3/DBA/dba¼ýÀÚ] cp -rp u0* backup
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/initDBA*.ora backup
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/cntrlDBA*.ctl backup
¨ï backup¿¡ °¡¼ È®ÀÎ
[/DBA3/DBA/dba¼ýÀÚ] cd backup
[/DBA3/DBA/dba¼ýÀÚ] ls -la
<SCENARIO 3 : Recovery - Temporary TablespaceÀÇ À¯½Ç>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> select tablespace_name, file_name from dba_data_files;
--> Temporary TablespaceÀÇ Data File °æ·Î¸íÀ» È®ÀÎ
SVRMGR> !ls -la /DBA3/DBA/dba¼ýÀÚ/u04/temp_01.dbf --> Å©±â È®ÀÎ
2) Failure¸¦ ¸¸µç´Ù.
SVRMGR> shutdown abort --> Failure¸¦ »ó»ó
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ]cd $ORACLE_HOME/u04
[/DBA3/DBA/dba¼ýÀÚ/u04]mv temp_01.dbf temp_01.org --> Temporary TablespaceÀÇ À¯½Ç
SVRMGR> connect internal
SVRMGR> startup mount
SVRMGR> alter database open;
alter database open
*
ORA-01157: cannot identify data file 4 - file not found
ORA-01110: data file 4: '/DBA3/DBA/dba¼ýÀÚ/u04/temp_01.dbf'
3) Recovery ¼öÇà
- Temporary Tablespace¶ó¸é DropÇÏ°í »õ·Î ¸¸µé¸é µÉ²¬?
SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u04/temp_01.dbf' offline drop;
Statement processed. --> Temporary Tablespace¸¦ Æ÷±âÇÏ°í Startup
SVRMGR> alter database open;
Stateent processed.
SVRMGR> select * from dba_tablespaces;
--> "Temp" Tablespace´Â ±×·¡µµ Á¸Àç
--> ¿Ö³Ä¸é Temp TablespaceÀÇ ±¸¼º File Áß Çϳª¸¦ DropÇÑ °Í »ÓÀ̴ϱî.
(¿©±â¼± ¿ì¿¬È÷ Çϳª¿´´Ù)
SVRMGR> drop tablespace temp including contents; --> ÀÌÁ¨ »õ·Î ¸¸µé¸é ³¡
SVRMGR> create tablespace temp
2> datafile '/DBA3/DBA/dba¼ýÀÚ/u04/temp_01.dbf' size 1M;
SVRMGR> shutdown immediate --> Shutdown°ú StartupÀ» ÇغÁ¼ Àß µÇ´ÂÁö È®ÀÎ
SVRMGR> startup
SVRMGR> shutdown immediate
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ/u04]rm temp_01.org --> ÇÊ¿ä ¾ø´Â FileÀ» »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ/u04]cd
<SCENARIO 4 : Noarchive Log Mode Recovery - DiskÀÇ À¯½Ç>
1) Failure¸¦ °¡Á¤ÇÏ°í Recovery ¼öÇà
- ¸ðµç FileµéÀ» RestoreÇÏ·Á´Â µ¥, "users_01.dbf"¸¦ ¿ø·¡ À§Ä¡¿¡ Restore ÇÒ ¼ö°¡ ¾ø´Ù.
µû¶ó¼, ÇÒ ¼ö ¾øÀÌ $ORACLE_HOME¿¡ Restore ÇÑ´Ù.
[/DBA3/DBA/dba¼ýÀÚ] cd backup
[/DBA3/DBA/dba¼ýÀÚ/backup] ls
cntrlDBA¼ýÀÚ.ctl u01 u03
initDBA¼ýÀÚ.ora u02 u04
[/DBA3/DBA/dba¼ýÀÚ/backup] cp -rp u0* $ORACLE_HOME
[/DBA3/DBA/dba¼ýÀÚ/backup] cp initDBA¼ýÀÚ.ora $ORACLE_HOME/dbs
[/DBA3/DBA/dba¼ýÀÚ/backup] cp cntrlDBA¼ýÀÚ.ctl $ORACLE_HOME/dbs
[/DBA3/DBA/dba¼ýÀÚ/backup] cd $ORACLE_HOME/u03
[/DBA3/DBA/dba¼ýÀÚ/u03]ls
query_01.dbf rbs_01.dbf users_01.dbf
[/DBA3/DBA/dba¼ýÀÚ/u03] mv users_01.dbf $ORACLE_HOME
--> users_01.dbf ÀÌ ´Ù¸¥ °÷À¸·Î ÀÌ»ç °¬´Ù.
[/DBA3/DBA/dba¼ýÀÚ/u03] cd
[/DBA3/DBA/dba¼ýÀÚ] ls -la users*
2) Startup ½Ãµµ
SVRMGR> connect internal
SVRMGR> startup mount
SVRMGR> alter database open;
alter database open
*
ORA-01157: cannot identify data file 3 - file not found
ORA-01110: data file 3: '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
SVRMGR> select name from v$datafile;
NAME
----------------------------------------------------------
/DBA3/DBA/dba¼ýÀÚ/u01/system.dbf
/DBA3/DBA/dba¼ýÀÚ/u03/rbs_01.dbf
/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf
/DBA3/DBA/dba¼ýÀÚ/u04/temp_01.dbf
/DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf
/DBA3/DBA/dba¼ýÀÚ/u01/index_01.dbf
6 rows selected.
--> Oracle Server´Â FileÀÌ ´Ù¸¥ °÷($ORACLE_HOME)¿¡ ÀÖ´Ù´Â °ÍÀ» ¸ð¸£³×.
3) ±×·³ ³»°¡ °¡¸£ÃÄ ÁÖÁö.
SVRMGR> alter database rename file '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
2> to '/DBA3/DBA/dba¼ýÀÚ/users_01.dbf';
4) ´Ù½Ã Open ½Ãµµ
SVRMGR> alter database open; --> ¼º°ø!!!
SVRMGR> shutdown immediate
SVRMGR> startup --> Çѹø ´õ È®ÀÎ
5) ¿ø·¡ »óÅ·Π¸¸µéÀÚ.
SVRMGR> shutdown immediate
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ]rm users_01.dbf
[/DBA3/DBA/dba¼ýÀÚ]cd backup
[/DBA3/DBA/dba¼ýÀÚ/backup]cp -rp u0* $ORACLE_HOME
[/DBA3/DBA/dba¼ýÀÚ/backup]cp initDBA¼ýÀÚ.ora $ORACLE_HOME/dbs
[/DBA3/DBA/dba¼ýÀÚ/backup]cp cntrlDBA¼ýÀÚ.ctl $ORACLE_HOME/dbs
[/DBA3/DBA/dba¼ýÀÚ/backup]cd
[/DBA3/DBA/dba¼ýÀÚ]svrmgrl
SVRMGR> connect internal
SVRMGR> startup --> ±¦È÷ È®ÀÎ
SVRMGR> shutdown
SVRMGR> exit
<SCENARIO 5 : Read Only TablespaceÀÇ Backup & Recovery>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp
2) Read Only TablespaceÀÇ Backup
- Online/Offline »óÅÂ, Áï DB°¡ »ç¿ëÁßÀÌ´øÁö »ç¿ëÁßÀÌ ¾Æ´Ï´øÁö °ü°è¾øÀÌ Copy
SVRMGR> !cp u03/query_01.dbf $ORACLE_HOME
3) Failure¸¦ ¸¸µç´Ù
- ¾÷¹« ¼öÇà Áß¿¡ query_01.dbf FileÀÌ »èÁ¦µÇ¾ú´Ù
SVRMGR> @?/labs/more_emp
SVRMGR> !rm u03/query_01.dbf
SVRMGR> select * from scott.new_dept;
ORA-01116: error in opening database file 5
ORA-01110: data file 5: '/DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf'
ORA-07368: sfofi: open error, unable to open database file.
SVR4 Error: 2: No such file or directory
4) Recovery ½ÃÀÛ
- Online/Offline »óÅÂ, Áï DB°¡ »ç¿ëÁßÀÌ´øÁö »ç¿ëÁßÀÌ ¾Æ´Ï´øÁö °ü°è¾øÀÌ Copy
SVRMGR> !cp $ORACLE_HOME/query_01.dbf u03
SVRMGR> select * from scott.new_dept; --> ÀÌ°Ô Recovery ÀüºÎ...
SVRMGR> shutdown
SVRMGR> exit
< SCENARIO 6 :DATABASEÀÇ BACKUP - Control File Mirroring & Archive log mode >
1) Control FileÀ» MirroringÇÏ¿© Database¸¦ StartUp
- parameter FileÀ» º¸°í ÇöÀçÀÇ "control_files=?????"¸¦ È®ÀÎ
[/DBA3/DBA/dba¼ýÀÚ] more dbs/initDBA¼ýÀÚ.ora
- Control FileÀ» º¹»ç
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/cntrlDBA¼ýÀÚ.ctl u01
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/cntrlDBA¼ýÀÚ.ctl u02
- Ãß°¡µÈ Control FileµéÀ» init<SID>.ora File¿¡ µî·Ï
[/DBA3/DBA/dba¼ýÀÚ] vi dbs/initDBA¼ýÀÚ.ora
(¼öÁ¤) control_files=($ORACLE_HOME/dbs/cntrlDBA¼ýÀÚ.ctl,
$ORACLE_HOME/u01/cntrlDBA¼ýÀÚ.ctl,
$ORACLE_HOME/u02/cntrlDBA¼ýÀÚ.ctl)
:wq
- Database¸¦ Startup
SVRMGR> connect internal
SVRMGR> startup
2) Database¸¦ Archive Log Mode·Î ¿î¿µ
- ÇöÀç Archive Log Mode¸¦ È®ÀÎ
SVRMGR> select * from v$logfile; --> On-Line Redo Log Fileµé È®ÀÎ
SVRMGR> archive log list --> No Archive Mode È®ÀÎ
- Archive Log Mode·Î Àüȯ & Parameter ¼öÁ¤
SVRMGR>shutdown immediate
SVRMGR>host
[/DBA3/DBA/dba¼ýÀÚ]vi dbs/initDBA¼ýÀÚ.ora
(¼öÁ¤) log_archive_start = true
log_archive_dest = $ORACLE_HOME/arch
log_archive_format = _%s.arc
:wq
[/DBA3/DBA/dba¼ýÀÚ]exit
SVRMGR>startup mount --> ¹Ýµå½Ã Mount·Î StartUp ÇØ¾ß ÇÔ
SVRMGR>alter database archivelog; --> Mode º¯°æ
SVRMGR>archive log list --> Archive Mode È®ÀÎ,
--> Current Log ¹øÈ£ ±â¾ï
SVRMGR>alter database open; --> ÇöÀç MountÀ̹ǷÎ
3) DocumentationÀ» À§ÇÑ Á¤º¸ Ž»ö
- Tablespace Á¤º¸
SVRMGR> select TABLESPACE_NAME, FILE_NAME, v$datafile.STATUS, ENABLED
2> from dba_data_files, v$datafile
3> where FILE_ID = FILE#;
- Log File Á¤º¸
SVRMGR> select v$logfile.MEMBER, v$logfile.GROUP#, v$log.STATUS, BYTES
2> from v$logfile, v$log
3> where v$logfile.GROUP# = v$log.GROUP#;
- Control File Á¤º¸
SVRMGR> select * from v$controlfile;
- °¢Á¾ Parameter Á¤º¸
SVRMGR> show parameter log
SVRMGR> show parameter db_block
SVRMGR> show parameter dump
4) SystemÀÌ Á¤»óÀÎÁö È®ÀÎ
- RowµéÀ» Insert
SVRMGR> host more $ORACLE_HOME/labs/more_emp.sql
SVRMGR> @?/labs/more_emp
- Archived Log FileÀÌ ¸¸µé¾î Áö´Â Áö È®ÀÎ
SVRMGR> host ls -la $ORACLE_HOME/*.arc --> Log File Á¸Àç È®ÀÎ
SVRMGR> archive log list --> Current Log ¹øÈ£ Áõ°¡ È®ÀÎ
5) Full Offline Backup ¼öÇà
- Database Shutdown
SVRMGR> shutdown immediate
SVRMGR> exit
- FileµéÀ» Backup (¸¸ÀÏÀ» À§Çؼ µÎ ¹ø Backup)
[/DBA3/DBA/dba¼ýÀÚ] cp -rp u0* dontouch
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/init*.ora dontouch
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/cntrl*.ctl dontouch
[/DBA3/DBA/dba¼ýÀÚ] cp -rp u0* backup
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/init*.ora backup
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/cntrl*.ctl backup
- È®ÀÎ
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 7 : Complete Recovery - UserÀÇ DATA FILE À¯½Ç>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
- ¾÷¹« ¼öÇà & Archived Log File È®ÀÎ
SVRMGR> !ls -la *.arc --> ÇöÀçÀÇ Archived Log File È®ÀÎ
SVRMGR> !more labs/more_emp.sql --> "scott" userÀÇ "s_emp" table¿¡ Row¸¦ Insert/Update ÇÏ´Â Script
SVRMGR> @?/labs/more_emp
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ] ls -la *.arc --> Archived Log File »ý¼º È®ÀÎ
2) Failure¸¦ ¸¸µç´Ù.
[/DBA3/DBA/dba¼ýÀÚ] ls u03 --> "USERS" Tablespace¸¦ ±¸¼ºÇÏ´Â File È®ÀÎ
[/DBA3/DBA/dba¼ýÀÚ] rm u03/users_01.dbf --> FIle »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] ls u03
SVRMGR> connect internal
SVRMGR> shutdown immediate --> Error ¹ß»ý & ½ÇÆÐ
SVRMGR> shutdown abort
SVRMGR> exit
3) Recovery ½ÃÀÛ
¨ç ¿¹Àü¿¡ ¹ÞÀº Full BackupÀ¸·ÎºÎÅÍ ¼Õ»óµÈ Data FileÀ» Restore
[/DBA3/DBA/dba¼ýÀÚ] cd backup/u03
[/DBA3/DBA/dba¼ýÀÚ/backup/u03] ls -la
[/DBA3/DBA/dba¼ýÀÚ/backup/u03] cp users_01.dbf $ORACLE_HOME/u03
- Recovery¸¦ ¼öÇà
¨è SVRMGR> startup
--> Error¿Í ÇÔ²² Mount±îÁö¸¸ ¼öÇà
--> Recovery¸¦ À§Çؼ± " Startup Mount " ÇÏ´Â°Ô Á¤»ó
Database mounted.
ORA-01113: file 3 needs media recovery
ORA-01110: data file 3: '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
¨é SVRMGR> recover database
ORA-00279: Change 7474 generated at 04/24/97 22:52:31 needed for thread 1
ORA-00289: Suggestion : /DBA3/DBA/dba27/arch_256.arc
ORA-00280: Change 7474 for thread 1 is in sequence #256
Specify log: {<RET>=suggested | filename | AUTO | CANCEL} --> ¿©·¯¹ø "Enter"¸¦ ´·¯¾ß ÇÔ
Media recovery complete.
¨ê SVRMGR> alter database open;
--> ÇöÀç°¡ "Mount" »óÅÂÀ̹ǷÎ
4) SystemÀÌ Á¤»óÀûÀ¸·Î º¹±¸ µÇ¾ú´ÂÁö È®ÀÎ
SVRMGR> select count(*) from scott.s_emp; --> Á¤»óÀûÀ¸·Î ¼öÇà µÊ
SVRMGR> shutdown immediate --> Á¤»óÀûÀ¸·Î ¼öÇà µÊ
SVRMGR> exit
<SCENARIO 8 : Complete Recovery - Tablespace Recovery>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
- ¾÷¹« ¼öÇà & Archived Log File È®ÀÎ
SVRMGR> !ls -la *.arc --> ÇöÀçÀÇ Archived Log File È®ÀÎ
SVRMGL> @?/labs/more_emp
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ]ls -la *.arc --> Archived Log File »ý¼º È®ÀÎ
2) Failure¸¦ ¸¸µç´Ù.
[/DBA3/DBA/dba¼ýÀÚ] ls $ORACLE_HOME/u03 --> "USERS" Tablespace¸¦ ±¸¼ºÇÏ´Â File È®ÀÎ
[/DBA3/DBA/dba¼ýÀÚ] rm $ORACLE_HOME/u03/users_01.dbf --> FIle »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] ls $ORACLE_HOME/u03
SVRMGR> connect internal
SVRMGR> shutdown immediate --> Error ¹ß»ý & ½ÇÆÐ
SVRMGR> shutdown abort
SVRMGR> exit
3) Recovery ½ÃÀÛ
- ¿¹Àü¿¡ ¹ÞÀº Full BackupÀ¸·ÎºÎÅÍ ¼Õ»óµÈ Data FileÀ» Restore
[/DBA3/DBA/dba¼ýÀÚ] cd backup/u03
[/DBA3/DBA/dba¼ýÀÚ/backup/u03] ls -la
[/DBA3/DBA/dba¼ýÀÚ/backup/u03] cp users_01.dbf $ORACLE_HOME/u03
- Recovery¸¦ ¼öÇà
SVRMGR> connect internal
SVRMGR> startup mount
SVRMGR> alter database open; --> Error
ORA-01113: file 3 needs media recovery
ORA-01110: data file 3: '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
SVRMGR> select FILE#, STATUS, NAME from v$datafile;
SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf' offline;
SVRMGR> select FILE#, STATUS, NAME from v$datafile;
SVRMGR> alter database open;
SVRMGR> select TABLESPACE_NAME, STATUS from dba_tablespaces;
SVRMGR> alter tablespace user_data offline immediate;
SVRMGR> select TABLESPACE_NAME, STATUS from dba_tablespaces;
SVRMGR> recover tablespace user_data
ORA-00279: Change 7220 generated at 02/24/97 23:51:30 needed for thread 1
ORA-00289: Suggestion : /DBA3/DBA/dba¼ýÀÚ/arch_219.arc
ORA-00280: Change 7220 for thread 1 is in sequence #219
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
auto - --> ÀÔ·ÂÇÏÀÚ
SVRMGR> alter tablespace user_data online;
SVRMGR> select count(*) from scott.s_emp; --> Á¤»óÀûÀ¸·Î ¼öÇà µÊ
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 9 : Complete Recovery - Datafile Recovery>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
- ¾÷¹« ¼öÇà & Archived Log File È®ÀÎ
SVRMGR> !ls -la *.arc --> ÇöÀçÀÇ Archived Log File È®ÀÎ
SVRMGR> @?/labs/more_emp
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ]ls -la *.arc --> Archived Log File »ý¼º È®ÀÎ
2) Failure¸¦ ¸¸µç´Ù.
[/DBA3/DBA/dba¼ýÀÚ] ls $ORACLE_HOME/u03 --> "USERS" Tablespace¸¦ ±¸¼ºÇÏ´Â File È®ÀÎ
[/DBA3/DBA/dba¼ýÀÚ] rm $ORACLE_HOME/u03/users_01.dbf --> FIle »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] ls $ORACLE_HOME/u03
SVRMGR> connect internal
SVRMGR> shutdown immediate --> Error ¹ß»ý & ½ÇÆÐ
SVRMGR> shutdown abort
SVRMGR> exit
3) Recovery ½ÃÀÛ
¨ç ¿¹Àü¿¡ ¹ÞÀº Full BackupÀ¸·ÎºÎÅÍ ¼Õ»óµÈ Data FileÀ» Restore
[/DBA3/DBA/dba¼ýÀÚ] cd backup/u03
[/DBA3/DBA/dba¼ýÀÚ/backup/u03] ls -la
[/DBA3/DBA/dba¼ýÀÚ/backup/u03] cp users_01.dbf $ORACLE_HOME/u03
- Recovery¸¦ ¼öÇà
SVRMGR> connect internal
¨è startup mount
¨é SVRMGR> alter database open;
ORA-01113: file 3 needs media recovery
ORA-01110: data file 3: '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
¨ê SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf' offline;
¨ë SVRMGR> alter database open;
¨ì SVRMGR> recover datafile '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
ORA-00279: Change 7220 generated at 02/24/97 23:51:30 needed for thread 1
ORA-00289: Suggestion : /DBA3/DBA/dba¼ýÀÚ/arch_219.arc
ORA-00280: Change 7220 for thread 1 is in sequence #219
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
"Return key"¸¦ ¿©·¯¹ø ´©¸£°Å³ª, "auto"¸¦ ÀÔ·ÂÇÏÀÚ
¨í SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf' online;
SVRMGR> select count(*) from scott.s_emp; --> Á¤»óÀûÀ¸·Î ¼öÇà µÊ
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 10 : Parallel Recovery>
1) Parallel ȯ°æ setup
- parameter fileÀ» ¼öÁ¤ÇÏ¿© parallel ȯ°æÀ» ¸¸µç´Ù.
Parallel_min_servers = 2
Parallel_max_servers = 4
Recovery_parallelism = 4
- DB¸¦ ´Ù½Ã ±âµ¿ÇÑ ÈÄ background processµé (p000, p001) À» È®ÀÎÇÑ´Ù.
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> host ps -ef | grep <SID>
SVRMGR> select count(*) from scott.s_emp;
SVRMGR> shutdown immediate
2) user_data tablespace¸¦ backup¹Þ°í DB ±âµ¿ÈÄ, Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
[/DBA3/DBA/dba¼ýÀÚ]cp u03/users_01.dbf u03/users_01.bak
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp -----> rowµéÀ» insert
3) Failure¸¦ ¸¸µç´Ù.
SVRMGR> shutdown immediate
SVRMGR> host rm $ORACLE_HOME/u03/users_01.dbf
4) DB º¹±¸ ÀÛ¾÷
- backup ¹ÞÀº fileÀ» restore ½ÃŲ ÈÄ, Database¸¦ mount ½ÃŲ´Ù.
SVRMGR> !mv u03/users_01.bak u03/users_01.dbf
SVRMGR> startup mount
SVRMGR> alter database open
ORA-01113: file 3 needs media recovery
ORA-01110: data file 3: '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
- DB parallel recovery ÈÄ DB open
SVRMGR> set autorecovery on
SVRMGR> recover database parallel (degree 4)
......
Media recovery complete.
SVRMGR> alter database open
5) SystemÀÌ Á¤»óÀÎÁö È®ÀÎ
SVRMGR> select count(*) from scott.s_emp;
SVRMGR> !ps -ef | grep <SID> ----> p002, p003 È®ÀÎ (<- degree 4)
- 5ºÐ ÀÌ»ó °æ°ú ÈÄ, p002, p003ÀÌ Á¸ÀçÇÏ´ÂÁö È®ÀÎÇÑ´Ù.
SVRMGR> !ps -ef | grep <SID>
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 11 : Complete Recovery - Shutdown ÇÏÁö ¾Ê°í Data File¸¸ Recovery>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
- ¾÷¹« ¼öÇà & Archived Log File È®ÀÎ
SVRMGR> !ls -la *.arc --> ÇöÀçÀÇ Archived Log File È®ÀÎ
SVRMGR> @?/labs/more_emp
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ] ls -la *.arc --> Archived Log File »ý¼º È®ÀÎ
2) Failure¸¦ ¸¸µç´Ù.
[/DBA3/DBA/dba¼ýÀÚ] ls $ORACLE_HOME/u03 --> "USERS" Tablespace¸¦ ±¸¼ºÇÏ´Â File È®ÀÎ
[/DBA3/DBA/dba¼ýÀÚ] rm $ORACLE_HOME/u03/users_01.dbf --> FIle »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] ls $ORACLE_HOME/u03
SVRMGR> connect internal
SVRMGR> select * from scott.s_dept;
ID NAME REGION_ID
---------- ------------------------- ----------
ORA-01116: error in opening database file 3
ORA-01110: data file 3: '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
ORA-07368: sfofi: open error, unable to open database file.
SVR4 Error: 2: No such file or directory
3) Recovery ½ÃÀÛ
¨ç ¿¹Àü¿¡ ¹ÞÀº Full BackupÀ¸·ÎºÎÅÍ ¼Õ»óµÈ Data FileÀ» Restore
[/DBA3/DBA/dba¼ýÀÚ] cd backup/u03
[/DBA3/DBA/dba¼ýÀÚ/backup/u03] ls -la
[/DBA3/DBA/dba¼ýÀÚ/backup/u03] cp users_01.dbf $ORACLE_HOME/u03
- Recovery¸¦ ¼öÇà
SVRMGR> connect internal
SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf' offline;
SVRMGR> recover datafile '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
ORA-00279: Change 7220 generated at 02/24/97 23:51:30 needed for thread 1
ORA-00289: Suggestion : /DBA3/DBA/dba¼ýÀÚ/arch_219.arc
ORA-00280: Change 7220 for thread 1 is in sequence #219
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
"Return key"¸¦ ¿©·¯¹ø ´©¸£°Å³ª, "auto"¸¦ ÀÔ·ÂÇÏÀÚ
SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf' online;
SVRMGR> select count(*) from scott.s_emp; --> Á¤»óÀûÀ¸·Î ¼öÇà µÊ
SVRMGR> select * from scott.s_dept; --> Á¤»óÀûÀ¸·Î ¼öÇà µÊ
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 12 : Online Backup (Hot Backup)>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
- ¾÷¹« ¼öÇà & Archived Log File È®ÀÎ
SVRMGR> !ls -la *.arc --> ÇöÀçÀÇ Archived Log File È®ÀÎ
SVRMGR> @?/labs/more_emp
SVRMGR> !ls -la *.arc --> Archived Log File »ý¼º È®ÀÎ
2) Online Backup
¨ç Data FileµéÀÇ Online Backup : datafileº°·Î backup¹Þ´Â´Ù.
SVRMGR> select tablespace_name, file_name from dba_data_files;
SVRMGR> select status, enabled, name from v$datafile;
--> enabled°¡ "READ ONLY" Tablespace´Â Online Backup½Ã¿¡ Á¦¿Ü
SVRMGR> !mkdir $ORACLE_HOME/online_backup
SVRMGR> alter tablespace system begin backup;
SVRMGR> !cp u01/system.dbf online_backup
SVRMGR> alter tablespace system end backup;
SVRMGR> alter tablespace rbs begin backup;
SVRMGR> !cp u03/rbs_01.dbf online_backup
SVRMGR> alter tablespace rbs end backup;
SVRMGR> alter tablespace user_data begin backup;
SVRMGR> !cp u03/users_01.dbf online_backup
SVRMGR> alter tablespace user_data end backup;
SVRMGR> alter tablespace temp begin backup;
SVRMGR> !cp u04/temp_01.dbf online_backup
SVRMGR> alter tablespace temp end backup;
SVRMGR> alter tablespace user_index begin backup;
SVRMGR> !cp u01/index_01.dbf online_backup
SVRMGR> alter tablespace user_index end backup;
SVRMGR> alter system switch logfile;
¨è Read-only Tablespace Backup
Read-only Tablespace´Â ¿¹Àü Backup¿¡ ÀÌ¹Ì CopyµÇ¾î ÀÖÀ¸¹Ç·Î ´Ù½Ã ¼öÇàÇÒ ÇÊ¿ä°¡ ¾ø´Ù.
±×·¡µµ ²À ÇÏ°Ú´Ù¸é "alter tablespace ...begin/end backup" ¾øÀÌ ¼öÇà
¿¡ÀÌ, ¸» ³ª¿Â ±è¿¡ Çѹø Çغ¸ÀÚ......
SVRMGR> !cp u03/query_01.dbf online_backup
¨é Control FileÀÇ Online Backup
SVRMGR> alter database backup controlfile to
'$ORACLE_HOME/online_backup/backup_control.ctl' reuse;
SVRMGR> alter database backup controlfile to trace;
¨ê Parameter FileÀÇ Backup
SVRMGR> !cp dbs/initDBA¼ýÀÚ.ora online_backup
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 13 : Online Backup ½ÇÆÐÈÄ Recovery - Online Backup µµÁß¿¡ Á¤Àü>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿ & ¾÷¹« ¼öÇà
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp
2) Online Backup
- Data FileµéÀÇ Online Backup
SVRMGR> alter tablespace user_data begin backup;
SVRMGR> !cp u03/users_01.dbf online_backup
SVRMGR> shutdown abort --> Á¤Àü »çÅ ¹ß»ý
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ] svrmgrl --> ´Ù½Ã Àü¿øÀÌ µé¾î¿Í¼ DB¸¦ »ì¸®·Á°í ½Ãµµ
SVRMGR> connect internal
SVRMGR> startup
ORA-01113: file 3 needs media recovery
ORA-01110: data file 3: '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf'
--> ¾î? ÀÌ»óÇÏ´Ù....¾ÆÇÏ! ÀÌ°ÍÂëÀ̾ß..
SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u03/users_01.dbf' end backup;
SVRMGR> alter database open;
SVRMGR> --> Online BackupÀ» ´Ù½Ã ¹ÞÀ¸¸é µÈ´Ù
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 14 : Incomplete Recovery - ½Ç¼ö·Î DropÇÑ TableÀÇ º¹±¸>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp
2) Failure¸¦ ¸¸µç´Ù.
SVRMGR> !date --> ÇöÀçÀÇ ½Ã°£À» ±â¾ïÇØ¾ß ÇÔ
SVRMGR> drop table scott.s_emp cascade constraints; --> ½Ç¼ö·Î Drop ÇÏ¿´´Ù°í °¡Á¤
SVRMGR> select * from scott.s_emp;
select * from scott.s_emp
*
ERROR at line 1:
ORA-00942: table or view does not exist --> ÀÌÁ¦¿Í¼ ÈÄȸ
3) Recovery ¼öÇà
- ¿¹Àü¿¡ ¹ÞÀº Full BackupÀ¸·ÎºÎÅÍ Data FileµéÀ» Restore
SVRMGR> shutdown immediate
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ] cd backup
[/DBA3/DBA/dba¼ýÀÚ/backup] ls
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u01/*.dbf $ORACLE_HOME/u01
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u03/*.dbf $ORACLE_HOME/u03
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u04/*.dbf $ORACLE_HOME/u04
- Incomplete Recovery ¼öÇà
SVRMGR> connect internal
SVRMGR> startup mount
¨ç SVRMGR> set autorecovery on
¨è SVRMGR> recover database until time '1997-01-23:16:44:47'
--> ¾Õ¿¡¼ ±â¾ïÇÑ ½Ã°£À̾î¾ß ÇÔ
¨é SVRMGR> alter database open resetlogs; --> Incomplete Recovery À̴ϱî "resetlogs"·Î Open
¨ê SVRMGR> archive log list --> Log Sequence ¹øÈ£°¡ ResetµÇ¾úÀ½
SVRMGR> select * from scott.s_emp; --> Drop µÇ¾ú´ø "s_emp" TableÀÌ ´Ù½Ã »ì¾Æ³µ´Ù.
SVRMGR> shutdown immediate
SVRMGR> exit
¨ë Log Sequence ¹øÈ£°¡ Reset µÇ¾úÀ¸´Ï±î Off-Line Full Backup ¼öÇà
[/DBA3/DBA/dba¼ýÀÚ/backup] cd $ORACLE_HOME
[/DBA3/DBA/dba¼ýÀÚ] cp -rp u0* backup
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/cntrl*.ctl backup
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/init*.ora backup
- ´õ ÀÌ»ó ÇÊ¿ä ¾ø´Â FileµéÀ» »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] rm *.arc
[/DBA3/DBA/dba¼ýÀÚ] ls
<SCENARIO 15 : Inactive Online Redo Log GroupÀÇ À¯½Ç>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
SVRMGR> connect / as sysdba --> connect internal°ú °°À½
SVRMGR> startup
SVRMGR> @?/labs/more_emp
2) Failure¸¦ ¸¸µç´Ù.
- Inactive Online Redo Log GroupÀ» À¯½Ç
SVRMGR> select v$logfile.member from v$logfile where group# =
( select min(v$log.group#) from v$log where status = 'INACTIVE');
MEMBER
------------------------------------------------------------
/DBA3/DBA/dba¼ýÀÚ/u01/log2a.rdo --> ¿¹¸¦ µé¾î¼...¶ó¸é
/DBA3/DBA/dba¼ýÀÚ/u02/log2b.rdo
2 rows selected.
SVRMGR> !ls u01 u02
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u01/log2a.rdo
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u02/log2b.rdo
SVRMGR> !ls u01 u02
- Database°¡ ºñÁ¤»óÀûÀ¸·Î ¼öÇàµÊÀ» È®ÀÎ
SVRMGR> connect / as sysdba
SVRMGR> @more_emp --> Online Redo Log FIleÀÇ À¯½Ç·Î ÀÎÇØ Error ¹ß»ý
SVRMGR> shutdown immediate --> shutdown ½ÇÆÐ (Server Process°¡ Á×¾ú´Ù)
SVRMGR> exit --> exit Çß´Ù°¡ ´Ù½Ã µé¾î°¡ÀÚ.
3) Recovery ½ÃÀÛ
SVRMGR> connect / as sysdba
SVRMGR> shutdown abort
SVRMGR> startup --> Mount±îÁö¸¸ ¼öÇàµÊ
SVRMGR> select * from v$logfile; --> Log FIleÀÇ À¯½ÇÀÌ ¹Ý¿µµÇÁö ¾Ê¾ÒÀ½À» È®ÀÎ
SVRMGR> alter database backup controlfile to trace; --> ±×³É ½À°üÀûÀ¸·Î
SVRMGR> alter database drop logfile group ±×·ì¹øÈ£; --> Log FIleÀÇ À¯½ÇÀ» ¹Ý¿µ
SVRMGR> select * from v$logfile; --> Log FIleÀÇ À¯½ÇÀÌ ¹Ý¿µµÇ¾úÀ½À» È®ÀÎ
SVRMGR> alter database add logfile group ±×·ì¹øÈ£
2> '/DBA3/DBA/dba¼ýÀÚ/u01/log±×·ì¹øÈ£a.rdo' size 150k;
--> À¯½ÇµÈ Online Redo Log GroupÀÇ Ã¹¹ø° Member¸¦ »ý¼º
SVRMGR> alter database add logfile member '/DBA3/DBA/dba¼ýÀÚ/u02/log±×·ì¹øÈ£b.rdo' to group ±×·ì¹øÈ£;
--> º¹±¸µÈ Online Redo Log GroupÀÇ µÎ¹ø° Member¸¦ »ý¼º
SVRMGR> select * from v$logfile; --> Log FileµéÀÌ »ý¼ºµÇ¾ú´ÂÁö È®ÀÎ
--> Invalid´Â ³ªÁß¿¡ ¾ø¾îÁö´Ï±î ³î¶óÁö ¸¶¼¼¿ä.
SVRMGR> alter database open; --> Database¸¦ Open
4) SystemÀÌ Á¤»óÀûÀ¸·Î º¹±¸ µÇ¾ú´ÂÁö È®ÀÎ
SVRMGR> @more_emp
SVRMGR> select * from v$logfile; --> À½, Invalid°¡ ¾ø¾îÁ³±¸³ª.
SVRMGR> shutdown immediate
SVRMGR> startup --> startupµµ Á¦´ë·Î µÇ´Â±¸³ª.
SVRMGR> shutdown immediate
SVRMGR> exit
[/DBA3/DBA/dba26/labs] cd
<SCENARIO 16 : Current Online Redo Log GroupÀÇ À¯½Ç>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp
SVRMGR> !ls -la *.arc
2) Failure¸¦ ¸¸µç´Ù.
- Current Online Redo Log GroupÀ» À¯½Ç
SVRMGR> select v$logfile.member from v$logfile where group# =
( select min(v$log.group#) from v$log where status = 'CURRENT');
MEMBER
----------------------------------------------------------------
/DBA3/DBA/dba¼ýÀÚ/u01/log1a.rdo --> ¿¹¸¦ µé¾î ...¶ó¸é
/DBA3/DBA/dba¼ýÀÚ/u02/log1b.rdo
2 rows selected.
SVRMGR> !ls u01 u02
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u01/log1a.rdo
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u02/log1b.rdo
SVRMGR> !ls u01 u02
- Database°¡ ºñÁ¤»óÀûÀ¸·Î ¼öÇàµÊÀ» È®ÀÎ
SVRMGR> @?/labs/more_emp --> Online Redo Log FIleÀÇ À¯½Ç·Î ÀÎÇØ Error ¹ß»ý
--> ¹«ÇÑÁ¤ ´ë±âÇÏ°Ô µÈ´Ù. Why?
--> "Ctrl-C"¸¦ µÎ¹ø ´·¯¼ °Á¦ Á¾·á
SVRMGR> shutdown immediate
3) Recovery ½ÃÀÛ
- À¯½ÇµÈ Redo Log GroupÀ» Á¦°ÅÇÏ°í Àç»ý¼ºÇÔÀ¸·Î½á ÇØ°áÇÒ·Á°í ½Ãµµ
SVRMGR> startup --> Redo Log GroupÀÌ À¯½Ç µÇ¾úÀ½À» ¾Ë¸®¸ç Error ¹ß»ý
--> Log Group ¹øÈ£ È®ÀÎÇÒ °Í
--> Mount±îÁö¸¸ ¼öÇàµÈ´Ù
SVRMGR> alter database drop logfile group ±×·ì¹øÈ£;
--> À¯½ÇµÈ Redo Log GroupÀ» Á¦°Å ½Ãµµ
--> ArchiveµÇÁö ¾ÊÀº Current LogÀ̹ǷΠError¿Í ÇÔ²² ½ÇÆÐ
--> (Âü°í) ORA-00350: log ±×·ì¹øÈ£ of thread 1 needs to be archived
SVRMGR> shutdown immediate
SVRMGR> exit
- Alert File, Trace File È®ÀÎ
[/DBA3/DBA/dba¼ýÀÚ/labs] cd $ORACLE_HOME/trace
[/DBA3/DBA/dba¼ýÀÚ/trace] ls
[/DBA3/DBA/dba¼ýÀÚ/trace] vi alert_DBA¼ýÀÚ.log
--> ArchivingÀ» ½ÇÆÐÇÑ ±â·Ï°ú Sequence ¹øÈ£ È®ÀÎ
[/DBA3/DBA/dba¼ýÀÚ/trace] more arch_¹øÈ£.trc
--> ±â·ÏµÇÁö ¾ÊÀº Log FileÀÇ Sequence ¹øÈ£ È®ÀÎ
--> (¿¹)ORA-00255: error archiving log 1 of thread 1, sequence # 15
--> Incomplete Recovery ¹æ¹ýÀ¸·Î º¹±¸
--> ¿¹¸¦ µé¾î sequence # 15¹øÀ̶ó¸é Incomplete Recovery½Ã
15¹ø ¿¡¼ "Cancel" À» ÀÔ·ÂÇÒ°Å´Ù.
- ¿¹Àü¿¡ ¹ÞÀº Full BackupÀ¸·ÎºÎÅÍ Data FileµéÀ» Restore
[/DBA3/DBA/dba¼ýÀÚ/trace]cd $ORACLE_HOME/backup
[/DBA3/DBA/dba¼ýÀÚ/backup]cp u01/*.dbf $ORACLE_HOME/u01
[/DBA3/DBA/dba¼ýÀÚ/backup]cp u03/*.dbf $ORACLE_HOME/u03
[/DBA3/DBA/dba¼ýÀÚ/backup]cp u04/*.dbf $ORACLE_HOME/u04
- Incomplete Recovery ¼öÇà
SVRMGR> connect internal
SVRMGR> startup mount
SVRMGR> recover database until cancel
"cancel" ÀÔ·Â
--> °è¼Ó "Enter"¸¦ ´©¸£´Ù°¡ 15¹ø ¿¡¼ "Cancel" À» ÀÔ·Â
SVRMGR> alter database open resetlogs;
--> Incomplete Recovery À̴ϱî "resetlogs"·Î Open
--> À̶§ À¯½ÇµÈ Log FileÀÌ ÀÚµ¿À¸·Î ¸¸µé¾î Áø´Ù
SVRMGR> archive log list --> Log Sequence ¹øÈ£°¡ ResetµÇ¾úÀ½
SVRMGR> shutdown immediate
SVRMGR> exit
- Log Sequence ¹øÈ£°¡ Reset µÇ¾úÀ¸´Ï±î Off-Line Full Backup ¼öÇà
[/DBA3/DBA/dba¼ýÀÚ/backup]cd $ORACLE_HOME
[/DBA3/DBA/dba¼ýÀÚ] cp -rp u0* backup
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/cntrl*.ctl backup
[/DBA3/DBA/dba¼ýÀÚ] cp dbs/init*.ora backup
- ´õ ÀÌ»ó ÇÊ¿ä ¾ø´Â FileµéÀ» »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] cd trace
[/DBA3/DBA/dba¼ýÀÚ/trace] rm *.trc --> Trace Fileµé »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ/trace]rm alert*.log --> Alert Log File »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ/trace]cd $ORACLE_HOME
[/DBA3/DBA/dba¼ýÀÚ]rm *.arc --> Archived Redo Log Fileµé »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ]ls -la *.arc --> Fileµé »èÁ¦ È®ÀÎ
4) SystemÀÌ Á¤»óÀûÀ¸·Î º¹±¸ µÇ¾ú´ÂÁö È®ÀÎ
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp --> À½, Àß µÇ´Â ±º
SVRMGR> !ls -la *.arc --> »õ·Î¿î Archived Redo Log FileµéÀÌ ¸¸µé¾î Áö´Â Áö È®ÀÎ
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 17 : ¸ðµç Online Redo Log GroupÀÇ À¯½Ç>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp
SVRMGR> !ls -la *.arc
2) Failure¸¦ ¸¸µç´Ù.
- ¸ðµç Online Redo Log GroupÀ» À¯½Ç
SVRMGR> !ls u01 u02
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u01/log*.rdo
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u02/log*.rdo
- Database°¡ ºñÁ¤»óÀûÀ¸·Î ¼öÇàµÊÀ» È®ÀÎ
SVRMGR> @?/labs/more_emp --> Online Redo Log FIleÀÇ À¯½Ç·Î ÀÎÇØ Error ¹ß»ý
SVRMGR> !ps -ef|grep dba¼ýÀÚ|sort|more --> Background Precessµé°ú Server ProcessµéÀÌ Á×¾ú´Ù
3) Recovery ½ÃÀÛ
- ¾Õ¿¡¼ ¹è¿î ²Ç¼ö·Î ÇØ°áÇØ º¸ÀÚ
SVRMGR> shutdown immediate --> shutdown ½ÇÆÐ (ProcessµéÀÌ Á×¾úÀ¸´Ï±î)
SVRMGR> shutdown abort --> shutdown ½ÇÆÐ (ProcessµéÀÌ Á×¾úÀ¸´Ï±î)
SVRMGR> exit --> exit Çß´Ù°¡ ´Ù½Ã µé¾î°¡ÀÚ.
SVRMGR> connect internal
SVRMGR> shutdown immediate
ORA-01012: not logged on
SVRMGR> shutdown abort
ORACLE instance shut down.
SVRMGR> startup
ORA-00313: open failed for members of log group 3 of thread 1
ORA-00312: online log 3 thread 1: '/DBA3/DBA/dba¼ýÀÚ/u02/log3a.rdo'
ORA-07360: sfifi: stat error, unable to obtain information about file.
.............
SVRMGR> recover database until cancel;
ORA-00279: Change 8064 generated at 01/20/98 13:02:09 needed for thread 1
ORA-00289: Suggestion : /DBA3/DBA/dba¼ýÀÚ/arch_9.arc
ORA-00280: Change 8064 for thread 1 is in sequence #9
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
"cancel" ÀÔ·Â
Media recovery cancelled.
SVRMGR> alter database open resetlogs;
alter database open resetlogs
*
ORA-01194: file 1 needs more recovery to be consistent
ORA-01110: data file 1: '/DBA3/DBA/dba¼ýÀÚ/u01/system.dbf'
--> ¾Ñ! ¾î´õ·¹ÄÉ µÈ°Å¾ß? .....²Ç¼ö°¡ ¾È ÅëÇÏÀݾÆ?
??? ÇÒ ¼ö ¾ø´Ù. Á¤½ÄÀ¸·Î Çѹø ÇØ º¸ÀÚ.
SVRMGR> exit
- Á¤»óÀûÀÎ Incomplete Recovery ¼öÇà
[/DBA3/DBA/dba¼ýÀÚ] cd $ORACLE_HOME/backup
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u01/*.dbf $ORACLE_HOME/u01
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u03/*.dbf $ORACLE_HOME/u03
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u04/*.dbf $ORACLE_HOME/u04
SVRMGR> connect internal
SVRMGR> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /DBA3/DBA/dba¼ýÀÚ/arch
Oldest online log sequence 4
Next log sequence to archive 5
Current log sequence 5
--> ¿¹¸¦ µé¾î "Next log sequence to archive 5" ¹øÀ̶ó¸é
Incomplete Recovery ½Ã 5¹ø ¿¡¼ "Cancel" À» ÀÔ·ÂÇÒ°Å´Ù.
SVRMGR> recover database until cancel
"cancel" ÀÔ·Â --> °è¼Ó "Enter"¸¦ ´©¸£´Ù°¡ 5¹ø ¿¡¼ "Cancel" À» ÀÔ·Â
SVRMGR> alter database open resetlogs;
SVRMGR> archive log list
- Log Sequence ¹øÈ£°¡ Reset µÇ¾úÀ¸´Ï±î Offline Full Backup ¼öÇà
SVRMGR> shutdown immediate
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ/backup] cd $ORACLE_HOME
[/DBA3/DBA/dba¼ýÀÚ] cp -rp u0* backup
[/DBA3/DBA/dba¼ýÀÚ] cp -p dbs/cntrl*.ctl backup
[/DBA3/DBA/dba¼ýÀÚ] cp -p dbs/init*.ora backup
- ´õ ÀÌ»ó ÇÊ¿ä ¾ø´Â FileµéÀ» »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] rm *.arc --> Archived Redo Log Fileµé »èÁ¦
4) SystemÀÌ Á¤»óÀûÀ¸·Î º¹±¸ µÇ¾ú´ÂÁö È®ÀÎ
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp --> À½, Àß µÇ´Â ±º
SVRMGR> !ls -la *.arc --> »õ·Î¿î Archived Redo Log FileµéÀÌ ¸¸µé¾î Áö´Â Áö È®ÀÎ
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 18 : ¸ðµç Redo Log & Data File À¯½Ç>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
- Database¸¦ ±âµ¿
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp
SVRMGR> !ls -la *.arc
2) Failure¸¦ ¸¸µç´Ù.
- ¸ðµç Online Redo Log GroupÀ» À¯½Ç
SVRMGR> !ls u01 u02
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u01/log*.rdo
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u02/log*.rdo
- datafileÀ» À¯½Ç
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u01/system.dbf
SVRMGR> !rm /DBA3/DBA/dba¼ýÀÚ/u01/index_01.dbf
- Á¤Àü±îÁö µÇ¾ú´Ù°í °¡Á¤
SVRMGR> shutdown abort
3) Recovery ½ÃÀÛ
- Incomplete Recovery ¼öÇà
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ] cd $ORACLE_HOME/backup
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u01/*.dbf $ORACLE_HOME/u01
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u03/*.dbf $ORACLE_HOME/u03
[/DBA3/DBA/dba¼ýÀÚ/backup] cp u04/*.dbf $ORACLE_HOME/u04
SVRMGR> connect internal
SVRMGR> startup mount
SVRMGR> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /DBA3/DBA/dba¼ýÀÚ/arch
Oldest online log sequence 3
Next log sequence to archive 5
Current log sequence 5
--> ¿¹¸¦ µé¾î "Next log sequence to archive 5" ¹øÀ̶ó¸é
Incomplete Recovery ½Ã 5¹ø ¿¡¼ "Cancel" À» ÀÔ·ÂÇÒ°Å´Ù.
SVRMGR> recover database until cancel
"cancel" ÀÔ·Â --> °è¼Ó "Enter"¸¦ ´©¸£´Ù°¡ 5¹ø ¿¡¼ "Cancel" À» ÀÔ·Â
SVRMGR> alter database open resetlogs;
- Log Sequence ¹øÈ£°¡ Reset µÇ¾úÀ¸´Ï±î Offline Full Backup ¼öÇà
SVRMGR> shutdown immediate
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ/backup] cd $ORACLE_HOME
[/DBA3/DBA/dba¼ýÀÚ] cp -rp u0* backup
[/DBA3/DBA/dba¼ýÀÚ] cp -p dbs/cntrl*.ctl backup
[/DBA3/DBA/dba¼ýÀÚ] cp -p dbs/init*.ora backup
- ´õ ÀÌ»ó ÇÊ¿ä ¾ø´Â FileµéÀ» »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] rm *.arc --> Archived Redo Log Fileµé »èÁ¦
4) SystemÀÌ Á¤»óÀûÀ¸·Î º¹±¸ µÇ¾ú´ÂÁö È®ÀÎ
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp --> À½, Àß µÇ´Â ±º
SVRMGR> !ls -la *.arc --> »õ·Î¿î Archived Redo Log FileµéÀÌ ¸¸µé¾î Áö´Â Áö È®ÀÎ
SVRMGR> shutdown immediate
SVRMGR> exit
<SCENARIO 19 : Control File Recreate>
1) Á¤»óÀûÀÎ ¾÷¹« Áß Control File Creation Script¸¦ »ý¼º
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> !ps -ef|grep dba¼ýÀÚ|sort --> ÇöÀç Server ProcessÀÇ ¹øÈ£ È®ÀÎ
SVRMGR> alter database backup controlfile to trace;
SVRMGR> !
$ cd $ORACLE_HOME/trace
$ ls
$ cp ora_ÇÁ·Î¼¼¼¹øÈ£.trc control.sql
2) Control FileµéÀ» ¸ðµÎ »èÁ¦
$ rm $ORACLE_HOME/dbs/cntrlDBA¼ýÀÚ.ctl
$ rm $ORACLE_HOME/u01/cntrlDBA¼ýÀÚ.ctl
$ rm $ORACLE_HOME/u02/cntrlDBA¼ýÀÚ.ctl
$ exit
SVRMGR> shutdown immediate
SVRMGR> startup
ORA-00205: error identifying controlfile '$ORACLE_HOME/dbs/cntrlDBA¼ýÀÚ.ctl'
ORA-07360: sfifi: stat error, unable to obtain information about file.
SVR4 Error: 2: No such file or directory
SVRMGR> shutdown
SVRMGR> exit
3) Control FileÀ» »õ·Î »ý¼º
[/DBA3/DBA/dba¼ýÀÚ]cd trace
[/DBA3/DBA/dba¼ýÀÚ/trace]ls
[/DBA3/DBA/dba¼ýÀÚ/trace]vi control.sql --> "STARTUP NOMOUNT" ¾Õ±îÁö ¸ðµÎ »èÁ¦
--> "RECOVER DATABASE" »èÁ¦
SVRMGR> connect internal
SVRMGR> @control.sql
SVRMGR> !ls $ORACLE_HOME/dbs
SVRMGR> !ls $ORACLE_HOME/u01
SVRMGR> !ls $ORACLE_HOME/u02
4) Á¤»óÀÎÁö È®ÀÎ
SVRMGR> @?/labs/more_emp
SVRMGR> !ls $ORACLE_HOME
SVRMGR> shutdown immediate
SVRMGR> exit
[/DBA3/DBA/dba¼ýÀÚ/trace] cd
[/DBA3/DBA/dba¼ýÀÚ]
<SCENARIO 20 : ¸ðµç Control File À¯½Ç>
* À̹øÀÇ ½Ã³ª¸®¿À´Â DatabaseÀÇ Mode(Archive/Noarchive)¿¡ °ü°è ¾øÀÌ ¸ðµÎ °¡´É
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp
SVRMGR> !ls *.arc
2) Failure¸¦ ¸¸µç´Ù.
- Control FileÀ» ¸ðµÎ »èÁ¦
SVRMGR> !rm dbs/*.ctl u01/*.ctl u02/*.ctl
SVRMGR> shutdown abort --> ²Ð! (»ç¸ÁÇϽô ¼Ò¸®)
SVRMGR> exit
3) Recovery ½ÃÀÛ
[/DBA3/DBA/dba¼ýÀÚ]cp backup/cntrlDBA¼ýÀÚ.ctl dbs
[/DBA3/DBA/dba¼ýÀÚ]cp backup/cntrlDBA¼ýÀÚ.ctl u01
[/DBA3/DBA/dba¼ýÀÚ]cp backup/cntrlDBA¼ýÀÚ.ctl u02
SVRMGR> connect internal
SVRMGR> startup mount
SVRMGR> recover database using backup controlfile
ORA-00283: Recovery session canceled due to errors
ORA-01233: file 5 is read only - cannot recover using backup controlfile
ORA-01110: data file 5: '/DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf'
--> read only FileÀÌ ÀÖÀ¸¸é ¹Ýµå½Ã offline½ÃÄÑ¾ß ÇÑ´Ù
SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf' offline;
SVRMGR> recover database using backup controlfile
ORA-00279: Change 8050 generated at 01/20/98 15:22:26 needed for thread 1
ORA-00289: Suggestion : /DBA3/DBA/dba¼ýÀÚ/arch_5.arc
ORA-00280: Change 8050 for thread 1 is in sequence #5
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
Online Redo Log File ¸íÀ» Full Path·Î ÀÔ·Â
(¿¹) /DBA3/DBA/dba¼ýÀÚ/u01/log1a.rdo --> ÀÔ·Â
±×·±µ¥, Ưº°È÷ ¿îÀÌ ÁÁÁö ¾Ê´Ù¸é, ´ÙÀ½ÀÇ ¿¡·¯°¡ ³´Ù
(¿¡·¯ ¸Þ½ÃÁö)
ORA-00310: archived log contains sequence 4; sequence 5 required
ORA-00334: archived log: '/DBA3/DBA/dba¼ýÀÚ/u01/log1a.rdo'
±×·¸´Ù¸é, recover¿Í File¸í ÀÔ·ÂÀ» ´Ù½Ã ½Ãµµ
(¿¹)
SVRMGR> recover database using backup controlfile --> ´Ù½Ã ¼öÇà
/DBA3/DBA/dba¼ýÀÚ/u01/log2a.rdo --> ´Ù¸¥ Redo Log File ¸í ÀÔ·Â
´ÙÀ½ÀÇ ¸Þ½ÃÁö¸¦ º¼ ¶§±îÁö ´Ù¸¥ Redo Log File¿¡µµ ¼öÇà
(º¸¿©¾ß ÇÏ´Â ¸Þ½ÃÁö)
Log applied.
Media recovery complete. --> ÀÌ ¸Þ½ÃÁö°¡ º¸ÀÌ¸é ¼º°øÇÑ °ÍÀÓ
SVRMGR> alter database open resetlogs;
SVRMGR> select count(*) from scott.s_emp; --> ¼º°øÀÌ´Ù
SVRMGR> select * from scott.new_emp;
ORA-00376: file 5 cannot be read at this time
ORA-01110: data file 5: '/DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf'
--> ¾ó¶ó¸®¿À? ÀÌ»óÇÏ´Ù? ¾ÆÇÏ! query_01.dbfÀÌ OfflineÀÌÁö!
SVRMGR> select * from v$datafile;
--> ¿ª½Ã "/DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf"ÀÌ OfflineÀÌ´Ù.
SVRMGR> alter tablespace query_data online;
SVRMGR> select * from v$datafile;
SVRMGR> select * from scott.new_emp;
SVRMGR> shutdown
SVRMGR> exit
3) ¹Ýµå½Ã Full Backup ¼öÇà
[/DBA3/DBA/dba¼ýÀÚ]cp -rp u0* backup
[/DBA3/DBA/dba¼ýÀÚ]cp -p dbs/cntrlDBA¼ýÀÚ.ctl backup
[/DBA3/DBA/dba¼ýÀÚ]cp -p dbs/initDBA¼ýÀÚ.ora backup
[/DBA3/DBA/dba¼ýÀÚ]rm *.arc
<SCENARIO 21 : Control File°ú Data File µ¿½Ã¿¡ À¯½Ç>
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> @?/labs/more_emp
SVRMGR> !ls *.arc --> ¸¶Áö¸· FileÀÇ ¹øÈ£¸¦ ±â¾ï
SVRMGR> exit
2) Failure¸¦ ¸¸µç´Ù.
- Control FileÀ» ¸ðµÎ »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] rm dbs/*.ctl u01/*.ctl u02/*.ctl
- Data FileÀ» »èÁ¦
[/DBA3/DBA/dba¼ýÀÚ] rm u03/users_01.dbf
[/DBA3/DBA/dba¼ýÀÚ] svrmgrl
SVRMGR> connect internal
SVRMGR> shutdown immediate
ORA-00210: cannot open control file '/DBA3/DBA/dba¼ýÀÚ/dbs/cntrlDBA¼ýÀÚ.ctl'
SVRMGR> shutdown abort
SVRMGR> exit
3) Recovery ½ÃÀÛ
[/DBA3/DBA/dba¼ýÀÚ] cp backup/cntrlDBA¼ýÀÚ.ctl dbs
[/DBA3/DBA/dba¼ýÀÚ] cp backup/cntrlDBA¼ýÀÚ.ctl u01
[/DBA3/DBA/dba¼ýÀÚ] cp backup/cntrlDBA¼ýÀÚ.ctl u02
[/DBA3/DBA/dba¼ýÀÚ] cp backup/u03/users_01.dbf u03
[/DBA3/DBA/dba¼ýÀÚ] svrmgrl
SVRMGR> connect internal
SVRMGR> startup mount
SVRMGR> recover database using backup controlfile
ORA-00283: Recovery session canceled due to errors
ORA-01233: file 5 is read only - cannot recover using backup controlfile
ORA-01110: data file 5: '/DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf'
--> read only FileÀÌ ÀÖÀ¸¸é ¹Ýµå½Ã offline½ÃÄÑ¾ß ÇÑ´Ù.
SVRMGR> alter database datafile '/DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf' offline;
SVRMGR> recover database using backup controlfile
ORA-00279: Change 8050 generated at 01/20/98 15:22:26 needed for thread 1
ORA-00289: Suggestion : /DBA3/DBA/dba¼ýÀÚ/arch_5.arc
ORA-00280: Change 8050 for thread 1 is in sequence #5
Specify log: {<RET>=suggested | filename | AUTO | CANCEL}
¾Õ¿¡¼ ±â¾ïÇÑ ¸¶Áö¸· ¹øÈ£±îÁö "Return" Key¸¦ ´©¸£°í,
Online Redo Log File ¸íÀ» Full Path·Î ÀÔ·Â
(¿¹) /DBA3/DBA/dba¼ýÀÚ/u01/log1a.rdo --> ÀÔ·Â
±×·±µ¥, Ưº°È÷ ¿îÀÌ ÁÁÁö ¾Ê´Ù¸é, ´ÙÀ½ÀÇ ¿¡·¯°¡ ³´Ù
(¿¡·¯ ¸Þ¼¼Áö)
ORA-00310: archived log contains sequence 4; sequence 5 required
ORA-00334: archived log: '/DBA3/DBA/dba¼ýÀÚ/u01/log1a.rdo'
±×·¸´Ù¸é, recover¿Í File¸í ÀÔ·ÂÀ» ´Ù½Ã ½Ãµµ
(¿¹)
SVRMGR> recover database using backup controlfile --> ´Ù½Ã ¼öÇà
/DBA3/DBA/dba¼ýÀÚ/u01/log2a.rdo --> ´Ù¸¥ offline File ¸í ÀÔ·Â
´ÙÀ½ÀÇ ¸Þ½ÃÁö¸¦ º¼ ¶§±îÁö ´Ù¸¥ offline File¿¡µµ ¼öÇà
(º¸¿©¾ß ÇÏ´Â ¸Þ½ÃÁö)
Log applied.
Media recovery complete. --> ÀÌ ¸Þ½ÃÁö°¡ º¸ÀÌ¸é ¼º°øÇÑ °ÍÀÓ
SVRMGR> alter database open resetlogs;
SVRMGR> select count(*) from scott.s_emp;
SVRMGR> select * from v$datafile; --> /DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbfÀÌ OfflineÀÌ´Ù.
SVRMGR> alter tablespace query_data online;
SVRMGR> select * from v$datafile;
SVRMGR> shutdown
SVRMGR> startup
SVRMGR> shutdown
SVRMGR> exit
3) ¹Ýµå½Ã Full Backup ¼öÇà
[/DBA3/DBA/dba¼ýÀÚ] cp -rp u0* backup
[/DBA3/DBA/dba¼ýÀÚ] cp -p dbs/cntrlDBA¼ýÀÚ.ctl backup
[/DBA3/DBA/dba¼ýÀÚ] cp -p dbs/initDBA¼ýÀÚ.ora backup
[/DBA3/DBA/dba¼ýÀÚ] rm *.arc
>
<SCENARIO 22 : Read Only TablespaceÀÇ »óÅ º¯°æ¿¡ µû¸¥ recovery - 1>
control fileÀº ±×´ë·Î ÀÖ°í R/O °¡ R/W·Î º¯°æµÇ°í ±× ¶§ µ¥ÀÌÅÍÀÇ º¯µ¿Àº archivingµÇ¾ú´Ù.
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
[/DBA3/DBA/dba¼ýÀÚ] svrmgrl
SVRMGR> connect internal
SVRMGR> startup
2) Read Only tablespace query_data¸¦ Read Write·Î ¹Ù²Ù°í scott°¡ data¸¦ ÀÔ·ÂÇÔ.
SVRMGR> alter tablespace query_data read write;
SVRMGR> select tablespace_name, status from dba_tablespaces;
SVRMGR> alter user scott quota 1 m on query_data;
SVRMGR> connect scott/tiger;
SVRMGR> create table query (id number) tablespace query_data;
SVRMGR> insert into query select id from s_emp;
SVRMGR> commit;
SVRMGR> connect internal;
SVRMGR> shutdown immediate
3) Failure¸¦ ¸¸µç´Ù
- ¾÷¹« ¼öÇà Áß¿¡ query_01.dbf FileÀÌ »èÁ¦µÇ¾ú´Ù.
[/DBA3/DBA/dba¼ýÀÚ] rm /DBA3/DBA/dba¼ýÀÚ/u03/query_01.dbf
SVRMGR> connect internal
SVRMGR> startup
SVRMGR> select * from scott.new_dept;
select * from scott.query
*
ORA-01116: error in opening database file 6
ORA-01110: data file 6: '/ DBA3/DBA/dba¼ýÀÚ /u03/query_01.dbf'
ORA-07368: sfofi: open error, unable to open database file.
SVR4 Error: 2: No such file or directory
SVRMGR> shutdown abort;
SVRMGR> exit
4) Recovery ½ÃÀÛ
[/DBA3/DBA/dba¼ýÀÚ] cp backup/u03/query_01.dbf u03 --> restore backup file
[/DBA3/DBA/dba¼ýÀÚ] svrmgrl
SVRMGR> connect internal
SVRMGR> startup
ORA-01113: file 6 needs media recovery
ORA-01110: data file 6: '/ DBA3/DBA/dba¼ýÀÚ /u03/query_01.dbf'
SVRMGR> set autorecovery on
SVRMGR> recover database;
--> control file¿¡ query_data tablespace°¡ read write·Î µÇ¾î ÀÖ¾î¼
¿¹Àü¿¡ read only¿´´ø »ç½ÇÀº Áß¿äÇÏÁö ¾Ê´Ù.
SVRMGR> alter database open;
SVRMGR> select tablespace_name, status from dba_tablespaces; --> read only °¡ ¾Æ´Ï°í online
SVRMGR> select * from scott.query;
SVRMGR> shutdown
SVRMGR> exit
<SCENARIO 23 : Read Only TablespaceÀÇ »óÅ º¯°æ¿¡ µû¸¥ recovery - 2>
control fileÀº ±×´ë·Î ÀÖ°í R/O °¡ R/W·Î º¯°æµÇ°í ±× ¶§ µ¥ÀÌÅÍÀÇ º¯µ¿Àº archivingµÇ¾ú´Ù.
¶ÇÇÑ ±× Áß°£¿¡ test¶ó´Â tablespace¸¦ Ãß°¡ÇÏ¿´´Ù.
Control fileÀÌ ±úÁ³´Âµ¥ R/W·Î º¯È¸¦ °¡ÇÑ ÈÄ backupÀ» ¹ÞÁö ¾Ê¾Æ¼ ¿¾³¯ R/O½ÃÀýÀÇ control
fileÀ» restoreÇÑ´Ù¸é?
1) Á¤»óÀûÀÎ ¾÷¹«¸¦ ¼öÇà
[/DBA3/DBA/dba¼ýÀÚ] svrmgrl
SVRMGR> connect internal
SVRMGR> startup
|