使用bbed完成資料庫的不完全恢復
測試目的:使用bbed修改資料庫檔案頭的scn,完成不完全恢復資料庫
測試環境:
DB:Oracle 10gR2
Os: rhel 6.4
測試步驟:
建立測試資料:
SQL> create tablespace test datafile '/app/oracle/product/10.2.0/oradata/orac/test01.dbf' size 100m;
Tablespace created.
SQL> create user test identified by test default tablespace test;
User created.
SQL> grant dba to test;
Grant succeeded.
SQL> SQL> conn test/test
Connected.
SQL> create table emp as select * from scott.emp;
Table created.
SQL> create table dept as select * from scott.dept;
Table created.
SQL> insert into emp select * from emp;
14 rows created.
SQL> commit;
Commit complete.
SQL> insert into dept select * from dept;
4 rows created.
SQL> commit;
Commit complete.
修改資料庫到歸檔模式,模擬歸檔丟失
SQL> alter system set log_archive_dest_1='location=/home/oracle/arch';
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
備份資料檔案,可以使用rman,也可以使用冷備份
[oracle@eagle orac]$ cp test01.dbf bak/
SQL> startup mount
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 469762568 bytes
Database Buffers 1124073472 bytes
Redo Buffers 14680064 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch
Oldest online log sequence 18
Next log sequence to archive 20
Current log sequence 20
SQL> alter database open;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch
Oldest online log sequence 19
Next log sequence to archive 21
Current log sequence 21
SQL> conn test
Enter password:
Connected.
SQL> insert into emp select * from emp;
28 rows created.
SQL> commit;
Commit complete.
SQL> insert into dept select * from dept;
8 rows created.
SQL> commit;
Commit complete.
SQL> conn test
Enter password:
Connected.
SQL> select count(*) from emp;
COUNT(*)
----------
56
SQL> select count(*) from dept;
COUNT(*)
----------
16
SQL> conn / as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL> /
多切換幾次歸檔
模擬資料庫掉電等意外情況
SQL> shutdown abort
ORACLE instance shut down.
刪除歸檔,更改資料檔名稱
[oracle@eagle arch]$ ls
1_21_832528067.dbf 1_23_832528067.dbf 1_25_832528067.dbf 1_27_832528067.dbf 1_29_832528067.dbf
1_22_832528067.dbf 1_24_832528067.dbf 1_26_832528067.dbf 1_28_832528067.dbf
[oracle@eagle arch]$ rm *
[oracle@eagle orac]$ mv test01.dbf test01.dbf_bak
啟動資料庫
Size 469762568 bytes
Database Buffers 1124073472 bytes
Redo Buffers 14680064 bytes
Database mounted.
ORA-01113: file 5 needs media recovery if it was restored from backup, or END BACKUP if it was not
ORA-01110: data file 5: '/app/oracle/product/10.2.0/oradata/orac/test01.dbf'
SQL> recover database;
ORA-00279: change 667398 generated at 12/20/2013 16:52:30 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch/1_20_832528067.dbf
ORA-00280: change 667398 for thread 1 is in sequence #20
Specify log: {=suggested | filename | AUTO | CANCEL}
auto
ORA-00308: cannot open archived log '/home/oracle/arch/1_20_832528067.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log '/home/oracle/arch/1_20_832528067.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
檢視資料庫的檔案scn
SQL> select name,CHECKPOINT_CHANGE# from v$datafile;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------------------------------------- ------------------
/app/oracle/product/10.2.0/oradata/orac/system01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/users01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/test01.dbf 687898
檢視檔案頭scn
SQL> select name,CHECKPOINT_CHANGE# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------------------------------------- ------------------
/app/oracle/product/10.2.0/oradata/orac/system01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/users01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/test01.dbf 667398
第五個資料檔案scn值不一致
檢視16進位制的scn號
SQL> select to_char('687898','xxxxx') from dual;
TO_CHA
------
a7f1a
SQL> c/687898/667398
1* select to_char('667398','xxxxx') from dual
SQL> /
TO_CHA
------
a2f06
配置bbed的file
[oracle@eagle ~]$ more file.txt
1 /app/oracle/product/10.2.0/oradata/orac/system01.dbf 461373440
2 /app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 94371840
3 /app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 283115520
4 /app/oracle/product/10.2.0/oradata/orac/users01.dbf 5242880
5 /app/oracle/product/10.2.0/oradata/orac/test01.dbf 10485760
[oracle@eagle ~]$ more bd.par
listfile=file.txt
mode=edit
[oracle@eagle ~]$ bbed password=blockedit parfile=bd.par
BBED: Release 2.0.0.0.0 - Limited Production on Fri Dec 20 17:10:08 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> info
File# Name Size(blks)
----- ---- ----------
1 /app/oracle/product/10.2.0/oradata/orac/system01.dbf 56320
2 /app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 11520
3 /app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 34560
4 /app/oracle/product/10.2.0/oradata/orac/users01.dbf 640
5 /app/oracle/product/10.2.0/oradata/orac/test01.dbf 1280
BBED> d /v dba 5,1
File: /app/oracle/product/10.2.0/oradata/orac/test01.dbf (5)
Block: 1 Offsets: 484 to 995 Dba:0x01400001
-------------------------------------------------------
062f0a00 00000000 4e47c031 01000000 l ./......NG1....
14000000 5b030000 10000000 02000000 l ....[...........
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
0d000d00 0d000100 00000000 00000000 l ................
00000000 02004001 00000000 00000000 l ......@.........
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
<16 bytes per line>
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x000a2f06
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x31c0474e
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x00000014
ub4 kcrbabno @504 0x0000035b
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
BBED> d /v dba 5,1 offset 484
File: /app/oracle/product/10.2.0/oradata/orac/test01.dbf (5)
Block: 1 Offsets: 484 to 995 Dba:0x01400001
-------------------------------------------------------
062f0a00 00000000 4e47c031 01000000 l ./......NG1....
14000000 5b030000 10000000 02000000 l ....[...........
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
0d000d00 0d000100 00000000 00000000 l ................
00000000 02004001 00000000 00000000 l ......@.........
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
<16 bytes per line>
BBED> m /x 1a7f0a dba 5,1 offset 484
File: /app/oracle/product/10.2.0/oradata/orac/test01.dbf (5)
Block: 1 Offsets: 484 to 995 Dba:0x01400001
------------------------------------------------------------------------
1a7f0a00 00000000 4e47c031 01000000 14000000 5b030000 10000000 02000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0d000d00 0d000100 00000000 00000000 00000000 02004001 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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> verify
DBVERIFY - Verification starting
FILE = /app/oracle/product/10.2.0/oradata/orac/test01.dbf
BLOCK = 1
Block 1 is corrupt
Corrupt block relative dba: 0x01400001 (file 0, block 1)
Bad check value found during verification
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: 0xa8a5
computed block checksum: 0x501c
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 1
Total Blocks Influx : 0
BBED> sum apply
Check value for File 5, Block 1:
current = 0xf8b9, required = 0xf8b9
BBED> exit
重新啟動資料庫
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 469762568 bytes
Database Buffers 1124073472 bytes
Redo Buffers 14680064 bytes
Database mounted.
ORA-01113: file 5 needs media recovery if it was restored from backup, or END BACKUP if it was not
ORA-01110: data file 5: '/app/oracle/product/10.2.0/oradata/orac/test01.dbf'
SQL> select name,CHECKPOINT_CHANGE# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------------------------------------- ------------------
/app/oracle/product/10.2.0/oradata/orac/system01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/users01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/test01.dbf 687898
SQL> recover database;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> conn test
Enter password:
Connected.
SQL> select count(*) from emp;
COUNT(*)
----------
28
SQL> select count(*) from dept;
COUNT(*)
----------
8
資料庫啟動成功,丟失部分資料
測試環境:
DB:Oracle 10gR2
Os: rhel 6.4
測試步驟:
建立測試資料:
SQL> create tablespace test datafile '/app/oracle/product/10.2.0/oradata/orac/test01.dbf' size 100m;
Tablespace created.
SQL> create user test identified by test default tablespace test;
User created.
SQL> grant dba to test;
Grant succeeded.
SQL> SQL> conn test/test
Connected.
SQL> create table emp as select * from scott.emp;
Table created.
SQL> create table dept as select * from scott.dept;
Table created.
SQL> insert into emp select * from emp;
14 rows created.
SQL> commit;
Commit complete.
SQL> insert into dept select * from dept;
4 rows created.
SQL> commit;
Commit complete.
修改資料庫到歸檔模式,模擬歸檔丟失
SQL> alter system set log_archive_dest_1='location=/home/oracle/arch';
System altered.
SQL> shutdown immediate
Database closed.
Database dismounted.
ORACLE instance shut down.
備份資料檔案,可以使用rman,也可以使用冷備份
[oracle@eagle orac]$ cp test01.dbf bak/
SQL> startup mount
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 469762568 bytes
Database Buffers 1124073472 bytes
Redo Buffers 14680064 bytes
Database mounted.
SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch
Oldest online log sequence 18
Next log sequence to archive 20
Current log sequence 20
SQL> alter database open;
Database altered.
SQL> alter system switch logfile;
System altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /home/oracle/arch
Oldest online log sequence 19
Next log sequence to archive 21
Current log sequence 21
SQL> conn test
Enter password:
Connected.
SQL> insert into emp select * from emp;
28 rows created.
SQL> commit;
Commit complete.
SQL> insert into dept select * from dept;
8 rows created.
SQL> commit;
Commit complete.
SQL> conn test
Enter password:
Connected.
SQL> select count(*) from emp;
COUNT(*)
----------
56
SQL> select count(*) from dept;
COUNT(*)
----------
16
SQL> conn / as sysdba
Connected.
SQL> alter system switch logfile;
System altered.
SQL> /
多切換幾次歸檔
模擬資料庫掉電等意外情況
SQL> shutdown abort
ORACLE instance shut down.
刪除歸檔,更改資料檔名稱
[oracle@eagle arch]$ ls
1_21_832528067.dbf 1_23_832528067.dbf 1_25_832528067.dbf 1_27_832528067.dbf 1_29_832528067.dbf
1_22_832528067.dbf 1_24_832528067.dbf 1_26_832528067.dbf 1_28_832528067.dbf
[oracle@eagle arch]$ rm *
[oracle@eagle orac]$ mv test01.dbf test01.dbf_bak
啟動資料庫
Size 469762568 bytes
Database Buffers 1124073472 bytes
Redo Buffers 14680064 bytes
Database mounted.
ORA-01113: file 5 needs media recovery if it was restored from backup, or END BACKUP if it was not
ORA-01110: data file 5: '/app/oracle/product/10.2.0/oradata/orac/test01.dbf'
SQL> recover database;
ORA-00279: change 667398 generated at 12/20/2013 16:52:30 needed for thread 1
ORA-00289: suggestion : /home/oracle/arch/1_20_832528067.dbf
ORA-00280: change 667398 for thread 1 is in sequence #20
Specify log: {
auto
ORA-00308: cannot open archived log '/home/oracle/arch/1_20_832528067.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
ORA-00308: cannot open archived log '/home/oracle/arch/1_20_832528067.dbf'
ORA-27037: unable to obtain file status
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
檢視資料庫的檔案scn
SQL> select name,CHECKPOINT_CHANGE# from v$datafile;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------------------------------------- ------------------
/app/oracle/product/10.2.0/oradata/orac/system01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/users01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/test01.dbf 687898
檢視檔案頭scn
SQL> select name,CHECKPOINT_CHANGE# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------------------------------------- ------------------
/app/oracle/product/10.2.0/oradata/orac/system01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/users01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/test01.dbf 667398
第五個資料檔案scn值不一致
檢視16進位制的scn號
SQL> select to_char('687898','xxxxx') from dual;
TO_CHA
------
a7f1a
SQL> c/687898/667398
1* select to_char('667398','xxxxx') from dual
SQL> /
TO_CHA
------
a2f06
配置bbed的file
[oracle@eagle ~]$ more file.txt
1 /app/oracle/product/10.2.0/oradata/orac/system01.dbf 461373440
2 /app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 94371840
3 /app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 283115520
4 /app/oracle/product/10.2.0/oradata/orac/users01.dbf 5242880
5 /app/oracle/product/10.2.0/oradata/orac/test01.dbf 10485760
[oracle@eagle ~]$ more bd.par
listfile=file.txt
mode=edit
[oracle@eagle ~]$ bbed password=blockedit parfile=bd.par
BBED: Release 2.0.0.0.0 - Limited Production on Fri Dec 20 17:10:08 2013
Copyright (c) 1982, 2007, Oracle. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
BBED> info
File# Name Size(blks)
----- ---- ----------
1 /app/oracle/product/10.2.0/oradata/orac/system01.dbf 56320
2 /app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 11520
3 /app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 34560
4 /app/oracle/product/10.2.0/oradata/orac/users01.dbf 640
5 /app/oracle/product/10.2.0/oradata/orac/test01.dbf 1280
BBED> d /v dba 5,1
File: /app/oracle/product/10.2.0/oradata/orac/test01.dbf (5)
Block: 1 Offsets: 484 to 995 Dba:0x01400001
-------------------------------------------------------
062f0a00 00000000 4e47c031 01000000 l ./......NG1....
14000000 5b030000 10000000 02000000 l ....[...........
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
0d000d00 0d000100 00000000 00000000 l ................
00000000 02004001 00000000 00000000 l ......@.........
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
<16 bytes per line>
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x000a2f06
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x31c0474e
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x00000014
ub4 kcrbabno @504 0x0000035b
ub2 kcrbabof @508 0x0010
ub1 kcvcpetb[0] @512 0x02
ub1 kcvcpetb[1] @513 0x00
ub1 kcvcpetb[2] @514 0x00
ub1 kcvcpetb[3] @515 0x00
ub1 kcvcpetb[4] @516 0x00
ub1 kcvcpetb[5] @517 0x00
ub1 kcvcpetb[6] @518 0x00
ub1 kcvcpetb[7] @519 0x00
BBED> d /v dba 5,1 offset 484
File: /app/oracle/product/10.2.0/oradata/orac/test01.dbf (5)
Block: 1 Offsets: 484 to 995 Dba:0x01400001
-------------------------------------------------------
062f0a00 00000000 4e47c031 01000000 l ./......NG1....
14000000 5b030000 10000000 02000000 l ....[...........
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
0d000d00 0d000100 00000000 00000000 l ................
00000000 02004001 00000000 00000000 l ......@.........
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00000000 l ................
<16 bytes per line>
BBED> m /x 1a7f0a dba 5,1 offset 484
File: /app/oracle/product/10.2.0/oradata/orac/test01.dbf (5)
Block: 1 Offsets: 484 to 995 Dba:0x01400001
------------------------------------------------------------------------
1a7f0a00 00000000 4e47c031 01000000 14000000 5b030000 10000000 02000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
0d000d00 0d000100 00000000 00000000 00000000 02004001 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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> verify
DBVERIFY - Verification starting
FILE = /app/oracle/product/10.2.0/oradata/orac/test01.dbf
BLOCK = 1
Block 1 is corrupt
Corrupt block relative dba: 0x01400001 (file 0, block 1)
Bad check value found during verification
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: 0xa8a5
computed block checksum: 0x501c
DBVERIFY - Verification complete
Total Blocks Examined : 1
Total Blocks Processed (Data) : 0
Total Blocks Failing (Data) : 0
Total Blocks Processed (Index): 0
Total Blocks Failing (Index): 0
Total Blocks Empty : 0
Total Blocks Marked Corrupt : 1
Total Blocks Influx : 0
BBED> sum apply
Check value for File 5, Block 1:
current = 0xf8b9, required = 0xf8b9
BBED> exit
重新啟動資料庫
SQL> shutdown immediate
ORA-01109: database not open
Database dismounted.
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 1610612736 bytes
Fixed Size 2096632 bytes
Variable Size 469762568 bytes
Database Buffers 1124073472 bytes
Redo Buffers 14680064 bytes
Database mounted.
ORA-01113: file 5 needs media recovery if it was restored from backup, or END BACKUP if it was not
ORA-01110: data file 5: '/app/oracle/product/10.2.0/oradata/orac/test01.dbf'
SQL> select name,CHECKPOINT_CHANGE# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------------------------------------- ------------------
/app/oracle/product/10.2.0/oradata/orac/system01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/undotbs01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/sysaux01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/users01.dbf 687898
/app/oracle/product/10.2.0/oradata/orac/test01.dbf 687898
SQL> recover database;
Media recovery complete.
SQL> alter database open;
Database altered.
SQL> conn test
Enter password:
Connected.
SQL> select count(*) from emp;
COUNT(*)
----------
28
SQL> select count(*) from dept;
COUNT(*)
----------
8
資料庫啟動成功,丟失部分資料
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24585765/viewspace-1063916/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- BBED 修改oracle 資料檔案的 SCN 號來做資料庫不完全恢復。Oracle資料庫
- 如何進行Oracle資料庫不完全恢復RBOracle資料庫
- [20210930]bbed恢復刪除的資料.txt
- ORACLE資料庫基於時間點的不完全恢復Oracle資料庫
- PG 資料庫的 表的不完全恢復的簡易方法資料庫
- [20210401]使用bbed讀取資料塊恢復注意6.txt
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- 寶塔資料庫恢復 mysql資料庫丟失恢復 mysql資料庫刪除庫恢復 寶塔mysql資料庫恢復資料庫MySql
- 【資料庫資料恢復】windows server下SqlServer資料庫的資料恢復資料庫資料恢復WindowsServerSQL
- 【資料庫資料恢復】如何恢復Oracle資料庫truncate表的資料資料庫資料恢復Oracle
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- 【資料庫資料恢復】Oracle資料庫誤truncate table的資料恢復案例資料庫資料恢復Oracle
- 【資料庫資料恢復】誤truncate table的Oracle資料庫資料恢復方案資料庫資料恢復Oracle
- [20190213]學習bbed-恢復刪除的資料.txt
- 伺服器資料恢復—透過拼接資料庫碎片恢復SqlServer資料庫資料的資料恢復案例伺服器資料恢復資料庫SQLServer
- 資料庫修復資料恢復資料庫資料恢復
- 【資料庫資料恢復】sql server資料庫連線失效的資料恢復案例資料庫資料恢復SQLServer
- 【資料庫資料恢復】SqlServer資料庫無法讀取的資料恢復案例資料庫資料恢復SQLServer
- 【資料庫資料恢復】MongoDB資料庫檔案損壞的資料恢復案例資料庫資料恢復MongoDB
- PostgreSQL從入門到精通 - 第40講:資料庫不完全恢復SQL資料庫
- MySQL資料庫的恢復MySql資料庫
- 【北亞資料庫資料恢復】使用delete未加where子句刪除全表資料的Mysql資料庫資料恢復資料庫資料恢復deleteMySql
- 資料庫資料恢復—附加資料庫錯誤823的SQL Server資料恢復案例資料庫資料恢復SQLServer
- 【資料庫資料恢復】SQL Server資料庫磁碟空間不足的資料恢復案例資料庫資料恢復SQLServer
- 【資料庫資料恢復】ASM磁碟組掉線的Oracle資料庫資料恢復案例資料庫資料恢復ASMOracle
- 【資料庫資料恢復】透過資料頁恢復Sql Server資料庫資料的過程資料庫資料恢復SQLServer
- 【資料庫資料恢復】oracle資料庫誤truncate table怎麼恢復資料?資料庫資料恢復Oracle
- 【資料庫資料恢復】linux系統下MYSQL資料庫資料恢復案例資料庫資料恢復LinuxMySql
- Oracle 不完全恢復Oracle
- 【資料庫資料恢復】ASM例項不能掛載的Oracle資料庫資料恢復案例資料庫資料恢復ASMOracle
- 【資料庫資料恢復】LINUX環境下ORACLE資料庫誤刪除的資料恢復資料庫資料恢復LinuxOracle
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- 【資料庫資料恢復】MongoDB資料庫服務啟動失敗的資料恢復案例資料庫資料恢復MongoDB
- 【資料庫資料恢復】MS SQL資料庫附加資料庫出錯怎麼恢復資料?資料庫資料恢復SQL
- sybase資料庫恢復資料庫
- Sybase ASE資料庫恢復,Sybase資料恢復,資料誤刪除恢復工具READSYBDEVICE資料庫資料恢復dev
- 【資料庫資料恢復】斷電導致Oracle資料庫資料丟失的資料恢復案例資料庫資料恢復Oracle
- 資料庫資料恢復—NTFS分割槽損壞如何恢復SqlServer資料庫資料資料庫資料恢復SQLServer