[20150929]检查数据块.txt

[20150929]检查数据块.txt

--一般检查数据库的块是否存在损坏,使用dbv程序。例子:
$ dbv file=/u01/app/oracle11g/oradata/test/system01.dbf
DBVERIFY: Release 11.2.0.3.0 - Production on Tue Sep 29 07:48:28 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates.  All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle11g/oradata/test/system01.dbf
DBVERIFY - Verification complete
Total Pages Examined         : 106240
Total Pages Processed (Data) : 67096
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 16916
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 10114
Total Pages Processed (Seg)  : 1
Total Pages Failing   (Seg)  : 0
Total Pages Empty            : 12114
Total Pages Marked Corrupt   : 0
Total Pages Influx           : 0
Total Pages Encrypted        : 0
Highest block SCN            : 319181189 (3.319181189)

--但是如果文件很大检查就不方便,速度也不快,如果是检查多个文件,要一个一个输入,也是不方便。
--虽然dbv支持start,end参数,但是人为分割编程效率不高。简单一点,可以使用rman来完成这个工作。

RMAN> VALIDATE database ;
Starting validate at 2015-09-29 07:52:26
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=12 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=201 device type=DISK
allocated channel: ORA_DISK_3
channel ORA_DISK_3: SID=396 device type=DISK
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00003 name=/u01/app/oracle11g/oradata/test/undotbs01.dbf
input datafile file number=00014 name=/u01/app/oracle11g/oradata/test/tbs_ts2_01.dbf
input datafile file number=00005 name=/u01/app/oracle11g/oradata/test/example01.dbf
input datafile file number=00007 name=/u01/app/oracle11g/oradata/test/tools01.dbf
input datafile file number=00009 name=/u01/app/oracle11g/oradata/test/testmssm01.dbf
channel ORA_DISK_2: starting validation of datafile
channel ORA_DISK_2: specifying datafile(s) for validation
input datafile file number=00002 name=/u01/app/oracle11g/oradata/test/sysaux01.dbf
input datafile file number=00006 name=/u01/app/oracle11g/oradata/test/rman01.dbf
input datafile file number=00008 name=/u01/app/oracle11g/oradata/test/test01.dbf
input datafile file number=00010 name=/u01/app/oracle11g/oradata/test/undotbs02.dbf
input datafile file number=00012 name=/u01/app/oracle11g/oradata/test/tools01x.dbf
channel ORA_DISK_3: starting validation of datafile
channel ORA_DISK_3: specifying datafile(s) for validation
input datafile file number=00004 name=/u01/app/oracle11g/oradata/test/users01.dbf
input datafile file number=00013 name=/u01/app/oracle11g/oradata/test/tbs_ts1_01.dbf
input datafile file number=00001 name=/u01/app/oracle11g/oradata/test/system01.dbf
channel ORA_DISK_1: validation complete, elapsed time: 00:02:39
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
3    OK     0              1            108544          13204083927
  File Name: /u01/app/oracle11g/oradata/test/undotbs01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              0
  Index      0              0
  Other      0              108543
..... snap...

channel ORA_DISK_1: validation complete, elapsed time: 00:00:03
List of Control File and SPFILE
===============================
File Type    Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
Control File OK     0              1232
channel ORA_DISK_3: validation complete, elapsed time: 00:03:17
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1    OK     0              12114        106242          13204083927
  File Name: /u01/app/oracle11g/oradata/test/system01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              67096
  Index      0              16916
  Other      0              10114

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
4    OK     0              8175         147456          13203948833
  File Name: /u01/app/oracle11g/oradata/test/users01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              135887
  Index      0              1944
  Other      0              1450

File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
13   OK     0              5889         6400            12695454522
  File Name: /u01/app/oracle11g/oradata/test/tbs_ts1_01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              376
  Index      0              0
  Other      0              135

Finished validate at 2015-09-29 07:55:59

--如果仔细看,可以发现开了3个并行。

RMAN> show DEVICE type ;
RMAN configuration parameters for database with db_unique_name TEST are:
CONFIGURE DEVICE TYPE DISK PARALLELISM 3 BACKUP TYPE TO BACKUPSET;

SCOTT@test> select * from v$database_block_corruption;
no rows selected

--检查单个数据文件
RMAN> VALIDATE datafile 1 ;
Starting validate at 2015-09-29 08:00:01
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00001 name=/u01/app/oracle11g/oradata/test/system01.dbf
channel ORA_DISK_2: starting validation of datafile
channel ORA_DISK_2: specifying datafile(s) for validation
including current SPFILE in backup set
channel ORA_DISK_3: starting validation of datafile
channel ORA_DISK_3: specifying datafile(s) for validation
including current control file for validation
channel ORA_DISK_2: validation complete, elapsed time: 00:00:01
List of Control File and SPFILE
===============================
File Type    Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
SPFILE       OK     0              2
channel ORA_DISK_3: validation complete, elapsed time: 00:00:01
List of Control File and SPFILE
===============================
File Type    Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
Control File OK     0              1232
channel ORA_DISK_1: validation complete, elapsed time: 00:00:18
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1    OK     0              12114        106242          13204084470
  File Name: /u01/app/oracle11g/oradata/test/system01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              67096
  Index      0              16916
  Other      0              10114
Finished validate at 2015-09-29 08:00:22

--另外11g还支持section size 参数,这样可以检查通过这个参数将文件分成几个部分同时检查(在打开并行的情况下)。

RMAN> VALIDATE section size 200M datafile 1;

Starting validate at 2015-09-29 08:02:10
using channel ORA_DISK_1
using channel ORA_DISK_2
using channel ORA_DISK_3
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00001 name=/u01/app/oracle11g/oradata/test/system01.dbf
validating blocks 1 through 25600
channel ORA_DISK_2: starting validation of datafile
channel ORA_DISK_2: specifying datafile(s) for validation
including current SPFILE in backup set
channel ORA_DISK_3: starting validation of datafile
channel ORA_DISK_3: specifying datafile(s) for validation
including current control file for validation
channel ORA_DISK_1: validation complete, elapsed time: 00:00:00
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00001 name=/u01/app/oracle11g/oradata/test/system01.dbf
validating blocks 25601 through 51200
channel ORA_DISK_2: validation complete, elapsed time: 00:00:01
List of Control File and SPFILE
===============================
File Type    Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
SPFILE       OK     0              2
channel ORA_DISK_2: starting validation of datafile
channel ORA_DISK_2: specifying datafile(s) for validation
input datafile file number=00001 name=/u01/app/oracle11g/oradata/test/system01.dbf
validating blocks 51201 through 76800
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_1: starting validation of datafile
channel ORA_DISK_1: specifying datafile(s) for validation
input datafile file number=00001 name=/u01/app/oracle11g/oradata/test/system01.dbf
validating blocks 76801 through 102400
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
channel ORA_DISK_3: validation complete, elapsed time: 00:00:02
List of Control File and SPFILE
===============================
File Type    Status Blocks Failing Blocks Examined
------------ ------ -------------- ---------------
Control File OK     0              1232
channel ORA_DISK_3: starting validation of datafile
channel ORA_DISK_3: specifying datafile(s) for validation
input datafile file number=00001 name=/u01/app/oracle11g/oradata/test/system01.dbf
validating blocks 102401 through 106240
channel ORA_DISK_1: validation complete, elapsed time: 00:00:01
channel ORA_DISK_2: validation complete, elapsed time: 00:00:01
channel ORA_DISK_3: validation complete, elapsed time: 00:00:00
List of Datafiles
=================
File Status Marked Corrupt Empty Blocks Blocks Examined High SCN
---- ------ -------------- ------------ --------------- ----------
1    OK     0              12114        106238          13204085021
  File Name: /u01/app/oracle11g/oradata/test/system01.dbf
  Block Type Blocks Failing Blocks Processed
  ---------- -------------- ----------------
  Data       0              67096
  Index      0              16916
  Other      0              10110

Finished validate at 2015-09-29 08:02:16

--注意看~.
--使用rman的VALIDATE简单快捷不少。

时间: 2024-10-11 19:04:43

[20150929]检查数据块.txt的相关文章

[20161129]转储内存的内容还原成数据块.txt

[20161129]转储内存的内容还原成数据块.txt --昨天在做1128PAGETABLE SEGMENT HEADER损坏恢复,链接http://blog.itpub.net/267265/viewspace-2129195/ --在做还原成数据块时思路很乱,当时是一边做一边想,希望能找到好的方法,今天自己在重复做一次. 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER --

[20150612]使用bvi查看数据块.txt

[20150612]使用bvi查看数据块.txt --编写一个简单的脚本实现bvi查看数据块,主要我现在喜欢使用bbed查看,而修改选择bvi. --通过例子来说明: SCOTT@test> select rowid,dept.* from dept ; ROWID                    DEPTNO DNAME          LOC ------------------ ------------ -------------- ------------- AABJVUAAEA

[20150513]人为破坏数据块.txt

[20150513]人为破坏数据块.txt --演示的目的,参考链接: http://www.askmaclean.com/archives/oracle-make-block-physical-corruption.html --不要在生产系统测试!!!!! 1.建立测试环境: SCOTT@test> @ &r/ver1 PORT_STRING                    VERSION        BANNER ------------------------------ -

[20160531]windows下bbed修复corrupt数据块

[20160531]windows下bbed修复corrupt数据块.txt --昨天别人的问题,使用windows下的bbed修复corrupt数据块报错.我自己也重复测试看看: --bbed在windows的安装看: http://blog.itpub.net/267265/viewspace-2109019/ 1.环境: SCOTT@book> @ &r/ver1 PORT_STRING                    VERSION        BANNER --------

[20160831]关于数据块Checksum.txt

[20160831]关于数据块Checksum.txt --以前我学习bbed时做过一些测试,将'AAAA'替换成'BBBB',你可以发现数据块的Checksum并没有发生变化,当时并没有仔细探究, --现在想起来计算Checksum算法应该相对简单,就是做异或操作. --比如上面的字符'AAAA'如果2个字符按位做异或操作,变成00000000,这个正好巧合,如果修改成'CCCC',做相同的异或操作结果 --也是00000000. --如果按照这个推测修改为'CDCD',这样做异或操作的结果也

[20161031]rman备份与数据文件OS块.txt

[20161031]rman备份与数据文件OS块.txt --每个数据文件都有一个OS块,位于数据文件的第1块(也是0块).通过bbed无法访问: BBED> set dba 7,0 BBED-00205: illegal or out of range DBA (File 7, Block 0) BBED> set dba 7,1         DBA             0x01c00001 (29360129 7,1) BBED> dump File: /mnt/ramdis

[20121115]关于oracle数据文件的第1块.txt

[20121115]关于oracle数据文件的第1块.txt 每个数据文件的第一个块(block 0)是OS block header,在数据库中查询不到信息,记录的是OS信息,以及文件大小的等信息.今天做一些简单的研究. SQL> select * from v$version where rownum BANNER -------------------------------------------------------------------------------- Oracle D

oracle数据块如何进行一致性检查

什么是数据块一致性? 每一个数据块头部都有一个"校验和"字段 当数据块被写回磁盘前,Oracle会重新计算这个校验和 并记录到这个字段,最终写回磁盘 下次数据块被读入内存时,Oracle会重新计算数据块的校验和 并与校验和字段中的值相比较 如果有差异,Oracle就会抛出ORA-1578 也就是,整个校验过程: 写回时,计算并保存 读入时,计算并比较 通过校验和字段进行检查叫物理一致性检查,其侧重于硬件故障,并不关心内容正确与否 而逻辑一致性检查便是接手这任务,如:记录和索引是否对应:

[20170611]关于数据块地址的计算.txt

[20170611]关于数据块地址的计算.txt --//如果数据库出现一些问题,会在alert或者跟踪文件,或者屏幕出现一些错误提示.例如: ORA-00600: internal error code, arguments: [2662], [3], [392066208], [3], [392066212], [4194825], [], [], [], [], [], [] ORA-600 [2662] [a] [b] {c} [d] [e] Arg [a] Current SCN WR