dbvall.ksh

REM ################################################
REM # Creator: Vincent Fenoll
REM # Created: 2004/01/01
REM # Name: dbvall.ksh
REM  ################################################
REM #
REM # Compatible: Oracle 7 8i 9i 10g 11g
REM#
REM ################################################
REM #
REM # Performs dbv on all database files to find any 
REM # corrupt pages
REM # Be careful: For >= 9i possibility of multiple 
REM # blocksize
REM #
REM ################################################

#!/usr/bin/ksh
sqlplus -s "/ as sysdba"  <<  END >/tmp/dbvall_$ORACLE_SID.ksh
set linesize 200
set pagesize 0
set feed off
set head off
prompt echo Searching Corrupt blocks 
select 'echo $ORACLE_SID :'|| sysdate from dual;
select 'echo DBVERIFY : '||file_name|| '- in progress ...'||chr(10)||'dbv BLOCKSIZE='||value||' FILE='||file_name
from dba_data_files, v\$parameter
where v\$parameter.name = 'db_block_size'
UNION ALL
select 'echo DBVERIFY : '||file_name|| '- in progress ...'||chr(10)||'dbv BLOCKSIZE='||value||' FILE='||file_name
from dba_temp_files, v\$parameter
where v\$parameter.name = 'db_block_size'
/
END

chmod +x /tmp/dbvall_$ORACLE_SID.ksh
/tmp/dbvall_$ORACLE_SID.ksh > dbverify_$ORACLE_SID.res  2>&1 
RESULTAT=`cat dbverify_$ORACLE_SID.res | grep -i  "Page " | wc -l`
echo There is corruption for $RESULTAT pages

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.