RMAN修復無效的資料塊(ORA-01578)
Recovering Individual Data Blocks
RMAN can recover individual corrupted datafile blocks. When RMAN performs a complete scan of a file for a backup, any corrupted blocks are listed in V$DATABASE_BLOCK_CORRUPTION. Corruption is usually reported in alert logs, trace files, or results of SQL queries.
To recover data blocks:
Obtain the block numbers of the corrupted blocks if you do not already have this information.
The easiest way to locate trace files and the alert log is to connect SQL*Plus to the target database and execute the following query:
SQL> SELECT NAME, VALUE
2 FROM V$DIAG_INFO;
Start RMAN and connect to the target database.
Run the RECOVER command to repair the blocks.
The following RMAN command recovers all corrupted blocks:
RMAN> RECOVER CORRUPTION LIST;
You can also recover individual blocks, as shown in the following example:
RMAN> RECOVER DATAFILE 1 BLOCK 233, 235 DATAFILE 2 BLOCK 100 TO 200;
模擬測試(生產環境一定要謹慎操作)
SQL> create tablespace netdata datafile '/data/netdata/netdata01.dbf' size 10M autoextend on next 20M maxsize 1G;
表空間已建立。
SQL> create user netdata identified by netdata default tablespace netdata temporary tablespace temp
2 ;
使用者已建立。
SQL> grant connect,resource to netdata;
授權成功。
SQL> conn netdata/netdata;
已連線。
SQL> create table test (id int,name varchar2(20));
表已建立。
insert into test
select b.id,a.name from (select 'test' name from dual)a,
(select rownum id from dual connect by level <100000000)b
SQL> commit;
提交完成。
關閉資料庫
並用UE修改資料庫netdata01.dbf檔案,隨便修改幾個字元
資料庫open
SQL> startup;
ORACLE 例程已經啟動。
Total System Global Area 855982080 bytes
Fixed Size 2258040 bytes
Variable Size 692063112 bytes
Database Buffers 155189248 bytes
Redo Buffers 6471680 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> select count(*) from netdata.test;
select count(*) from netdata.test
*
第 1 行出現錯誤:
ORA-01578: ORACLE 資料塊損壞 (檔案號 7, 塊號 9020) ORA-01110:
資料檔案 7: '/data/netdata/netdata01.dbf'
SQL> select * from v$database_block_corruption;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO
---------- ---------- ---------- ------------------ ---------
7 9020 1 0 CHECKSUM
RMAN> blockrecover datafile 7 block 9020;
啟動 recover 於 21-6月 -15
使用目標資料庫控制檔案替代恢復目錄
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: SID=400 裝置型別=DISK
通道 ORA_DISK_1: 正在還原塊
通道 ORA_DISK_1: 正在指定要從備份集還原的塊
正在還原資料檔案 00007 的塊
通道 ORA_DISK_1: 正在讀取備份片段 +FRA/netdata/backupset/2015_06_21/nnndf0_tag20150621t025253_0.276.882931979
通道 ORA_DISK_1: 段控制程式碼 = +FRA/netdata/backupset/2015_06_21/nnndf0_tag20150621t025253_0.276.882931979 標記 = TAG20150621T025253
通道 ORA_DISK_1: 已從備份片段 1 還原塊
通道 ORA_DISK_1: 塊還原完成, 用時: 00:00:07
正在開始介質的恢復
介質恢復完成, 用時: 00:00:08
完成 recover 於 21-6月 -15
RMAN>
RMAN can recover individual corrupted datafile blocks. When RMAN performs a complete scan of a file for a backup, any corrupted blocks are listed in V$DATABASE_BLOCK_CORRUPTION. Corruption is usually reported in alert logs, trace files, or results of SQL queries.
To recover data blocks:
Obtain the block numbers of the corrupted blocks if you do not already have this information.
The easiest way to locate trace files and the alert log is to connect SQL*Plus to the target database and execute the following query:
SQL> SELECT NAME, VALUE
2 FROM V$DIAG_INFO;
Start RMAN and connect to the target database.
Run the RECOVER command to repair the blocks.
The following RMAN command recovers all corrupted blocks:
RMAN> RECOVER CORRUPTION LIST;
You can also recover individual blocks, as shown in the following example:
RMAN> RECOVER DATAFILE 1 BLOCK 233, 235 DATAFILE 2 BLOCK 100 TO 200;
模擬測試(生產環境一定要謹慎操作)
SQL> create tablespace netdata datafile '/data/netdata/netdata01.dbf' size 10M autoextend on next 20M maxsize 1G;
表空間已建立。
SQL> create user netdata identified by netdata default tablespace netdata temporary tablespace temp
2 ;
使用者已建立。
SQL> grant connect,resource to netdata;
授權成功。
SQL> conn netdata/netdata;
已連線。
SQL> create table test (id int,name varchar2(20));
表已建立。
insert into test
select b.id,a.name from (select 'test' name from dual)a,
(select rownum id from dual connect by level <100000000)b
SQL> commit;
提交完成。
關閉資料庫
並用UE修改資料庫netdata01.dbf檔案,隨便修改幾個字元
資料庫open
SQL> startup;
ORACLE 例程已經啟動。
Total System Global Area 855982080 bytes
Fixed Size 2258040 bytes
Variable Size 692063112 bytes
Database Buffers 155189248 bytes
Redo Buffers 6471680 bytes
資料庫裝載完畢。
資料庫已經開啟。
SQL> select count(*) from netdata.test;
select count(*) from netdata.test
*
第 1 行出現錯誤:
ORA-01578: ORACLE 資料塊損壞 (檔案號 7, 塊號 9020) ORA-01110:
資料檔案 7: '/data/netdata/netdata01.dbf'
SQL> select * from v$database_block_corruption;
FILE# BLOCK# BLOCKS CORRUPTION_CHANGE# CORRUPTIO
---------- ---------- ---------- ------------------ ---------
7 9020 1 0 CHECKSUM
RMAN> blockrecover datafile 7 block 9020;
啟動 recover 於 21-6月 -15
使用目標資料庫控制檔案替代恢復目錄
分配的通道: ORA_DISK_1
通道 ORA_DISK_1: SID=400 裝置型別=DISK
通道 ORA_DISK_1: 正在還原塊
通道 ORA_DISK_1: 正在指定要從備份集還原的塊
正在還原資料檔案 00007 的塊
通道 ORA_DISK_1: 正在讀取備份片段 +FRA/netdata/backupset/2015_06_21/nnndf0_tag20150621t025253_0.276.882931979
通道 ORA_DISK_1: 段控制程式碼 = +FRA/netdata/backupset/2015_06_21/nnndf0_tag20150621t025253_0.276.882931979 標記 = TAG20150621T025253
通道 ORA_DISK_1: 已從備份片段 1 還原塊
通道 ORA_DISK_1: 塊還原完成, 用時: 00:00:07
正在開始介質的恢復
介質恢復完成, 用時: 00:00:08
完成 recover 於 21-6月 -15
RMAN>
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/24486203/viewspace-1708581/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- RMAN修復壞塊
- CSS之樣式無效BUG的修復CSS
- PostgreSQL 恢復大法 - 恢復部分資料庫、跳過壞塊、修復無法啟動的資料庫SQL資料庫
- 資料庫修復資料恢復資料庫資料恢復
- 勒索病毒資料修復恢復
- 如何修復“包 ‘%@’ 丟失或無效”macOS Monterey 升級錯誤Mac
- DG主備日誌缺失,資料無法同步修復
- Interbase資料庫修復資料庫
- Firebird資料庫修復資料庫
- 【資料庫資料恢復】透過恢復NDF檔案修復資料庫的資料恢復過程資料庫資料恢復
- 修復由於主庫NOLOGGING操作引起的備庫ORA-01578和ORA-26040錯誤
- Oracle 修復由於主庫NOLOGGING引起的備庫ORA-01578和ORA-26040錯誤Oracle
- 如何修復mysql資料庫MySql資料庫
- 【DATAGUARD】Oracle Dataguard nologging 塊修復Oracle
- RMAN備份恢復典型案例——資料庫卡頓資料庫
- SQL Anywhere db檔案損壞修復 DB檔案修復 DB資料庫修復SQL資料庫
- win10無法訪問smb共享資料夾的具體修復方法Win10
- 使用salvagewallet修復錢包資料
- 工控機維修資料恢復資料恢復
- win10自動修復無法修復你的電腦 華碩win10自動修復無法開機Win10
- Oracle日常問題-壞塊修復Oracle
- RMAN資料庫恢復異常報錯ORA-01180資料庫
- 【資料庫資料恢復】SqlServer資料庫無法讀取的資料恢復案例資料庫資料恢復SQLServer
- 伺服器資料修復的幾個技能伺服器
- [20201218]資料檔案OS頭的修復.txt
- RMAN增量恢復
- SQL Server 資料頁損壞修復SQLServer
- 【資料庫資料恢復】無法啟動MongoDB服務的資料恢復案例資料庫資料恢復MongoDB
- 資料恢復工具Recoverit使用教程:如何修復損壞的影片資料恢復
- Win10無法開機提示“自動修復無法修復你的電腦”的解決方法Win10
- RMAN備份恢復典型案例——資料檔案存在壞快
- RMAN恢復之RMAN-06555處理
- 【資料庫資料恢復】Oracle資料庫檔案出現壞塊報錯的資料恢復案例資料庫資料恢復Oracle
- dedecms資料庫檔案出錯的修復方法資料庫
- InterBase資料庫檔案損壞的修復方法資料庫
- 資料庫資料恢復——Windows無法啟動MongoDB服務的資料恢復案例資料庫資料恢復WindowsMongoDB
- 【資料庫資料恢復】Oracle ASM例項無法掛載的資料恢復案例資料庫資料恢復OracleASM
- oracle asm 資料塊重構恢復OracleASM
- 資料庫資料恢復—無備份,binlog未開啟的Mysql資料庫資料恢復案例資料庫資料恢復MySql