利用BBED修改資料塊SCN----極端環境下的資料恢復
破壞system表空間檔案 ----比較暴力做前需做好備份
cd $ORACLE_BASE/oradata/PROD1
cp system01.dbf system01.dbf.bak
切日誌模擬生產交易,更新SCN
SYS@PROD1 > alter system switch logfile;
多切幾次
SYS@PROD1 > /
System altered.
SYS@PROD1 > /
System altered.
把舊的system檔案直接複製替換掉新的
cp system01.dbf.bak system01.dbf
再次切日誌模擬生產交易
SYS@PROD1 > alter system switch logfile;
多切幾次
SYS@PROD1 > /
System altered.
SYS@PROD1 > /
System altered.
/
alter system switch logfile
*
ERROR at line 1:
ORA-03113: end-of-file on communication channel
Process ID: 25597
Session ID: 24 Serial number: 887
出現問題,資料庫直接宕掉
SYS@PROD1 > ERROR:
ORA-03114: not connected to ORACLE
SYS@PROD1 > conn / as sysdba
Connected.
SYS@PROD1 > select status from v$instance;
ERROR:
ORA-01012: not logged on
SYS@PROD1 > conn / as sysdba
SYS@PROD1 > startup
ORACLE instance started.
Total System Global Area 313860096 bytes
Fixed Size 1344652 bytes
Variable Size 260049780 bytes
Database Buffers 46137344 bytes
Redo Buffers 6328320 bytes
Database mounted.
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/app/oracle/oradata/PROD1/system01.dbf'
SYS@PROD1 > col name for a50
SYS@PROD1 > select name,checkpoint_change# from v$datafile;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------- ------------------
/u01/app/oracle/oradata/PROD1/system01.dbf 1199315
/u01/app/oracle/oradata/PROD1/sysaux01.dbf 1199315
/u01/app/oracle/oradata/PROD1/undotbs01.dbf 1199315
/u01/app/oracle/oradata/PROD1/users01.dbf 1199315
/u01/app/oracle/oradata/PROD1/example01.dbf 1199315
scn轉換成16進位制
SYS@PROD1 > select to_char(1199315,'xxxxxxxx') from dual;
TO_CHAR(1
---------
124cd3
SYS@PROD1 > select name,checkpoint_change# from v$datafile_header;
NAME CHECKPOINT_CHANGE#
-------------------------------------------------- ------------------
/u01/app/oracle/oradata/PROD1/system01.dbf 1191817
/u01/app/oracle/oradata/PROD1/sysaux01.dbf 1199315
/u01/app/oracle/oradata/PROD1/undotbs01.dbf 1199315
/u01/app/oracle/oradata/PROD1/users01.dbf 1199315
/u01/app/oracle/oradata/PROD1/example01.dbf 1199315
可以看到資料庫users01.dbf的scn點為1191817明顯是用的備份的資料檔案。oracle在open資料庫時要對控制檔案,資料檔案頭的scn進行檢查,一致才能開啟,所以這裡我們透過ddeb來修改資料檔案頭讓它和其他的資料檔案的scn相同,達到起庫的目的。
[oracle@guo ~]$ bbed parfile=bbed.par
Password:
BBED: Release 2.0.0.0.0 - Limited Production on Tue May 19 10:52:04 2015
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
************* !!! For Oracle Internal Use only !!! ***************
用bbed查詢bbed01資料檔案結構資訊
BBED> set dba 1,1
DBA 0x00400001 (4194305 1,1)
Bbed檢視kcvfh資訊
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x00122f89
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x34754da5
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000001e
ub4 kcrbabno @504 0x00000002
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> set filename '/u01/app/oracle/oradata/PROD1/system01.dbf'
FILENAME /u01/app/oracle/oradata/PROD1/system01.dbf
BBED> p kcvfhckp
struct kcvfhckp, 36 bytes @484
struct kcvcpscn, 8 bytes @484
ub4 kscnbas @484 0x00122f89
ub2 kscnwrp @488 0x0000
ub4 kcvcptim @492 0x34754da5
ub2 kcvcpthr @496 0x0001
union u, 12 bytes @500
struct kcvcprba, 12 bytes @500
ub4 kcrbaseq @500 0x0000001e
ub4 kcrbabno @504 0x00000002
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 4,1 offset 484
File: /u01/app/oracle/oradata/PROD1/users01.dbf (4)
Block: 1 Offsets: 484 to 995 Dba:0x01000001
-------------------------------------------------------
d34c1200 0000ae31 c9607534 0100af31 l ?L....?1?`u4..?1
29000000 02000000 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 ................
0a000a00 0a000100 00000000 00000000 l ................
00000000 02000001 03000000 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>
system檔案頭
BBED> d /v dba 1,1 offset 484
File: /u01/app/oracle/oradata/PROD1/system01.dbf (1)
Block: 1 Offsets: 484 to 995 Dba:0x00400001
-------------------------------------------------------
892f1200 000089bf a54d7534 01000000 l ./.....??Mu4....
1e000000 02000000 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 ................
0a000a00 0a000100 00000000 00000000 l ................
00000000 02004000 72fc0b00 00000000 l ......@.r?......
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 024c6582 l .............Le.
d61636a4 7acf3f5d 13b1e763 d0000000 l ?.6?z??].??c?...
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00173356 l ..............3V
1c4cd306 46040f87 3704db71 a6210600 l .L?.F...7.?q?!..
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>
修改system檔案頭
BBED> modify /x d34c1200 dba 1,1 offset 484
BBED-00209: invalid number (d34c1200)
BBED> sum dba 1,1 apply
Check value for File 1, Block 1:
current = 0x6d23, required = 0x6d23
BBED> d /v dba 1,1 offset 484
File: /u01/app/oracle/oradata/PROD1/system01.dbf (1)
Block: 1 Offsets: 484 to 995 Dba:0x00400001
-------------------------------------------------------
892f1200 000089bf a54d7534 01000000 l ./.....??Mu4....
1e000000 02000000 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 ................
0a000a00 0a000100 00000000 00000000 l ................
00000000 02004000 72fc0b00 00000000 l ......@.r?......
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 024c6582 l .............Le.
d61636a4 7acf3f5d 13b1e763 d0000000 l ?.6?z??].??c?...
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00173356 l ..............3V
1c4cd306 46040f87 3704db71 a6210600 l .L?.F...7.?q?!..
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> modify /x d34c1200 dba 1,1 offset 484
BBED-00209: invalid number (d34c1200)
BBED> modify /x d34c1200 dba 1,1 offset 484
BBED-00209: invalid number (d34c1200)
BBED> d /v dba 2,1 offset 484
File: /u01/app/oracle/oradata/PROD1/sysaux01.dbf (2)
Block: 1 Offsets: 484 to 995 Dba:0x00800001
-------------------------------------------------------
d34c1200 0000ae31 c9607534 0100af31 l ?L....?1?`u4..?1
29000000 02000000 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 ................
0a000a00 0a000100 00000000 00000000 l ................
00000000 02008000 5c040c00 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> modify /x d34c1200 dba 1,1 offset 484
BBED-00209: invalid number (d34c1200)
完整16進位制提示無效d34c1200,不知道為什麼
BBED> modify /x d34c dba 1,1 offset 484 (填寫部分,字母前的)
File: /u01/app/oracle/oradata/PROD1/system01.dbf (1)
Block: 1 Offsets: 484 to 995 Dba:0x00400001
------------------------------------------------------------------------
d34c1200 000089bf a54d7534 01000000 1e000000 02000000 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
0a000a00 0a000100 00000000 00000000 00000000 02004000 72fc0b00 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
00000000 00000000 00000000 024c6582 d61636a4 7acf3f5d 13b1e763 d0000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00173356
1c4cd306 46040f87 3704db71 a6210600 00000000 00000000 00000000 00000000
00000000 00000000 00000000 00000000 00000000 00000000 00000000 00000000
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> sum dba 1,1 apply
Check value for File 1, Block 1:
current = 0x0e79, required = 0x0e79
BBED> d /v dba 1,1 offset 484
File: /u01/app/oracle/oradata/PROD1/system01.dbf (1)
Block: 1 Offsets: 484 to 995 Dba:0x00400001
-------------------------------------------------------
d34c1200 000089bf a54d7534 01000000 l ?L.....??Mu4....
1e000000 02000000 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 ................
0a000a00 0a000100 00000000 00000000 l ................
00000000 02004000 72fc0b00 00000000 l ......@.r?......
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 024c6582 l .............Le.
d61636a4 7acf3f5d 13b1e763 d0000000 l ?.6?z??].??c?...
00000000 00000000 00000000 00000000 l ................
00000000 00000000 00000000 00173356 l ..............3V
1c4cd306 46040f87 3704db71 a6210600 l .L?.F...7.?q?!..
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>
SYS@PROD1 > alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/u01/app/oracle/oradata/PROD1/system01.dbf'
SYS@PROD1 > recover database;
Media recovery complete.
SYS@PROD1 > alter database open;
Database altered.
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24742969/viewspace-1662201/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- Oracle 之利用BBED修改資料塊SCN----沒有備份資料檔案的資料恢復Oracle資料恢復
- 【資料庫資料恢復】LINUX環境下ORACLE資料庫誤刪除的資料恢復資料庫資料恢復LinuxOracle
- 【伺服器虛擬化資料恢復】Xen Server環境下資料庫資料恢復案例伺服器資料恢復Server資料庫
- 【伺服器資料恢復】AIX環境下誤刪除邏輯卷的資料恢復方案伺服器資料恢復AI
- [20210930]bbed恢復刪除的資料.txt
- [20190124]bbed恢復資料遇到延遲塊清除的問題.txt
- 【伺服器資料恢復】Linux環境下RAID6磁碟陣列資料恢復案例伺服器資料恢復LinuxAI陣列
- 【伺服器資料恢復】AIX系統環境下LV被破壞如何恢復資料?伺服器資料恢復AI
- BBED 修改oracle 資料檔案的 SCN 號來做資料庫不完全恢復。Oracle資料庫
- [20210401]使用bbed讀取資料塊恢復注意6.txt
- 【資料庫資料恢復】windows server下SqlServer資料庫的資料恢復資料庫資料恢復WindowsServerSQL
- [20190125]bbed恢復資料遇到延遲塊清除的問題3.txt
- [20190124]bbed恢復資料遇到延遲塊清除的問題2.txt
- 【資料庫資料恢復】linux系統下MYSQL資料庫資料恢復案例資料庫資料恢復LinuxMySql
- 【資料庫資料恢復】Oracle資料庫檔案出現壞塊報錯的資料恢復案例資料庫資料恢復Oracle
- [20190213]學習bbed-恢復刪除的資料.txt
- 利用Omni Recover恢復IOS資料iOS
- 資料恢復:AMDU資料抽取恢復資料恢復
- 【資料庫資料恢復】SAP資料庫資料恢復案例資料庫資料恢復
- [Oracle]Oracle資料庫資料被修改或者刪除恢復資料Oracle資料庫
- 【伺服器資料恢復】ZFS檔案系統下RAIDZ多塊硬碟離線的資料恢復案例伺服器資料恢復AI硬碟
- 利用binlog日誌恢復mysql資料MySql
- Orcale利用閃回功能恢復資料
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- 【資料庫資料恢復】如何恢復Oracle資料庫truncate表的資料資料庫資料恢復Oracle
- 伺服器資料恢復-IBM X6伺服器linux環境下VMwave ESX檔案系統損壞的資料恢復伺服器資料恢復IBMLinux
- 伺服器資料恢復—透過拼接資料庫碎片恢復SqlServer資料庫資料的資料恢復案例伺服器資料恢復資料庫SQLServer
- 【資料庫資料恢復】Sql Server資料庫資料恢復案例資料庫資料恢復SQLServer
- 資料庫資料恢復-ORACLE資料庫的常見故障&各種故障下的資料恢復可能性資料庫資料恢復Oracle
- Vsan資料恢復—Vsan資料恢復案例資料恢復
- 【Vsan資料恢復】Vsan資料恢復案例資料恢復
- [20190104]bbed手動修改資料.txt
- oracle asm 資料塊重構恢復OracleASM
- 【資料庫資料恢復】Oracle資料庫誤truncate table的資料恢復案例資料庫資料恢復Oracle
- 【資料庫資料恢復】誤truncate table的Oracle資料庫資料恢復方案資料庫資料恢復Oracle
- [20210318]bbed讀取資料塊.txt
- 資料庫修復資料恢復資料庫資料恢復
- 【資料庫資料恢復】sql server資料庫連線失效的資料恢復案例資料庫資料恢復SQLServer
- 【資料庫資料恢復】SqlServer資料庫無法讀取的資料恢復案例資料庫資料恢復SQLServer