1.prepare
-
[oracle@master ~]$ cat par.txt
-
blocksize=8192
-
listfile=filelist.txt
-
mode=edit
-
[oracle@master ~]$ cat filelist.txt
-
1 /u01/oracle/oradata/edus/system01.dbf 1121976320
-
2 /u01/oracle/oradata/edus/sysaux01.dbf 1698693120
-
3 /u01/oracle/oradata/edus/undotbs01.dbf 1048576000
-
4 /u01/oracle/oradata/edus/users01.dbf 5242880
-
5 /u01/oracle/oradata/edus/edus01.dbf 532283392
-
[oracle@master ~]$ bbed parfile=par.txt
-
Password:
-
-
BBED: Release 2.0.0.0.0 - Limited Production on Sun Oct 23 07:09:40 2016
-
-
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
-
-
************* !!! For Oracle Internal Use only !!! ***************
2.利用BBED查看第1号文第520块,bootstrap$段头块内容
-
BBED> show all
-
FILE# 1
-
BLOCK# 520
-
OFFSET 20
-
DBA 0x00400208 (4194824 1,520)
-
FILENAME /u01/oracle/oradata/edus/system01.dbf
-
BIFILE bifile.bbd
-
LISTFILE filelist.txt
-
BLOCKSIZE 8192
-
MODE Edit
-
EDIT Unrecoverable
-
IBASE Dec
-
OBASE Dec
-
WIDTH 80
-
COUNT 512
-
LOGFILE log.bbd
-
SPOOL No
-
BBED> map /v
-
File: /u01/oracle/oradata/edus/system01.dbf (1)
-
Block: 520 Dba:0x00400208
-
------------------------------------------------------------
-
Unlimited Data Segment Header
-
-
struct kcbh, 20 bytes @0
-
ub1 type_kcbh @0
-
ub1 frmt_kcbh @1
-
ub1 spare1_kcbh @2
-
ub1 spare2_kcbh @3
-
ub4 rdba_kcbh @4
-
ub4 bas_kcbh @8
-
ub2 wrp_kcbh @12
-
ub1 seq_kcbh @14
-
ub1 flg_kcbh @15
-
ub2 chkval_kcbh @16
-
ub2 spare3_kcbh @18
-
-
struct ktech, 72 bytes @20
-
ub4 spare1_ktech @20
-
sword tsn_ktech @24
-
ub4 lastmap_ktech @28
-
ub4 mapcount_ktech @32
-
ub4 extents_ktech @36
-
ub4 blocks_ktech @40
-
ub2 mapend_ktech @44
-
struct hwmark_ktech, 32 bytes @48
-
struct locker_ktech, 8 bytes @80
-
ub4 flag_ktech @88
-
-
struct ktemh, 16 bytes @92
-
ub4 count_ktemh @92
-
ub4 next_ktemh @96
-
ub4 obj_ktemh @100
-
ub4 flag_ktemh @104
-
-
struct ktetb[1], 8 bytes @108
-
ub4 ktetbdba @108
-
ub4 ktetbnbk @112
-
-
struct ktshc, 8 bytes @4148
-
ub2 ktshcnxf @4148
-
ub2 ktshcnfl @4150
-
ub2 ktshcnfb @4152
-
ub1 ktshctyp @4154
-
-
struct ktsfs_seg[1], 20 bytes @4156
-
ub2 ktsfsflg @4156
-
struct ktsfsxid, 8 bytes @4160
-
ub4 ktsfslhd @4168
-
ub4 ktsfsltl @4172
-
-
struct ktsfs_txn[16], 320 bytes @4176
-
ub2 ktsfsflg @4176
-
struct ktsfsxid, 8 bytes @4180
-
ub4 ktsfslhd @4188
-
ub4 ktsfsltl @4192
-
-
ub4 tailchk @8188
-
-
-
BBED> p ktech
-
struct ktech, 72 bytes @20
-
ub4 spare1_ktech @20 0x00000000
-
sword tsn_ktech @24 0
-
ub4 lastmap_ktech @28 0x00000000
-
ub4 mapcount_ktech @32 0x00000000
-
ub4 extents_ktech @36 0x00000001
-
ub4 blocks_ktech @40 0x00000007
-
ub2 mapend_ktech @44 0x1020
-
struct hwmark_ktech, 32 bytes @48
-
ub4 extno_ktehw @48 0x00000000
-
ub4 blkno_ktehw @52 0x00000003
-
ub4 extsize_ktehw @56 0x00000007
-
ub4 blkaddr_ktehw @60 0x0040020c
-
ub4 mapblk_ktehw @64 0x00000000
-
ub4 offset_ktehw @68 0x00000000
-
ub4 flblks_ktehw @72 0x00000001
-
ub4 blkcnt_ktehw @76 0x00000003
-
struct locker_ktech, 8 bytes @80
-
ub2 kxidusn @80 0x0000
-
ub2 kxidslt @82 0x0000
-
ub4 kxidsqn @84 0x00000000
-
ub4 flag_ktech @88 0x00000000 (NONE)
-
-
-
-
BBED> set file 1 block 521;
-
FILE# 1
-
BLOCK# 521
-
-
BBED> map /v
-
File: /u01/oracle/oradata/edus/system01.dbf (1)
-
Block: 521 Dba:0x00400209
-
------------------------------------------------------------
-
KTB Data Block (Table/Cluster)
-
-
struct kcbh, 20 bytes @0
-
ub1 type_kcbh @0
-
ub1 frmt_kcbh @1
-
ub1 spare1_kcbh @2
-
ub1 spare2_kcbh @3
-
ub4 rdba_kcbh @4
-
ub4 bas_kcbh @8
-
ub2 wrp_kcbh @12
-
ub1 seq_kcbh @14
-
ub1 flg_kcbh @15
-
ub2 chkval_kcbh @16
-
ub2 spare3_kcbh @18
-
-
struct ktbbh, 48 bytes @20
-
ub1 ktbbhtyp @20
-
union ktbbhsid, 4 bytes @24
-
struct ktbbhcsc, 8 bytes @28
-
sb2 ktbbhict @36
-
ub1 ktbbhflg @38
-
ub1 ktbbhfsl @39
-
ub4 ktbbhfnx @40
-
struct ktbbhitl[1], 24 bytes @44
-
-
struct kdbh, 14 bytes @68
-
ub1 kdbhflag @68
-
sb1 kdbhntab @69
-
sb2 kdbhnrow @70
-
sb2 kdbhfrre @72
-
sb2 kdbhfsbo @74
-
sb2 kdbhfseo @76
-
sb2 kdbhavsp @78
-
sb2 kdbhtosp @80
-
-
struct kdbt[1], 4 bytes @82
-
sb2 kdbtoffs @82
-
sb2 kdbtnrow @84
-
-
sb2 kdbr[24] @86
-
-
ub1 freespace[1156] @134
-
-
ub1 rowdata[6898] @1290
-
-
ub4 tailchk @8188
-
-
-
BBED> p kdbr
-
sb2 kdbr[0] @86 8099
-
sb2 kdbr[1] @88 7962
-
sb2 kdbr[2] @90 7573
-
sb2 kdbr[3] @92 7373
-
sb2 kdbr[4] @94 6990
-
sb2 kdbr[5] @96 6778
-
sb2 kdbr[6] @98 6573
-
sb2 kdbr[7] @100 5961
-
sb2 kdbr[8] @102 5755
-
sb2 kdbr[9] @104 5555
-
sb2 kdbr[10] @106 5334
-
sb2 kdbr[11] @108 5130
-
sb2 kdbr[12] @110 4847
-
sb2 kdbr[13] @112 4613
-
sb2 kdbr[14] @114 4366
-
sb2 kdbr[15] @116 3896
-
sb2 kdbr[16] @118 3688
-
sb2 kdbr[17] @120 3473
-
sb2 kdbr[18] @122 3193
-
sb2 kdbr[19] @124 2409
-
sb2 kdbr[20] @126 2204
-
sb2 kdbr[21] @128 1630
-
sb2 kdbr[22] @130 1421
-
sb2 kdbr[23] @132 1222
-
-
BBED> p *kdbr[0]
-
rowdata[6877]
-
-------------
-
ub1 rowdata[6877] @8167 0x2c
-
-
BBED> x /rnnccccccccccccccccccccccccccc
-
rowdata[6877] @8167
-
-------------
-
flag@8167: 0x2c (KDRHFL, KDRHFF, KDRHFH)
-
lock@8168: 0x01
-
cols@8169: 3
-
-
col 0[3] @8170: -1
-
col 1[3] @8174: -1
-
col 2[9] @8178: 8.0.0.0.0
-
-
-
BBED> p *kdbr[1]
-
rowdata[6740]
-
-------------
-
ub1 rowdata[6740] @8030 0x2c
-
-
BBED> x /rnnccccccccccccccccccccccccccc
-
rowdata[6740] @8030
-
-------------
-
flag@8030: 0x2c (KDRHFL, KDRHFF, KDRHFH)
-
lock@8031: 0x01
-
cols@8032: 3
-
-
col 0[1] @8033: 0
-
col 1[1] @8035: 0
-
col 2[129] @8037: CREATE ROLLBACK SEGMENT SYSTEM STORAGE ( INITIAL 112K
-
NEXT 56K MINEXTENTS 1 MAXEXTENTS 32765 OBJNO 0 EXTENTS (FILE 1 BLOCK 128))
3.例子:直接操作数据块,模拟数据块损坏
-
BBED> set file 1 block 520;
-
FILE# 1
-
BLOCK# 520
-
-
BBED> show all;
-
FILE# 1
-
BLOCK# 520
-
OFFSET 0
-
DBA 0x00400208 (4194824 1,520)
-
FILENAME /u01/oracle/oradata/edus/system01.dbf
-
BIFILE bifile.bbd
-
LISTFILE filelist.txt
-
BLOCKSIZE 8192
-
MODE Edit
-
EDIT Unrecoverable
-
IBASE Dec
-
OBASE Dec
-
WIDTH 80
-
COUNT 512
-
LOGFILE log.bbd
-
SPOOL No
-
-
BBED> copy file 2 block 20 to file 1 block 520;
-
File: /u01/oracle/oradata/edus/system01.dbf (1)
-
Block: 520 Offsets: 0 to 511 Dba:0x00400208
-
------------------------------------------------------------------------
-
1ea20000 14008000 81080000 00000104 8b800000 02000000 80c08300 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>
-
-
关闭数据库后,重新启动数据库,报错了
-
SQL> shutdown
-
Database closed.
-
Database dismounted.
-
ORACLE instance shut down.
-
SQL> startup
-
ORACLE instance started.
-
-
Total System Global Area 1043886080 bytes
-
Fixed Size 2219952 bytes
-
Variable Size 788529232 bytes
-
Database Buffers 247463936 bytes
-
Redo Buffers 5672960 bytes
-
Database mounted.
-
ORA-01092: ORACLE instance terminated. Disconnection forced
-
ORA-00704: bootstrap process failure
-
ORA-01578: ORACLE data block corrupted (file # 1, block # 520)
-
ORA-01110: data file 1: '/u01/oracle/oradata/edus/system01.dbf'
-
Process ID: 5493
-
Session ID: 1512 Serial number: 5
-
-
SQL> shutdown abort
-
ORA-24324: service handle not initialized
-
ORA-01041: internal error. hostdef extension doesn't exist
-
SQL> exit
-
Disconnected from Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
-
With the Partitioning, OLAP, Data Mining and Real Application Testing options
-
[oracle@master ~]$ sq
-
-
SQL*Plus: Release 11.2.0.1.0 Production on Sun Oct 23 07:00:45 2016
-
-
Copyright (c) 1982, 2009, Oracle. All rights reserved.
-
-
Connected to an idle instance.
-
-
SQL> alter database mount;
-
alter database mount
-
*
-
ERROR at line 1:
-
ORA-01034: ORACLE not available
-
Process ID: 0
-
Session ID: 0 Serial number: 0
-
-
-
SQL> exit
-
Disconnected
-
[oracle@master ~]$ sq
-
-
SQL*Plus: Release 11.2.0.1.0 Production on Sun Oct 23 07:00:58 2016
-
-
Copyright (c) 1982, 2009, Oracle. All rights reserved.
-
-
Connected to an idle instance.
-
-
SQL> startup nomount; //之所以重新关闭启,在于RMAN RESTORE DATAFILE 分配CHANNEL报错
-
ORACLE instance started.
-
-
Total System Global Area 1043886080 bytes
-
Fixed Size 2219952 bytes
-
Variable Size 788529232 bytes
-
Database Buffers 247463936 bytes
-
Redo Buffers 5672960 bytes
-
SQL> alter database mount;
-
-
Database altered.
-
-
RMAN恢复
-
RMAN> restore datafile 1;
-
-
Starting restore at 23-OCT-16
-
released channel: ORA_DISK_1
-
allocated channel: ORA_DISK_1
-
channel ORA_DISK_1: SID=10 device type=DISK
-
-
channel ORA_DISK_1: starting datafile backup set restore
-
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
-
channel ORA_DISK_1: restoring datafile 00001 to /u01/oracle/oradata/edus/system01.dbf
-
channel ORA_DISK_1: reading from backup piece /oraBackup/backupSet/EDUS/backupset/2016_10_23/o1_mf_nnndf_TAG20161023T063316_d0sh0x81_.bkp
-
channel ORA_DISK_1: piece handle=/oraBackup/backupSet/EDUS/backupset/2016_10_23/o1_mf_nnndf_TAG20161023T063316_d0sh0x81_.bkp tag=TAG20161023T063316
-
channel ORA_DISK_1: restored backup piece 1
-
channel ORA_DISK_1: restore complete, elapsed time: 00:03:07
-
Finished restore at 23-OCT-16
-
-
RMAN> recover database;
-
-
Starting recover at 23-OCT-16
-
using channel ORA_DISK_1
-
-
starting media recovery
-
media recovery complete, elapsed time: 00:00:03
-
-
Finished recover at 23-OCT-16
-
-
打开数据库:
-
-
SQL> alter database open;
-
-
Database altered.
阅读(1912) | 评论(0) | 转发(0) |