아카이브 백업
백업이후 테이블 스페이스 생성하였는데 에러가 난 상황
아카이브를 적용시켜야 하는데 백업시점에서는 테이블 스페이스가 없다. 즉 백업도 없다. 어떻게 해야 하나? 복구는 가능한것인가”
데이터파일을 오프라인 시킨 후 디비를 오프한다.
Alter database create datafile 명령으로 데이터 파일 생성후 Recover 명령으로 아카이브 적용하면 된다.
단계 1 정상 적인 업부 수행 중
[oracle@localhost ~]$ sqlplus '/as sysdba'
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Aug 8 05:13:14 2007 Copyright (c) 1982, 2002, Oracle Corporation. All rights reserved.
onnected 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> create tablespace new_data
2 datafile '/u01/app/oracle/oradata/orcl/new_data.dbf' 3 size 1M
4 ;
Tablespace created.
SQL> create table new 2 tablespace new_data 3 as
4 select * from scott.emp;
Table created.
SQL> select 2 count(*) 3 from new;
COUNT(*) --- 14
단계 3 문제 발생 문제는 방금 만든 테이블 스페이스의 백업이 없다는 것
SQL> shutdown abort;
ORACLE instance shut down.
SQL> host
[oracle@localhost ~]$ rm -rf /u01/app/oracle/oradata/orcl/new_data.dbf [oracle@localhost ~]$ exit
exit
단계 4 상황 파악 및 문제 진단
SQL> startup
ORACLE instance started.
Total System Global Area 236000356 bytes Fixed Size 451684 bytes Variable Size 201326592 bytes Database Buffers 33554432 bytes Redo Buffers 667648 bytes Database mounted.
ORA-01157: cannot identify/lock data file 12 - see DBWR trace file ORA-01110: data file 12: '/u01/app/oracle/oradata/orcl/new_data.dbf'
단계 5 문제 해결 일단 오프라인으로 만듬
SQL> alter database datafile '/u01/app/oracle/oradata/orcl/new_data.dbf' offline 2 ;
Database altered.
단계 6 명령어로 비어잇는 테이블 스페이스 파일 재생성
SQL> alter database
2 create datafile '/u01/app/oracle/oradata/orcl/new_data.dbf' 3 ;
Database altered.
단계 7 복구할 아카이브 파일이 있는지 명령어로 조회 드디어 쓰는 구냐///
SQL> select
2 * from v$recover_file;
FILE# ONLINE ONLINE_STATUS --- --- ---
ERROR CHANGE#
--- --- TIME
---
12 OFFLINE OFFLINE
266264 08-AUG-07
단계 8 복구 명령어로 아카이브 된 사항 적용
SQL> recover tablespace new_data;
Media recovery complete.
단계 9 테이블 스페이스 온라인
SQL> alter tablespace new_data online;
Tablespace altered.
단계 10 데이터 확인
SQL> select 2 count(*) 3 from new;
COUNT(*) --- 14