Search This Blog

Total Pageviews

Wednesday 28 April 2010

dbv for ASM disk


Oracle disk verification Utility dbv On ASM file system


set feedback off  head off echo off linesize 200 pagesize 1000
spool /tmp/dbvchk.txt
select 'dbv file=' || name || ' blocksize='|| block_size || ' USERID=system/SYS logfile=' ||substr(name, instr(name, '/', -1, 1) +1) ||'.' || file# || '.log' from v$datafile
/ 

Output

dbv file=+DATA/rac/datafile/system.259.716288417 blocksize=8192 USERID=system/SYS logfile=system.259.716288417.1.log
dbv file=+DATA/rac/datafile/undotbs1.260.716288467 blocksize=8192 USERID=system/SYS logfile=undotbs1.260.716288467.2.log
dbv file=+DATA/rac/datafile/sysaux.261.716288483 blocksize=8192 USERID=system/SYS logfile=sysaux.261.716288483.3.log
dbv file=+DATA/rac/datafile/undotbs2.263.716288533 blocksize=8192 USERID=system/SYS logfile=undotbs2.263.716288533.4.log
dbv file=+DATA/rac/datafile/users.264.716288559 blocksize=8192 USERID=system/SYS logfile=users.264.716288559.5.log




without password

set feedback off  head off echo off linesize 200 pagesize 1000
spool /tmp/dbvchk.txt
select 'dbv file=' || name || ' blocksize='|| block_size || ' USERID=\''/ as sysdba\'' logfile=' ||substr(name, instr(name, '/', -1, 1) +1) ||'.' || file# || '.log' from v$datafile
/ 
=======


corrupt the datafile 

dd if=/dev/zero of=/u01/app/oracle/Datafile/data_D-ORCL_TS-USERS_FNO-6 bs=8k conv=notrunc seek=10 count=1


dbv file=/u01/app/oracle/Datafile/data_D-ORCL_TS-USERS_FNO-6 blocksize=8192 USERID=\'/ as sysdba\' logfile=data_D-ORCL_TS-USERS_FNO-6.6.log


 cat data_D-ORCL_TS-USERS_FNO-6.6.log

DBVERIFY: Release 12.2.0.1.0 - Production on Fri Dec 30 06:30:04 2022

Copyright (c) 1982, 2017, Oracle and/or its affiliates.  All rights reserved.


DBVERIFY - Verification starting : FILE = /u01/app/oracle/Datafile/data_D-ORCL_TS-USERS_FNO-6
Page 10 is marked corrupt
Corrupt block relative dba: 0x0180000a (file 6, block 10)
Completely zero block found during dbv:


DBVERIFY - Verification complete

Total Pages Examined         : 640
Total Pages Processed (Data) : 30
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 5
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 576
Total Pages Processed (Seg)  : 11
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 17
Total Pages Marked Corrupt   : 1
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 1839277 (0.1839277)
[oracle@wcp12cr2 Datafile]$



select * from v$database_block_corruption ;


     FILE#     BLOCK#     BLOCKS CORRUPTION_CHANGE# CORRUPTIO     CON_ID
---------- ---------- ---------- ------------------ --------- ----------
         6         10          1                  0 ALL ZERO           0



repair failure preview;
repair failure noprompt;


RMAN> list failure;

Database Role: PRIMARY

List of Database Failures
=========================

Failure ID Priority Status    Time Detected       Summary
---------- -------- --------- ------------------- -------
1761       HIGH     OPEN      30-12-2022 06:42:46 Datafile 6: '/u01/app/oracle/Datafile/data_D-ORCL_TS-USERS_FNO-6' contains one or more corrupt blocks





==========




RMAN> advise failure;

Database Role: PRIMARY

List of Database Failures
=========================

Failure ID Priority Status    Time Detected       Summary
---------- -------- --------- ------------------- -------
1761       HIGH     OPEN      30-12-2022 06:42:46 Datafile 6: '/u01/app/oracle/Datafile/data_D-ORCL_TS-USERS_FNO-6' contains one or more corrupt blocks

analyzing automatic repair options; this may take some time
using channel ORA_DISK_1
analyzing automatic repair options complete

Mandatory Manual Actions
========================
no manual actions available

Optional Manual Actions
=======================
no manual actions available

Automated Repair Options
========================
Option Repair Description
------ ------------------
1      Perform block media recovery of block 10 in file 6
  Strategy: The repair includes complete media recovery with no data loss
  Repair script: /u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1375281163.hm  <<<< check this file 

RMAN>

[oracle@wcp12cr2 Datafile]$ cat /u01/app/oracle/diag/rdbms/orcl/orcl/hm/reco_1375281163.hm
   # block media recovery
   recover datafile 6 block 10;


=====



define file_no=6
define block_value=8

set linesize 300
col SEGMENT_NAME for a20
col TABLESPACE_NAME for a20
SELECT segment_name, TABLESPACE_NAME,segment_type,file_id, block_id, blocks
        FROM   dba_extents
        WHERE file_id = &file_no 
--AND ( &block_value BETWEEN block_id   AND ( block_id + blocks -1 ) )
;



define file_id=6
define block_id=144

col OWNER for a15
col SEGMENT_NAME for a20
col TABLESPACE_NAME for a20
SELECT relative_fno, owner, segment_name, segment_type ,file_id, block_id, blocks
 FROM dba_extents 
 WHERE file_id = &file_id
 and block_id=&block_id
;


RELATIVE_FNO OWNER           SEGMENT_NAME         SEGMENT_TYPE                FILE_ID   BLOCK_ID     BLOCKS
------------ --------------- -------------------- ------------------------ ---------- ---------- ----------
           6 OJVMSYS         OJDS$BINDINGS$       TABLE                             6        144          8




define file_number=6
define BLOCK_NUMBER=144

SELECT relative_fno, owner, segment_name, segment_type ,file_id, block_id, blocks FROM DBA_EXTENTS WHERE FILE_ID= &file_number 
 AND &BLOCK_NUMBER BETWEEN BLOCK_ID AND BLOCK_ID+BLOCKS-1;


RELATIVE_FNO OWNER           SEGMENT_NAME         SEGMENT_TYPE                FILE_ID   BLOCK_ID     BLOCKS
------------ --------------- -------------------- ------------------------ ---------- ---------- ----------
           6 OJVMSYS         OJDS$BINDINGS$       TABLE                             6        144          8

Oracle 11g alert log change to old alert log

sqlplus / as sysdba

SQL*Plus: Release 11.1.0.6.0 - Production on Wed Apr 28 09:13:18 2010

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


Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options


SQL> alter system set background_dump_dest='/opt/app/oracle/admin/vihaan/bdump' scope=spfile;

System altered.

SQL> alter system set "_diag_adr_enabled"=false scope=spfile;

System altered.

SQL> shutdown immediate ;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup force ;
ORA-32004: obsolete and/or deprecated parameter(s) specified
ORACLE instance started.

Total System Global Area 534462464 bytes
Fixed Size 2146112 bytes
Variable Size 150995136 bytes
Database Buffers 377487360 bytes
Redo Buffers 3833856 bytes
Database mounted.
Database opened.




SQL> show parameter back

NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
background_core_dump string partial
background_dump_dest string /opt/app/oracle/admin/vihaan/b
dump
backup_tape_io_slaves boolean FALSE
db_flashback_retention_target integer 1440
fast_start_parallel_rollback string LOW
rollback_segments string
transactions_per_rollback_segment integer 5




set pagesize 200
col KSPPINM format a50
col KSPPSTVL format a20
1* select i.ksppinm, v.ksppstvl from x$ksppi i, x$ksppcv v where i.ksppinm like '_diag_adr_enabled'
SQL> select i.ksppinm, v.ksppstvl from x$ksppi i, x$ksppcv v
where i.ksppinm like '_diag_adr_enabled%'
-- where i.ksppinm like '_%'
and i.indx=v.indx
and v.ksppstvl!='TRUE';

KSPPINM KSPPSTVL
-------------------------------------------------- --------------------
_diag_adr_enabled FALSE

oracle 10g and 11g database Enabling ARCHIVELOG Mode

SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL> startup mount;
ORACLE instance started.

Total System Global Area 534462464 bytes
Fixed Size 2146112 bytes
Variable Size 150995136 bytes
Database Buffers 377487360 bytes
Redo Buffers 3833856 bytes
Database mounted.
SQL> alter system set log_archive_dest = '/opt/app/oracle/admin/vihaan/archive' scope=spfile ;

System altered.

SQL> alter system set log_archive_dest = '/opt/app/oracle/admin/vihaan/archive' scope=both;

System altered.

SQL> alter database archivelog;

Database altered.

SQL> alter database open;

Database altered.

SQL> archive log list ;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /opt/app/oracle/admin/vihaan/archive
Oldest online log sequence 63
Next log sequence to archive 65
Current log sequence 65


set linesize 200
col DEST_NAME format a50
col DESTINATION format a30
set pagesize 100
select DEST_NAME,STATUS,DESTINATION from V$ARCHIVE_DEST

DEST_NAME STATUS DESTINATION
------------------------------ --------- --------------------------------------------------
LOG_ARCHIVE_DEST_1 VALID /opt/app/oracle/admin/vihaan/archive
LOG_ARCHIVE_DEST_2 INACTIVE
LOG_ARCHIVE_DEST_3 INACTIVE
LOG_ARCHIVE_DEST_4 INACTIVE
LOG_ARCHIVE_DEST_5 INACTIVE
LOG_ARCHIVE_DEST_6 INACTIVE
LOG_ARCHIVE_DEST_7 INACTIVE
LOG_ARCHIVE_DEST_8 INACTIVE
LOG_ARCHIVE_DEST_9 INACTIVE
LOG_ARCHIVE_DEST_10 INACTIVE


select log_mode from v$database;


LOG_MODE
------------
ARCHIVELOG



log file status


COL GROUP# FORMAT 999999 HEAD 'Groupe'
COL THREAD# FORMAT 999999 HEAD 'Thread'
COL SEQUENCE# FORMAT 99999999 HEAD 'Sequence'
COL TAI FORMAT A6 HEAD 'Taille|Mo'
COL STATUS FORMAT A10 HEAD 'Statut'
COL MEMBER FORMAT A40 HEAD 'Nom fichier'
COL HR FORMAT A20 HEAD 'Date ouverture'
COL ARCHIVED FORMAT A7 HEAD 'Archive'
BREAK ON THREAD# NODUP ON GROUP# NODUP SKIP 1 ON TAI NODUP ON HR NODUP
COMPUTE NUMBER LABEL 'Nombre:' OF SEQUENCE# ON GROUP#
SELECT L.GROUP#, L.THREAD#, L.SEQUENCE#, LPAD(TRUNC(BYTES/1024/1024),5) TAI, L.STATUS,
MEMBER, TO_CHAR(FIRST_TIME, 'YYYY-MM-DD HH24:MI:SS') HR,
DECODE(ARCHIVED,'YES','Oui','Non') ARCHIVED
FROM V$LOG L, V$LOGFILE F
WHERE L.GROUP# = F.GROUP#
ORDER BY 1,3,6;


in Oracle 11gr2


Oracle 11R2 archive log file

SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST';

System altered.


SQL> alter system set log_archive_dest_1='LOCATION=/opt/app/oracle/admin/vihaan/archive';







For RAC Perform:
ALTER SYSTEM set db_recovery_file_dest_size=60G scope=both sid='*' ;
ALTER SYSTEM SET db_recovery_file_dest='+FLASH' sid='*';
In a RAC database, all instances must have the same values for these parameters. Even though there are multiple nodes they all share the same controlfiles.

To disable FRA you can use:

ALTER SYSTEM SET DB_RECOVERY_FILE_DEST = '' scope=both;
Note: even after you disable the flash recovery area, the RMAN will continue to access the files located in the flash recovery area for backup and recovery purposes.

Oracle DBA

anuj blog Archive