본문 바로가기
oracle

[ORACLE] BLOCK CORRUPTION 조치

by 둥구리둥둥 2023. 2. 27.
728x90
반응형

ora-01578 : ORACLE data block corrupted (file # 22, block # 3212247
발생 시 조치 방법

테스트 버전 : 12C E.E(11g 이상이면 동일하게 복구 가능할것으로 확인됨)
복구 조건: archive log mode 여야함, recover 시 요구하는 archive log가 존재 해야함

SQL> select * from v$database_block_corruption; -- corrupt 된 데이터 파일과 block 확인

<v$database_block_corruption>

column  Datatype  Description
FILE# NUMBER Absolute file number of the datafile that contains the corrupt blocks
BLOCK# NUMBER Block number of the first corrupt block in the range of corrupted blocks
BLOCKS NUMBER Number of corrupted blocks found starting with BLOCK#
CORRUPTION_CHANGE# NUMBER Change number at which the logical corruption was detected. Set to 0 to indicate media corruption.
CORRUPTION_TYPE VARCHAR2(9) Type of block corruption in the datafile:ALL ZERO - Block header on disk contained only zeros. The block may be valid if it was never filled and if it is in an Oracle7 file. The buffer will be reformatted to the Oracle8 standard for an empty block.
FRACTURED - Block header looks reasonable, but the front and back of the block are different versions.
CHECKSUM - optional check value shows that the block is not self-consistent. It is impossible to determine exactly why the check value fails, but it probably fails because sectors in the middle of the block are from different versions.
CORRUPT - Block is wrongly identified or is not a data block (for example, the data block address is missing)
LOGICAL - Block is logically corrupt
NOLOGGING - Block does not have redo log entries (for example, NOLOGGING operations on primary database can introduce this type of corruption on a physical standby)

block corrupted 발생 했다면 v$database_block_corruption에 정보가 보임
- FILE#, BLOCK# 정보를 이용하여 rman 에서 복구 
$ rman target /
RMAN> list backup of archivelog all by file; -- 현재 백업된 아카이브 리스트 확인(DB서버에 아카이브파일이 삭제되었을 경우 restore가능한지 확인 용도)

RMAN> run {
allocate channel t1 type 'SBT_TAPE';
send 'NSR_ENV=(NSR_SERVER=백업서버, NSR_CLIENT=DB서버)';
set archivelog destination to '아카이브경로';
restore archivelog from logseq 17781 until logseq 17791 thread 1;
} -- 백업서버에서 DB 서버의 아카이브경로 시퀀스번호 17781~17791 까지 archivelog restore 명령어

RMAN>run {
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(NSR_SERVER='백업서버호스트네임',NSR_CLIENTR='DB서버')';
recover database 'FILE#' block BLOCK#,BLOCK#;
} -- 현 환경은 networker 라는 백업솔루션과 백업서버를 사용하고 있음 

EX>
RMAN>
RMAN>run {
allocate channel t1 type 'SBT_TAPE' parms 'ENV=(NSR_SERVER='백업서버호스트네임',NSR_CLIENTR='DB서버')';
recover database 22 block 3212247,3212248;
}

SQL> select * from  v$database_block_corruption; -- 복구 후 corrupt된 데이터가 보이지 않으면 복구 완료 

728x90
반응형