1. redo log 파일의 경로와 개수 조회
SQL> col member format a45
SQL> select * from v$logfile;
GROUP# STATUS TYPE MEMBER IS_
---------- ------- ------- --------------------------------------------- ---
3 ONLINE /oracle/oradata/ora10g/redo03.log NO
2 ONLINE /oracle/oradata/ora10g/redo02.log NO
1 ONLINE /oracle/oradata/ora10g/redo01.log NO
2. log 파일 상태 조회
SQL> set linesize 120
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 101 52428800 1 NO CURRENT 3671888 26-OCT-06
2 1 99 52428800 1 NO INACTIVE 3614748 25-OCT-06
3 1 100 52428800 1 NO INACTIVE 3637449 26-OCT-06
3. Archive log 모드 여부 조회
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 99
Current log sequence 101
4. backup 디렉토리생성
# mkdir /backup
# cd backup
# mkdir archive1
# mkdir archive2
# chown -R oracle.dba /backup
5. Archive 환경 설정
SQL> alter system set log_archive_start=true scope=spfile;
System altered.
SQL> alter system set log_archive_dest='/backup/archive1' scope=spfile;
System altered.
SQL> alter system set log_archive_duplex_dest='/backup/archive2' scope=spfile;
System altered.
SQL> alter system set log_archive_format='%t_%s_%r.arc' scope=spfile;
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.
Total System Global Area 167772160 bytes
Fixed Size 1218316 bytes
Variable Size 96471284 bytes
Database Buffers 67108864 bytes
Redo Buffers 2973696 bytes
Database mounted.
6. DB를 Archive Log mode로 변경
SQL> alter database archivelog;
Database altered.
7. 정상적으로 사용할 수 있도록 DB Open
SQL> alter database open;
Database altered.
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 102
Next log sequence to archive 104
Current log sequence 104
SQL>
SQL> set linesize 120
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 104 52428800 1 NO CURRENT 3755431 27-OCT-06
2 1 102 52428800 1 YES INACTIVE 3709646 26-OCT-06
3 1 103 52428800 1 YES INACTIVE 3732041 27-OCT-06
8. 강제로 Log Switch 발생
SQL> alter system switch logfile;
System altered.
SQL> !ls /backup/archive1
1_104_601220550.arc
SQL> !ls /backup/archive2
1_104_601220550.arc
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 104 52428800 1 YES ACTIVE 3755431 27-OCT-06
2 1 105 52428800 1 NO CURRENT 3758663 27-OCT-06
3 1 103 52428800 1 YES INACTIVE 3732041 27-OCT-06
SQL> alter system switch logfile;
System altered.
SQL> !ls /backup/archive1
1_104_601220550.arc 1_105_601220550.arc
SQL> !ls /backup/archive2
1_104_601220550.arc 1_105_601220550.arc
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 104 52428800 1 YES ACTIVE 3755431 27-OCT-06
2 1 105 52428800 1 YES ACTIVE 3758663 27-OCT-06
3 1 106 52428800 1 NO CURRENT 3759795 27-OCT-06
SQL> alter system switch logfile;
System altered.
SQL> !ls /backup/archive1
1_104_601220550.arc 1_105_601220550.arc 1_106_601220550.arc
SQL> !ls /backup/archive2
1_104_601220550.arc 1_105_601220550.arc 1_106_601220550.arc
SQL> select * from v$log;
GROUP# THREAD# SEQUENCE# BYTES MEMBERS ARC STATUS FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
1 1 107 52428800 1 NO CURRENT 3759879 27-OCT-06
2 1 105 52428800 1 YES ACTIVE 3758663 27-OCT-06
3 1 106 52428800 1 YES ACTIVE 3759795 27-OCT-06
SQL> archive log list
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence 105
Next log sequence to archive 107
Current log sequence 107
SQL>