================================
block recover LABs
================================
SYS@orcl>create tablespace bbed_test
2 datafile '/u01/app/oracle/oradata/orcl/bbed_test01.dbf' size 5m;
Tablespace created.
SYS@orcl>create table hr.cp_emp tablespace bbed_test
2 as select * from hr.employees;
Table created.
SYS@orcl>select table_name, tablespace_name from dba_tables where table_name='CP_EMP';
TABLE_NAME TABLESPACE_NAME
------------------------------ ------------------------------
CP_EMP BBED_TEST
SYS@orcl>select owner, segment_name, segment_type, block_id, blocks
2 from dba_extents
3 where tablespace_name = 'BBED_TEST';
OWNER SEGMENT_NAME SEGMENT_TYPE BLOCK_ID
------------------------------ --------------------------------------------------------------------------------- ------------------ ----------
BLOCKS
----------
HR CP_EMP TABLE 128
SYS@orcl>alter tablespace bbed_test begin backup;
Tablespace altered.
SYS@orcl>!cp /u01/app/oracle/oradata/orcl/bbed_test01.dbf /BACKUP/open
SYS@orcl>alter tablespace bbed_test end backup;
Tablespace altered.
SYS@orcl>exit
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@lnx04 /]$ rtc
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Oct 14 17:02:42 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1420439357)
connected to recovery catalog database
RMAN> backup tablespace bbed_test;
Starting backup at 2015-10-14:17:02:48
starting full resync of recovery catalog
full resync complete
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=26 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=144 device type=DISK
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00011 name=/u01/app/oracle/oradata/orcl/bbed_test01.dbf
channel ORA_DISK_1: starting piece 1 at 2015-10-14:17:02:50
channel ORA_DISK_1: finished piece 1 at 2015-10-14:17:02:51
piece handle=/BACKUP/rman/ORCL_203_1 tag=TAG20151014T170250 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 2015-10-14:17:02:51
Starting Control File and SPFILE Autobackup at 2015-10-14:17:02:51
piece handle=/BACKUP/rman_con/c-1420439357-20151014-09 comment=NONE
Finished Control File and SPFILE Autobackup at 2015-10-14:17:02:52
[oracle@lnx04 /]$ dd if=/u01/app/oracle/oradata/orcl/example01.dbf of=/u01/app/oracle/oradata/orcl/bbed_test01.dbf bs=8192 seek=9 count=2 conv=notrunc
2+0 records in
2+0 records out
16384 bytes (16 kB) copied, 0.00232911 seconds, 7.0 MB/s
[oracle@lnx04 /]$ dd if=/u01/app/oracle/oradata/orcl/example01.dbf of=/u01/app/oracle/oradata/orcl/bbed_test01.dbf bs=8192 seek=10 count=2 conv=notrunc
2+0 records in
2+0 records out
16384 bytes (16 kB) copied, 0.000133686 seconds, 123 MB/s
[oracle@lnx04 /]$ dbv file=/u01/app/oracle/oradata/orcl/bbed_test01.dbf
DBVERIFY: Release 11.2.0.1.0 - Production on Wed Oct 14 17:04:50 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/orcl/bbed_test01.dbf
Page 9 is marked corrupt
Corrupt block relative dba: 0x02c00009 (file 11, block 9)
Bad header found during dbv:
Data in bad block:
type: 0 format: 2 rdba: 0xffc00000
last change scn: 0x0000.00000000 seq: 0x0 flg: 0x00
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x00000000
check value in block header: 0xc866
block checksum disabled
Page 10 is marked corrupt
Corrupt block relative dba: 0x02c0000a (file 11, block 10)
Bad header found during dbv:
Data in bad block:
type: 0 format: 2 rdba: 0xffc00000
last change scn: 0x0000.00000000 seq: 0x0 flg: 0x00
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x00000000
check value in block header: 0xc866
block checksum disabled
Page 11 is marked corrupt
Corrupt block relative dba: 0x02c0000b (file 11, block 11)
Bad header found during dbv:
Data in bad block:
type: 11 format: 2 rdba: 0x01400001
last change scn: 0x0000.00000000 seq: 0x1 flg: 0x04
spare1: 0x0 spare2: 0x0 spare3: 0x0
consistency value in tail: 0x00000b01
check value in block header: 0xdde7
computed block checksum: 0x0
[oracle@lnx04 /]$ rtc
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Oct 14 17:06:01 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1420439357)
connected to recovery catalog database
RMAN> recover datafile 11 block 9;
Starting recover at 2015-10-14:17:06:20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=23 device type=DISK
searching flashback logs for block images until SCN 1238124
finished flashback log search, restored 1 blocks
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 2015-10-14:17:06:25
RMAN> recover datafile 11 block 10;
Starting recover at 2015-10-14:17:06:41
using channel ORA_DISK_1
using channel ORA_DISK_2
searching flashback logs for block images until SCN 1238124
finished flashback log search, restored 1 blocks
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 2015-10-14:17:06:42
RMAN> recover datafile 11 block 11;
Starting recover at 2015-10-14:17:06:45
using channel ORA_DISK_1
using channel ORA_DISK_2
searching flashback logs for block images until SCN 1238124
finished flashback log search, restored 1 blocks
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 2015-10-14:17:06:48
DBVERIFY - Verification complete
Total Pages Examined : 640
Total Pages Processed (Data) : 2
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 127
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 508
Total Pages Marked Corrupt : 3
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 1237380 (0.1237380)
SYS@orcl>startup force
ORACLE instance started.
Total System Global Area 1707446272 bytes
Fixed Size 1336988 bytes
Variable Size 1006635364 bytes
Database Buffers 687865856 bytes
Redo Buffers 11608064 bytes
Database mounted.
Database opened.
SYS@orcl>select * from hr.cp_emp;
EMPLOYEE_ID FIRST_NAME LAST_NAME EMAIL PHONE_NUMBER HIRE_DATE JOB_ID SALARY
----------- -------------------- ------------------------- ------------------------- -------------------- ------------------- ---------- ----------
[oracle@lnx04 /]$ rtc
Recovery Manager: Release 11.2.0.1.0 - Production on Wed Oct 14 17:06:01 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORCL (DBID=1420439357)
connected to recovery catalog database
RMAN> recover datafile 11 block 9;
Starting recover at 2015-10-14:17:06:20
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=133 device type=DISK
allocated channel: ORA_DISK_2
channel ORA_DISK_2: SID=23 device type=DISK
searching flashback logs for block images until SCN 1238124
finished flashback log search, restored 1 blocks
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 2015-10-14:17:06:25
RMAN> recover datafile 11 block 10;
Starting recover at 2015-10-14:17:06:41
using channel ORA_DISK_1
using channel ORA_DISK_2
searching flashback logs for block images until SCN 1238124
finished flashback log search, restored 1 blocks
starting media recovery
media recovery complete, elapsed time: 00:00:01
Finished recover at 2015-10-14:17:06:42
RMAN> recover datafile 11 block 11;
Starting recover at 2015-10-14:17:06:45
using channel ORA_DISK_1
using channel ORA_DISK_2
searching flashback logs for block images until SCN 1238124
finished flashback log search, restored 1 blocks
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 2015-10-14:17:06:48
========================================
Using BBED
========================================
[oracle@ocp11g]$ cd /app/oracle/product/11.2.0/db_1/rdbms/lib
[oracle@ocp11g lib]$ cp /mnt/hgfs/shared/ssbbded.o ./
[oracle@ocp11g lib]$ cp /mnt/hgfs/shared/sbbdpt.o ./
[oracle@ocp11g lib]$ cd ../mesg/
[oracle@ocp11g mesg]$ pwd
/u01/app/oracle/product/11.2.0/db_1/rdbms/mesg
[oracle@ocp11g mesg]$ cp /mnt/hgfs/shared/bbed* ./
[oracle@lnx04 lib]$ make -f ins_rdbms.mk BBED=$ORACLE_HOME/bin/bbed $ORACLE_HOME/bin/bbed
Linking BBED utility (bbed)
rm -f /u01/app/oracle/product/11.2.0/db_1/bin/bbed
gcc -o /u01/app/oracle/product/11.2.0/db_1/bin/bbed -m32 -L/u01/app/oracle/product/11.2.0/db_1/rdbms/lib/ -L/u01/app/oracle/product/11.2.0/db_1/lib/ -L/u01/app/oracle/product/11.2.0/db_1/lib/stubs/ -L/u01/app/oracle/product/11.2.0/db_1/lib/ -lirc -lipgo /u01/app/oracle/product/11.2.0/db_1/lib/s0main.o /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/ssbbded.o /u01/app/oracle/product/11.2.0/db_1/rdbms/lib/sbbdpt.o `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -ldbtools11 -lclntsh `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnnz11 -lzt11 -lztkg11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lmm -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lnro11 `cat /u01/app/oracle/product/11.2.0/db_1/lib/ldflags` -lncrypt11 -lnsgr11 -lnzjs11 -ln11 -lnl11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 -lclient11 -lnnetd11 -lvsn11 -lcommon11 -lgeneric11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lcore11 -lsnls11 -lnls11 -lxml11 -lcore11 -lunls11 -lsnls11 -lnls11 -lcore11 -lnls11 `cat /u01/app/oracle/product/11.2.0/db_1/lib/sysliblist` -Wl,-rpath,/u01/app/oracle/product/11.2.0/db_1/lib -lm `cat /u01/app/oracle/product/11.2.0/db_1/lib/sysliblist` -ldl -lm -L/u01/app/oracle/product/11.2.0/db_1/lib
[oracle@lnx04 lib]$ cd /u01/app/oracle/product/11.2.0/db_1/bin/
[oracle@lnx04 bin]$ ls bbed*
bbed
SYS@orcl>col file_name for a45
SYS@orcl>select file_id, file_name, bytes/1024/1024 MB from dba_data_files order by 1;
FILE_ID FILE_NAME MB
---------- --------------------------------------------- ----------
1 /u01/app/oracle/oradata/orcl/system01.dbf 700
2 /u01/app/oracle/oradata/orcl/sysaux01.dbf 540
3 /u01/app/oracle/oradata/orcl/undotbs01.dbf 105
4 /u01/app/oracle/oradata/orcl/users01.dbf 5
5 /u01/app/oracle/oradata/orcl/example01.dbf 100
6 /u01/app/oracle/oradata/orcl/rman_tbs.dbf 100
7 /u02/app/oracle/oradata/orcl/fbda101a.dbf 10.9921875
8 /u02/app/oracle/oradata/orcl/fbda101b.dbf 10.9921875
9 /u02/app/oracle/oradata/orcl/fbda201a.dbf 10.9921875
10 /u02/app/oracle/oradata/orcl/fbda201.b.dbf 10.9921875
11 /u01/app/oracle/oradata/orcl/bbed_test01.dbf 5
11 rows selected.
[oracle@lnx04 ~]$ vi files.lst
1 /u01/app/oracle/oradata/orcl/system01.dbf 700
2 /u01/app/oracle/oradata/orcl/sysaux01.dbf 540
3 /u01/app/oracle/oradata/orcl/undotbs01.dbf 105
4 /u01/app/oracle/oradata/orcl/users01.dbf 5
5 /u01/app/oracle/oradata/orcl/example01.dbf 100
6 /u01/app/oracle/oradata/orcl/rman_tbs.dbf 100
7 /u02/app/oracle/oradata/orcl/fbda101a.dbf 10.9921875
8 /u02/app/oracle/oradata/orcl/fbda101b.dbf 10.9921875
9 /u02/app/oracle/oradata/orcl/fbda201a.dbf 10.9921875
10 /u02/app/oracle/oradata/orcl/fbda201.b.dbf 10.9921875
11 /u01/app/oracle/oradata/orcl/bbed_test01.dbf 5
12 /BACKUP/open/bbed_test01.dbf 5
[oracle@lnx04 ~]$ vi par.bbd
blocksize=8192
listfile=files.lst
mode=edit
[oracle@lnx04 ~]$ bbed parfile=par.bbd
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Wed Oct 14 17:16:20 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> help all
SET DBA [ dba | file#, block# ]
SET FILENAME 'filename'
SET FILE file#
SET BLOCK [+/-]block#
SET OFFSET [ [+/-]byte offset | symbol | *symbol ]
SET BLOCKSIZE bytes
SET LIST[FILE] 'filename'
SET WIDTH character_count
SET COUNT bytes_to_display
SET IBASE [ HEX | OCT | DEC ]
SET OBASE [ HEX | OCT | DEC ]
SET MODE [ BROWSE | EDIT ]
SET SPOOL [ Y | N ]
SHOW [ <SET parameter> | ALL ]
INFO
MAP[/v] [ DBA | FILENAME | FILE | BLOCK ]
DUMP[/v] [ DBA | FILENAME | FILE | BLOCK | OFFSET | COUNT ]
PRINT[/x|d|u|o|c] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
EXAMINE[/Nuf] [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
</Nuf>:
N - a number which specifies a repeat count.
u - a letter which specifies a unit size:
b - b1, ub1 (byte)
h - b2, ub2 (half-word)
w - b4, ub4(word)
r - Oracle table/index row
f - a letter which specifies a display format:
x - hexadecimal
d - decimal
u - unsigned decimal
o - octal
c - character (native)
n - Oracle number
t - Oracle date
i - Oracle rowid
FIND[/x|d|u|o|c] numeric/character string [ TOP | CURR ]
COPY [ DBA | FILE | FILENAME | BLOCK ] TO [ DBA | FILE | FILENAME | BLOCK ]
MODIFY[/x|d|u|o|c] numeric/character string
[ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
ASSIGN[/x|d|u|o] <target spec>=<source spec>
<target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
<source spec> : [ value | <target spec options> ]
SUM [ DBA | FILE | FILENAME | BLOCK ] [ APPLY ]
PUSH [ DBA | FILE | FILENAME | BLOCK | OFFSET ]
POP [ALL]
REVERT [ DBA | FILE | FILENAME | BLOCK ]
UNDO
HELP [ <bbed command> | ALL ]
VERIFY [ DBA | FILE | FILENAME | BLOCK ]
CORRUPT [ DBA | FILE | FILENAME | BLOCK ]
BBED> info
File# Name Size(blks)
----- ---- ----------
1 /u01/app/oracle/oradata/orcl/system01.dbf 0
2 /u01/app/oracle/oradata/orcl/sysaux01.dbf 0
3 /u01/app/oracle/oradata/orcl/undotbs01.dbf 0
4 /u01/app/oracle/oradata/orcl/users01.dbf 0
5 /u01/app/oracle/oradata/orcl/example01.dbf 0
6 /u01/app/oracle/oradata/orcl/rman_tbs.dbf 0
7 /u02/app/oracle/oradata/orcl/fbda101a.dbf 0
8 /u02/app/oracle/oradata/orcl/fbda101b.dbf 0
9 /u02/app/oracle/oradata/orcl/fbda201a.dbf 0
10 /u02/app/oracle/oradata/orcl/fbda201.b.dbf 0
11 /u01/app/oracle/oradata/orcl/bbed_test01.dbf 0
12 /BACKUP/open/bbed_test01.dbf 0
BBED> copy file 12 block 9 file 11 block 9
File: /u01/app/oracle/oradata/orcl/system01.dbf (1)
Block: 1 Offsets: 0 to 511 Dba:0x00400001
------------------------------------------------------------------------
1ea20000 0900c002 36dd1200 00000104 60c20000 0b000000 80802e00 00000000
00000000 00f80000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> copy file 12 block 10 file 11 block 10
File: /u01/app/oracle/oradata/orcl/system01.dbf (1)
Block: 1 Offsets: 0 to 511 Dba:0x00400001
------------------------------------------------------------------------
1ea20000 0a00c002 38dd1200 00000104 7b020000 0b000000 80403600 00000000
00000000 00f80000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> copy file 12 block 11 file 11 block 11
File: /u01/app/oracle/oradata/orcl/system01.dbf (1)
Block: 1 Offsets: 0 to 511 Dba:0x00400001
------------------------------------------------------------------------
1ea20000 0b00c002 3add1200 00000104 72420000 0b000000 80003e00 00000000
00000000 00f80000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
<32 bytes per line>
BBED> exit
[oracle@lnx04 ~]$ dbv file=/u01/app/oracle/oradata/orcl/bbed_test01.dbf
DBVERIFY: Release 11.2.0.1.0 - Production on Wed Oct 14 17:18:00 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
DBVERIFY - Verification starting : FILE = /u01/app/oracle/oradata/orcl/bbed_test01.dbf
DBVERIFY - Verification complete
Total Pages Examined : 640
Total Pages Processed (Data) : 2
Total Pages Failing (Data) : 0
Total Pages Processed (Index): 0
Total Pages Failing (Index): 0
Total Pages Processed (Other): 130
Total Pages Processed (Seg) : 0
Total Pages Failing (Seg) : 0
Total Pages Empty : 508
Total Pages Marked Corrupt : 0
Total Pages Influx : 0
Total Pages Encrypted : 0
Highest block SCN : 1237380 (0.1237380)