아카이브 백업 –온라인 백업 수행중 도중 정전
항상 모든 예제가 끝나고 이상하면 항상 전에 저정한 스냇샷으로
단계 1 정상 업무 수행중
[oracle@localhost ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 8 04:55:51 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to:
Oracle9i Enterprise Edition Release 10.2.0.1.0 - Production With the Partitioning and Oracle Data Mining options
JServer Release 10.2.0.1.0 - Production
단계 2 온라인 백업시 이상 발생
SQL> alter tablespace system begin backup;
Tablespace altered.
SQL> host 중간에 컨트롤 c 를 눌러서 최소하자
[oracle@localhost ~]$ cp /u01/app/oracle/oradata/orcl/system01.dbf /oracle/oradata/onbackup/
[oracle@localhost ~]$ exit exit
SQL> shutdown 역시 라클이 그냥은 않꺼진다.
ORA-01149: cannot shutdown - file 1 has online backup set
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
SQL> shutdown abort 그렀다 정전이다…….
ORACLE instance shut down.
SQL> exit
단계 3 재가동 후 디비 상태 확인
[oracle@localhost ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 8 04:59:35 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
Connected to an idle instance.
SQL> startup Database mounted.
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/app/oracle/oradata/orcl/system01.dbf'
단계 4 어떤 파일이 핫 백업 모드에 있었는지 확인한다.
SQL> select * from v$backup;
FILE# STATUS CHANGE# TIME
--- --- --- --- 1 ACTIVE 247910 08-AUG-07
2 NOT ACTIVE 240606 08-AUG-07 3 NOT ACTIVE 0
4 NOT ACTIVE 0 5 NOT ACTIVE 0
6 NOT ACTIVE 242763 08-AUG-07 7 NOT ACTIVE 0
8 NOT ACTIVE 0
9 NOT ACTIVE 239781 08-AUG-07 10 NOT ACTIVE 0
11 NOT ACTIVE 0 11 rows selected.
SQL> select 2 file#
3 ,name 4 ,status
5 from v$datafile;
1
/u01/app/oracle/oradata/orcl/system01.dbf SYSTEM
2
/u01/app/oracle/oradata/orcl/undotbs01.dbf ONLINE
3
/u01/app/oracle/oradata/orcl/cwmlite01.dbf ONLINE
4
/u01/app/oracle/oradata/orcl/drsys01.dbf 5
/u01/app/oracle/oradata/orcl/example01.dbf ONLINE
6
11 rows selected.
단계 5 문제있는 테이블 스페이스의 백업을 종료한고 연다.
SQL> alter database 번호를 사용하는 것을 주목 2 datafile 1 end backup;
SQL> alter database open;
SQL> select 2 status
3 from v$instance;
STATUS
--- OPEN
단계 6 다시 정상적인 온라인 백업 수행
SQL> alter tablespace system begin backup;
Tablespace altered.
SQL> host
[oracle@localhost ~]$ cp /u01/app/oracle/oradata/orcl/system01.dbf /oracle/oradata/onbackup/
[oracle@localhost ~]$ exit exit
SQL> alter tablespace system end backup;
Tablespace altered.
SQL>
SQL> alter system swith logfile ;
alter system swith logfile
로그 스위치를 하는 이유는 안전을 위해서이다. 로그 스위치를 하면 다른 리두 로그그룹이 이동하면서 로그 스위치 되기 전의 로그 그룹에 대해서 아카이브 그룹을 만든다.