Site icon DBA의 정석

DBV Utility를 이용한 File Check

1      테스트 환경

n   서버 : Sun Enterprise E3500 (2048M)

n   운영체제 : Solaris 9

n   오라클 : Oracle 10.2.0.4 Enterprise 64bit

 

2      DBV Utility

         Database verify 의 약자로, 7.3.2 부터 지원되는 유틸리티.

         Data 나 Index block 이 어느 정도 신뢰성이 있는지, 손상(corruption)의 유무에 대한 정도를 점검.

         dbv 는 Block level 까지만 점검하기 때문에, ‘ANALYZE TABLE … VALIDATE STRUCTURE CASCADE’ 와는 달리 Index 와 Data block 간의 일치성 점검은 수행하지는 않는다.

         dbv 는 Analyze 시 Table lock(TM) 이 걸리는 문제 때문에, Analyze 할 수 없는 상황에서 유용하게 사용될 수 있다.

 

Keyword

Description

(Default)

FILE

File to Verify

(NONE)

START

Start Block

(First Block of File)

END

End Block

(Last Block of File)

BLOCKSIZE

Logical Block Size

(8192)

LOGFILE

Output Log

(NONE)

FEEDBACK

Display Progress

(0)

PARFILE

Parameter File

(NONE)

USERID

Username/Password

(NONE)

SEGMENT_ID

Segment ID (tsn.relfile.block)

(NONE)

HIGH_SCN

Highest Block SCN To Verify (scn_wrap.scn_base OR scn)

(NONE)

 

 

 

 

 

 

 

3      DBV Utility 사용법

         dbv 유틸리티는 data file에 대해서만 사용될 수 있고 Redo log control file 에 대해서는 사용할 수 없다.

         raw device 에 대해서는 직접 dbv 를 수행할 수 없고 symbolic link 를 사용해야 한다. 그리고 link name은 반드시 확장자(extension)를 줘야한다.

(ln -s /dev/rvol/users /oracle/users01.dbf)

 

n  일반적인 File의 사용법

         만약 ASM를 사용하는 경우에는 반드시 userid를 넣어줘야만 한다.

(Ex : dbv file=+DG1/ORCL/datafile/system01.dbf userid=system/sys)

$ dbv file=파일명 blocksize=8192

 

         만약 dbv를 실행한 결과에서 Marked Corrupt Failing 이 있다면, 다시 dbv 를 수행하여 일시적인 현상인지 확인한다.

 

n  Raw Device의 사용법

         파일명은 ln -s /dev/rvol/users /oracle/users01.dbf 와 같이 symbolic link를 걸어서 넣어준다.

         Start=1로 설정을 하고 End는 datafile bytes db_block_size로 나눈 값을 넣는다.

 

End 값 구하는 방법

SQL> show parameter
db_block_size

위에서 구한 db_block_size를 구하려는 datafile bytes 값으로 나누면 얻을 수 있다.

 

SQL> select bytes/8192 from
v$datafile where file#=2;

 

         위에서 구한 값을 end 값으로 넣어서 실행을 하면 된다.

$ dbv file=파일명 blocksize=8192 start=1 end= (bytes/db_block_size)

 

         SEGMENT_ID를 이용해서 특정 Segment만 지정하여 사용할 수도 있다.

SQL> select t.ts#, s.header_file, s.header_block from v$tablespace t, dba_segments s

where s.segment_name=’EMP_TEST’ and t.name = s.tablespace_name

 

         예제처럼 원하는 Segment TS#, HEADER_FILE, HEADER_BLOCK를 구하여서 dbv를 이용하여 Check를 할 수 있다. Segment만 사용할 경우에는 userid를 넣어줘야 한다.

$ dbv userid=system/oracle segment_id=4.10.851

 

  

n  Corrupt Object 확인 방법

     Corrupt가 발생된 출력 예제

DBVERIFY: Release 10.2.0.4.0 – Production on Wed Apr 28 00:35:15 2010

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

DBVERIFY – Verification starting : FILE = users01.dbf

Page 48740 is marked corrupt    ***
Corrupt block relative dba: 0x01c0be64 (file 4, block 48740)
Bad check value found during dbv:
Data in bad block –
type:
0 format: 2 rdba: 0x0000be64
last change scn:
0x0000.00000000 seq: 0x1 flg: 0x05
consistency value in tail: 0x00000001
check
value in block header: 0xb964, computed block checksum: 0x2a5a
spare1: 0x0, spare2: 0x0, spare3: 0x0
***
DBVERIFY – Verification
complete
Total Pages
Examined         : 64000
Total Pages Processed (Data) : 0
Total Pages Failing   (Data) : 0
Total Pages
Processed (Index): 1751
Total Pages
Failing   (Index): 0
Total Pages Processed
(Other): 45
Total Pages Processed (Seg)  : 0
Total Pages Failing   (Seg)  : 0
Total Pages
Empty            :
62203
Total Pages Marked Corrupt   :
1

 

  

         위와 같이 Corrupt된 예제를 살펴보면 관련 file block을 확인 할 수 있다. File block를 이용하여 corrupt Object를 확인 할 수 있다.

SQL > select segment_name, segment_type, owner  from dba_extents  where file_id = (Absolute file number) and (corrupted block number) between block_id and block_id + blocks -1;

 

 

Exit mobile version