본문 바로가기

ORACLE/ORACLE_Admin

ORACLE Controlfile

반응형

##컨트롤 파일

- 물리적 데이터베이스의 상태에 관한 정보를 저장하는 바이너리 파일

- Nomount → Mount 올라가는 시점에 읽혀지는 파일

- 컨트롤 파일은 계속적으로 갱신

- 하나의 데이터베이스에 하나의 컨트롤 파일

 

▶ 기록되는 내용

- 데이터베이스의 이름과 식별자

- 데이터파일의 위치와 파일 이름

- 테이블 스페이스 이름

- 리두 로그 파일의 위치와 파일 이름

- 체크포인트 정보

- 백업정보

 

 

## 컨트롤 파일 추가

1. 현재 컨트롤 파일 위치 확인

 

SELECT name FROM v$controlfile;

 

 

2. spfile 파라미터 변경

alter system set control_files ='/app/oracle/oradata/ORA19C/control01.ctl', 
'/app/oracle/oradata/ORA19C/control02.ctl', 
'/app/oracle/oradata/ORA19C/control03.ctl' 
scope=spfile;

 

3. shutdown immediate;

 

 

4. 디렉토리에 컨트롤파일 복사

cp /app/oracle/oradata/ORA19C/control01.ctl /app/oracle/oradata/ORA19C/control03.ctl

 

 

5. startup 후 컨트롤파일 확인

 

 

 컨트롤 파익 삭제

2번과정에서 원하는 컨트롤 파일만 남겨두고 4번과정대신 rm 파일을 수행하면 된다.

 

 

 


## 컨트롤 파일 삭제했을경우 복구 방법

복구방안에는 두가지 경우가 있다. 

1. 리두 로그 파일에 손상이 없는 경우 (noresetlogs)

2. 리두 로그 파일에 손상이 있는 경우 (resetlogs) → 낮은 번호의 Datafile으로 Control , Redo log(초기화)의 SCN을 맞춘다.

 

1. 컨트롤 파일 재생성시 사용할 스크립트가 저장된 트레이스 파일 생성

alter database backup controlfile to trace as '/home/oracle/cr_controlfile.sql';

 

 

 

 

2. 파일내용을 확인하고 noresetlogs일 경우, resetlogs일 경우에 맞게 수정

noresetlogs일땐 위의 내용만을 새파일로 저장

 

resetlogs일땐 위의 내용만을 새파일로 저장

 

 

3. 컨트롤 파일 삭제

[/app/oracle/oradata/ORA19C]$ rm control01.ctl
[/app/oracle/oradata/ORA19C]$ rm control02.ctl
[/app/oracle/oradata/ORA19C]$ rm control03.ctl

 

 

4. controlfile을 지운상태이기 때문에 abort 옵션으로 shutdown

shutdown abort;

 

5. noresetlogs 일 경우와 resetlogs 일 경우에 맞춰서 스크립트 파일 실행

@/home/oracle/cr_controlfile_no_resetlog.sql

 

 

 

6. 컨트롤 파일 확인

select name from v$controlfile;

 

복구된걸 확인 가능

반응형