湖北佛 发表于 2013-9-8 22:25:31

dbv检测,dd块恢复

sys@OMREP> select segment_name,tablespace_id,header_file,header_block from sys_dba_segs where segment_name='T';

SEGMENT_NAME                                                                      TABLESPACE_ID HEADER_FILE HEADER_BLOCK
--------------------------------------------------------------------------------- ------------- ----------- ------------
T                                                                                             4         4      21578

sys@OMREP> !dbv segment_id=4.4.21578 userid=scott/tiger

DBVERIFY: Release 11.2.0.1.0 - Production on Wed Sep 4 15:17:39 2013

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

DBVERIFY - Verification starting : SEGMENT_ID = 4.4.21578


DBVERIFY - Verification complete

Total Pages Examined         : 256
Total Pages Processed (Data) : 244
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 11
Total Pages Processed (Seg): 1
Total Pages Failing   (Seg): 0
Total Pages Empty            : 0
Total Pages Marked Corrupt   : 0
Total Pages Influx         : 0
Total Pages Encrypted      : 0
Highest block SCN            : 1928594 (0.1928594)

冷备份,dd逐块恢复
sys@OMREP> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.

$ dd of=users01.dbf bs=8192 conv=notrunc seek=21578 <<EOF
corrupt me
EOF
0+1 records in
0+1 records out
11 bytes (11 B) copied, 8.0791e-05 s, 136 kB/s

sys@OMREP> startup
ORACLE instance started.

Total System Global Area422670336 bytes
Fixed Size                  1336960 bytes
Variable Size             335546752 bytes
Database Buffers         79691776 bytes
Redo Buffers                6094848 bytes
Database mounted.
Database opened.
sys@OMREP> select count(*) from scott.t;
select count(*) from scott.t
                           *
ERROR at line 1:
ORA-01578: ORACLE data block corrupted (file # 4, block # 21578)
ORA-01110: data file 4: '/u01/app/oracle/oradata/omrep/users01.dbf'

$ dd if=users01.bak of=users01.dbf bs=8192 count=1 conv=notrunc skip=21578 seek=21578      
1+0 records in
1+0 records out
8192 bytes (8.2 kB) copied, 0.000132787 s, 61.7 MB/s

sys@OMREP> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
sys@OMREP> startup
ORACLE instance started.

Total System Global Area422670336 bytes
Fixed Size                  1336960 bytes
Variable Size             335546752 bytes
Database Buffers         79691776 bytes
Redo Buffers                6094848 bytes
Database mounted.
Database opened.

sys@OMREP> select count(*) from scott.t;

COUNT(*)
----------
   13281

如果数据文件老的,之前数据有更新怎么办,还需要测试,

sys@OMREP> !dbv file=/u01/app/oracle/oradata/omrep/users01.dbf feedback=1000;

DBVERIFY: Release 11.2.0.1.0 - Production on Wed Sep 4 08:54:23 2013

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

DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/omrep/users01.dbf
.......................

DBVERIFY - Verification complete

Total Pages Examined         : 22560
Total Pages Processed (Data) : 20644
Total Pages Failing   (Data) : 0
Total Pages Processed (Index): 50
Total Pages Failing   (Index): 0
Total Pages Processed (Other): 513
Total Pages Processed (Seg): 0
Total Pages Failing   (Seg): 0
Total Pages Empty            : 1353
Total Pages Marked Corrupt   : 0
Total Pages Influx         : 0
Total Pages Encrypted      : 0
Highest block SCN            : 1896412 (0.1896412)

页: [1]
查看完整版本: dbv检测,dd块恢复