½Ã³ª¸®¿À07 - ¾ÆÄ«À̺ê¸ðµåÀÇ ¿ÏÀüº¹±¸
ÀÛ¼ºÀÚ °ü¸®ÀÚ ÀÛ¼º½Ã°£ 2003-06-13 15:38:49
 

Archivelog moe¿¡¼­ÀÇ Complete Database Recovery ¼öÇà

1. databaseÀÇ mode¸¦ È®ÀÎ ÈÄ, automatic archivingÀÌ °¡´ÉÇϵµ·Ï setting Ç϶ó.

$ svrmgrl
SVRMGR> connect / as sysdba
SVRMGR> startup
SVRMGR> select name, log_mode from v$database ;
SVRMGR> archive log list
SVRMGR> shutdown immediate
        --> log_archive_start=TRUE·Î setting
SVRMGR> startup mount
SVRMGR> alter database archivelog ;
SVRMGR> alter database open ;
SVRMGR> archive log list
SVRMGR> show parameter archive

2. $HOME/BACKUP µð·ºÅ丮¿¡ closed database backup ¼öÇà

SVRMGR> shutdown immediate
SVRMGR> ! cp -rp $HOME/DATA/* $HOME/BACKUP
SVRMGR> startup

3. sqlplus¿¡ scott/tiger·Î loginÇؼ­ ´ÙÀ½À» ¼öÇà

$ sqlplus scott/tiger
SQL> @ newemp.sql
SQL> connect system/manager
SQL> select tablespace_name from dba_tables
  2  where table_name='NEWEMP' ;
    --> newemp tableÀÌ ¾î¶² datafile¿¡ µé¾î ÀÖ´ÂÁö¸¦ È®ÀÎ
SQL> select file_name from dba_data_files
  2  where tablespace_name='USER_DATA' ;
    --> USER_DATA tablespace¸¦ ±¸¼ºÇÏ°í ÀÖ´Â datafileÀ» È®ÀÎ
   
4. failure¸¦ ¹ß»ý½ÃÅ°°í, database startup ¼öÇà

SQL> @ breakdb.sql
$ svrmgrl
SVRMGR> connect / as sysdba
SVRMGR> startup
    --> $HOME/DATA/DISK2/user01.dbf fileÀÌ ¾øÀ¸¹Ç·Î openÀ» ÇÒ ¼ö ¾ø°í, database´Â mount »óÅÂÀÓ
   
5. Recovery ¼öÇà ÈÄ, database open

SVRMGR> ! cp $HOME/BACKUP/DISK2/user01.dbf $HOME/DATA/DISK2
SVRMGR> recover automatic database ;
SVRMGR> alter database open ;
SVRMGR> select tablespace_name, status from dba_tablespaces
    2  where tablespace_name='USER_DATA' ;

6. sqlplus¿¡ scott/tiger·Î login Çؼ­ newemp tableÀ» query ÇØ º¸¶ó.

$ sqlplus scott/tiger
SQL> select count(*) from newemp ;
    --> ¾î¶² °á°ú°¡ ³ªÅ¸³ª´Â°¡? Practice 6-1 6ÀÇ °á°ú¿Í ºñ±³ÇØ º¸¶ó.


¸ñ·Ï | ÀÔ·Â | ¼öÁ¤ | ´äº¯ | »èÁ¦