[20160329]bbed修復offline的資料檔案.txt
[20160329]bbed修復offline的資料檔案.txt
--測試資料庫,不小心將一個資料檔案offline了,archivelog也刪除了(主要磁碟空間緊張,做了一次整理)。
--自己測試修復看看,順便做一個記錄。
1.環境:
SCOTT@book> @ &r/ver1
PORT_STRING VERSION BANNER
------------------------------ -------------- --------------------------------------------------------------------------------
x86_64/Linux 2.4.xx 11.2.0.4.0 Oracle Database 11g Enterprise Edition Release 11.2.0.4.0 - 64bit Production
SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ NAME TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- -------------------------------- ----------------
1 13227498080 2016-03-29 11:44:35 7 13227286650 ONLINE 999 NO /mnt/ramdisk/book/system01.dbf SYSTEM
2 13227498080 2016-03-29 11:44:35 1834 13227286650 ONLINE 995 NO /mnt/ramdisk/book/sysaux01.dbf SYSAUX
3 13227498080 2016-03-29 11:44:35 923328 13227286650 ONLINE 915 NO /mnt/ramdisk/book/undotbs01.dbf UNDOTBS1
4 13227498080 2016-03-29 11:44:35 16143 13227286650 ONLINE 999 NO /mnt/ramdisk/book/users01.dbf USERS
5 13227498080 2016-03-29 11:44:35 952916 13227286650 ONLINE 912 NO /mnt/ramdisk/book/example01.dbf EXAMPLE
6 13227498080 2016-03-29 11:44:35 1314508 13227286650 ONLINE 928 NO /mnt/ramdisk/book/sugar01.dbf SUGAR
7 13227287392 2016-03-25 17:13:07 13227207527 13227286650 OFFLINE 20 YES /mnt/ramdisk/book/tea01.dbf TEA
7 rows selected.
--我估計CHECKPOINT_CHANGE# 修改為13227498080 就ok了。測試看看。安全起見做一個備份:
$ cp tea01.dbf_ORG tea01.dbf
SYS@book> @ &r/10to16 13227287392
10 to 16 HEX REVERSE16
-------------- -----------------------------------
0000314686360 0x60636814-03000000
SYS@book> @ &r/10to16 13227498080
10 to 16 HEX REVERSE16
-------------- -----------------------------------
00003146b9a60 0x609a6b14-03000000
SCOTT@book> @ &r/bbvi 7 1
BVI_COMMAND
--------------------------------------------------
bvi -b 8192 -s 8192 /mnt/ramdisk/book/tea01.dbf
$ cp tea01.dbf tea01.dbf_ORG
2.使用bvi開啟,修改0x60636814=>0x609a6b14
BBED> set dba 7,1
DBA 0x01c00001 (29360129 7,1)
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0x14686360
BBED> set dba 1,1
DBA 0x00400001 (4194305 1,1)
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0x146b9a60
--換1種修改模式算是學習。使用bbed的assign命令。
BBED> assign file 7 block 1 offset 484= file 1 block 1 offset 484;
Warning: contents of previous BIFILE will be lost. Proceed? (Y/N) y
ub1 pad @484 0x60
BBED> set dba 1,1
DBA 0x00400001 (4194305 1,1)
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0x146b9a60
BBED> set dba 7,1
DBA 0x01c00001 (29360129 7,1)
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas
ub4 kscnbas @484 0x14686360
--仔細檢查發現沒改,僅僅修改最後1個位元組,實際上這裡正好一樣(看不出來)。
BBED> help assign
ASSIGN[/x|d|u|o] <target spec>=<source spec>
<target spec> : [ DBA | FILE | FILENAME | BLOCK | OFFSET | symbol | *symbol ]
<source spec> : [ value | <target spec options> ]
BBED> assign dba 7,1 kcvfh.kcvfhckp.kcvcpscn.kscnbas = dba 1,1 kcvfh.kcvfhckp.kcvcpscn.kscnbas;
ub4 kscnbas @484 0x146b9a60
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas dba 1,1
ub4 kscnbas @484 0x146b9a60
BBED> p kcvfh.kcvfhckp.kcvcpscn.kscnbas dba 7,1
ub4 kscnbas @484 0x146b9a60
--ok現在一樣了。
BBED> sum apply dba 7,1
Check value for File 7, Block 1:
current = 0xdedb, required = 0xdedb
BBED> verify dba 7,1
DBVERIFY - Verification starting
FILE = /mnt/ramdisk/book/tea01.dbf
BLOCK = 1
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 : 0
Total Blocks Influx : 0
Message 531 not found; product=RDBMS; facility=BBED
3.重啟到mount狀態:
SYS@book> SELECT file#, CHECKPOINT_CHANGE#, CHECKPOINT_TIME,CREATION_CHANGE# , RESETLOGS_CHANGE#,status, CHECKPOINT_COUNT,fuzzy,name,tablespace_name FROM v$datafile_header;
FILE# CHECKPOINT_CHANGE# CHECKPOINT_TIME CREATION_CHANGE# RESETLOGS_CHANGE# STATUS CHECKPOINT_COUNT FUZ NAME TABLESPACE_NAME
----- ------------------ ------------------- ---------------- ----------------- ------- ---------------- --- ------------------------------- ----------------
1 13227498080 2016-03-29 11:44:35 7 13227286650 ONLINE 999 NO /mnt/ramdisk/book/system01.dbf SYSTEM
2 13227498080 2016-03-29 11:44:35 1834 13227286650 ONLINE 995 NO /mnt/ramdisk/book/sysaux01.dbf SYSAUX
3 13227498080 2016-03-29 11:44:35 923328 13227286650 ONLINE 915 NO /mnt/ramdisk/book/undotbs01.dbf UNDOTBS1
4 13227498080 2016-03-29 11:44:35 16143 13227286650 ONLINE 999 NO /mnt/ramdisk/book/users01.dbf USERS
5 13227498080 2016-03-29 11:44:35 952916 13227286650 ONLINE 912 NO /mnt/ramdisk/book/example01.dbf EXAMPLE
6 13227498080 2016-03-29 11:44:35 1314508 13227286650 ONLINE 928 NO /mnt/ramdisk/book/sugar01.dbf SUGAR
7 13227498080 2016-03-25 17:13:07 13227207527 13227286650 OFFLINE 20 YES /mnt/ramdisk/book/tea01.dbf TEA
7 rows selected.
--現在一致了,recover看看。
SYS@book> recover datafile 7;
Media recovery complete.
alter database open read only ;
SYS@book> select owner,segment_name from dba_segments where tablespace_name='TEA';
OWNER SEGMENT_NAME
------ --------------------
SCOTT EMPX
SYS@book> select * from scott.empx ;
select * from scott.empx
*
ERROR at line 1:
ORA-00376: file 7 cannot be read at this time
ORA-01110: data file 7: '/mnt/ramdisk/book/tea01.dbf'
SYS@book> alter database datafile 7 online ;
Database altered.
SYS@book> select * from scott.empx where rownum<=1;
EMPNO ENAME JOB MGR HIREDATE SAL COMM DEPTNO
------------ ---------- --------- ------------ ------------------- ------------ ------------ ------------
7369 YYYY CLERK 7902 1980-12-17 00:00:00 800 20
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/267265/viewspace-2071731/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- [20160329]表空間與資料檔案.txt
- ORACLE 10g中使用BBED修復損壞資料檔案Oracle 10g
- 【BBED】使用BBED修改資料檔案SCN,使該檔案從offline轉變為online
- SQL Anywhere db檔案損壞修復 DB檔案修復 DB資料庫修復SQL資料庫
- [20201218]資料檔案OS頭的修復.txt
- [20161111]資料庫檔案頭的修復.txt資料庫
- oracle 資料檔案offlineOracle
- ORA-00279異常處理_offline資料檔案缺失日誌檔案問題一鍵修復
- bbed 與檔案頭恢復
- [BBED]斷電異常後修復Oracle資料檔案(ORA-00702: bootstrap verison)Oracleboot
- BBED修復資料庫常用命令介紹資料庫
- BBED (Oracle Block Brower and EDitor Tool) :資料塊修復工具OracleBloC
- system資料檔案頭損壞修復
- [20150527]bbed解決資料檔案大小問題.txt
- 利用RMAN修復資料檔案中的壞塊
- InterBase資料庫檔案損壞的修復方法資料庫
- dedecms資料庫檔案出錯的修復方法資料庫
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- OFFLINE和DROP資料檔案的理解
- BBED 修改oracle 資料檔案的 SCN 號來做資料庫不完全恢復。Oracle資料庫
- [20160405]bbed修改檔案頭.txt
- 修復DBF資料表檔案的簡單方法 (轉)
- [20151028]理解資料檔案offline+drop.txt
- [20210930]bbed恢復刪除的資料.txt
- Oracle 之利用BBED修改資料塊SCN----沒有備份資料檔案的資料恢復Oracle資料恢復
- 表空間OFFLINE和資料檔案OFFLINE的區別
- 表空間offline,資料檔案offline 的區別(ZT)
- [20160531]windows下bbed修復corrupt資料塊Windows
- 資料檔案OFFLINE的3種情況
- 非歸檔模式下恢復利用offline drop命令誤刪除的資料檔案模式
- [20180202]備庫資料檔案offline.txt
- 控制檔案修復
- 【BBED】 SYSTEM檔案頭損壞的恢復(4)
- 【BBED】使用bbed恢復已經刪除的行資料
- [20190213]學習bbed-恢復刪除的資料.txt
- 某個表空間的資料檔案損壞的修復思路
- 利用offline datafile檔案方式遷移資料
- [20170419]bbed探究資料塊.txt