非歸檔模式 無法用備份修復新建的表
非歸檔模式下,做一個冷備份。
然後建立一個新表。
刪除該表所在的資料檔案,然後用備份來修復
修復完後,該表依舊無法訪問
alert日誌裡的錯誤資訊
處理方法,用 dbms_repair 來跳過該壞塊
檢查有壞塊的物件
跳過該壞塊
現在,test表可以使用了,不過 131塊上的資料沒有了。
點選(此處)摺疊或開啟
-
RMAN> shutdown immediate;
-
-
database closed
-
database dismounted
-
Oracle instance shut down
-
-
RMAN> startup mount;
-
-
connected to target database (not started)
-
Oracle instance started
-
database mounted
-
-
Total System Global Area 1068937216 bytes
-
-
Fixed Size 2235208 bytes
-
Variable Size 616563896 bytes
-
Database Buffers 444596224 bytes
-
Redo Buffers 5541888 bytes
-
-
RMAN> backup database;
-
-
Starting backup at 31-JUL-14
-
allocated channel: ORA_DISK_1
-
channel ORA_DISK_1: SID=133 device type=DISK
-
channel ORA_DISK_1: starting full datafile backup set
-
channel ORA_DISK_1: specifying datafile(s) in backup set
-
input datafile file number=00004 name=/u02/oradata/proddb/users01.dbf
-
input datafile file number=00006 name=/u02/oradata/proddb/myundo01.dbf
-
input datafile file number=00001 name=/u02/oradata/proddb/system01.dbf
-
input datafile file number=00002 name=/u02/oradata/proddb/sysaux01.dbf
-
input datafile file number=00008 name=/u02/oradata/proddb/ts_small01.dbf
-
input datafile file number=00003 name=/u02/oradata/proddb/newts01.dbf
-
input datafile file number=00009 name=/u02/oradata/proddb/ts_small02.dbf
-
channel ORA_DISK_1: starting piece 1 at 31-JUL-14
-
channel ORA_DISK_1: finished piece 1 at 31-JUL-14
-
piece handle=/u02/backup/prod/PRODDB/backupset/2014_07_31/o1_mf_nnndf_TAG20140731T054048_9xn3s13c_.bkp tag=TAG20140731T054048 comment=NONE
-
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:15
-
channel ORA_DISK_1: starting full datafile backup set
-
channel ORA_DISK_1: specifying datafile(s) in backup set
-
including current control file in backup set
-
including current SPFILE in backup set
-
channel ORA_DISK_1: starting piece 1 at 31-JUL-14
-
channel ORA_DISK_1: finished piece 1 at 31-JUL-14
-
piece handle=/u02/backup/prod/PRODDB/backupset/2014_07_31/o1_mf_ncsnf_TAG20140731T054048_9xn3skmq_.bkp tag=TAG20140731T054048 comment=NONE
-
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
-
Finished backup at 31-JUL-14
-
-
RMAN> open database;
-
- database opened
點選(此處)摺疊或開啟
-
scott@PRODDB>create table test
-
2 tablespace newts
-
3 as select * from emp;
-
-
Table created.
-
-
scott@PRODDB>select empno, rowid, dbms_rowid.rowid_relative_fno(rowid) file#, dbms_rowid.rowid_block_number(rowid) block#, dbms_rowid.rowid_row_number(rowid) row#
-
2 from test; -- 該表的資料都在 檔案3 的第 131塊中
-
-
EMPNO ROWID FILE# BLOCK# ROW#
-
---------- ------------------ ---------- ---------- ----------
-
7369 AAADaKAADAAAACDAAA 3 131 0
-
7499 AAADaKAADAAAACDAAB 3 131 1
-
7521 AAADaKAADAAAACDAAC 3 131 2
-
7566 AAADaKAADAAAACDAAD 3 131 3
-
7654 AAADaKAADAAAACDAAE 3 131 4
-
7698 AAADaKAADAAAACDAAF 3 131 5
-
7782 AAADaKAADAAAACDAAG 3 131 6
-
7788 AAADaKAADAAAACDAAH 3 131 7
-
7839 AAADaKAADAAAACDAAI 3 131 8
-
7844 AAADaKAADAAAACDAAJ 3 131 9
-
7876 AAADaKAADAAAACDAAK 3 131 10
-
7900 AAADaKAADAAAACDAAL 3 131 11
-
7902 AAADaKAADAAAACDAAM 3 131 12
-
7934 AAADaKAADAAAACDAAN 3 131 13
-
- 14 rows selected.
刪除該表所在的資料檔案,然後用備份來修復
點選(此處)摺疊或開啟
-
[oracle@Redhat55 ~]$ rm /u02/oradata/proddb/newts01.dbf
-
-
RMAN> restore datafile 3;
-
-
Starting restore at 31-JUL-14
-
allocated channel: ORA_DISK_1
-
channel ORA_DISK_1: SID=133 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 00003 to /u02/oradata/proddb/newts01.dbf
-
channel ORA_DISK_1: reading from backup piece /u02/backup/prod/PRODDB/backupset/2014_07_31/o1_mf_nnndf_TAG20140731T054048_9xn3s13c_.bkp
-
channel ORA_DISK_1: piece handle=/u02/backup/prod/PRODDB/backupset/2014_07_31/o1_mf_nnndf_TAG20140731T054048_9xn3s13c_.bkp tag=TAG20140731T054048
-
channel ORA_DISK_1: restored backup piece 1
-
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
-
Finished restore at 31-JUL-14
-
-
RMAN> recover datafile 3;
-
-
Starting recover at 31-JUL-14
-
using channel ORA_DISK_1
-
-
starting media recovery
-
media recovery complete, elapsed time: 00:00:00
-
- Finished recover at 31-JUL-14
修復完後,該表依舊無法訪問
點選(此處)摺疊或開啟
-
scott@PRODDB>select * from test; -- 提示 該表的 資料塊 ( 檔案3 第131塊) 損壞
-
select * from test
-
*
-
ERROR at line 1:
-
ORA-01578: ORACLE data block corrupted (file # 3, block # 131)
-
ORA-01110: data file 3: \'/u02/oradata/proddb/newts01.dbf\'
- ORA-26040: Data block was loaded using the NOLOGGING option
alert日誌裡的錯誤資訊
點選(此處)摺疊或開啟
-
Thu Jul 31 05:55:02 2014
-
Errors in file /u01/app/oracle/diag/rdbms/proddb/Prod/trace/Prod_ora_7161.trc (incident=44604):
-
ORA-01578: ORACLE data block corrupted (file # 3, block # 131)
- ORA-01110: data file 3: \
處理方法,用 dbms_repair 來跳過該壞塊
點選(此處)摺疊或開啟
-
sys@PRODDB>BEGIN -- 建立修復的表 放在USERS表空間下
-
2 DBMS_REPAIR.ADMIN_TABLES (
-
3 TABLE_NAME => \'REPAIR_TABLE\',
-
4 TABLE_TYPE => dbms_repair.repair_table,
-
5 ACTION => dbms_repair.create_action,
-
6 TABLESPACE => \'USERS\');
-
7 END;
-
8 /
-
- PL/SQL procedure successfully completed.
檢查有壞塊的物件
點選(此處)摺疊或開啟
-
sys@PRODDB>DECLARE num_corrupt INT;
-
2 BEGIN
-
3 num_corrupt := 0;
-
4 DBMS_REPAIR.CHECK_OBJECT (
-
5 SCHEMA_NAME => \'SCOTT\',
-
6 OBJECT_NAME => \'TEST\',
-
7 REPAIR_TABLE_NAME => \'REPAIR_TABLE\',
-
8 corrupt_count => num_corrupt);
-
9 DBMS_OUTPUT.PUT_LINE(\'number corrupt: \' || TO_CHAR (num_corrupt));
-
10 END;
- 11 /
- sys@PRODDB>COL CORRUPT_DESCRIPTION FOR A20
- sys@PRODDB>select BLOCK_ID, CORRUPT_TYPE, CORRUPT_DESCRIPTION from REPAIR_TABLE; -- 檢視壞塊的塊號
-
- BLOCK_ID CORRUPT_TYPE CORRUPT_DESCRIPTION
- ---------- ------------ --------------------
-
131 6148
跳過該壞塊
點選(此處)摺疊或開啟
-
sys@PRODDB>DECLARE num_fix INT;
-
2 BEGIN
-
3 num_fix := 0;
-
4 DBMS_REPAIR.FIX_CORRUPT_BLOCKS (
-
5 SCHEMA_NAME => \'SCOTT\',
-
6 OBJECT_NAME=> \'TEST\',
-
7 OBJECT_TYPE => dbms_repair.table_object,
-
8 REPAIR_TABLE_NAME => \'REPAIR_TABLE\',
-
9 FIX_COUNT=> num_fix);
-
10 DBMS_OUTPUT.PUT_LINE(\'num fix: \' || to_char(num_fix));
-
11 END;
-
12 /
-
-
PL/SQL procedure successfully completed.
-
-
sys@PRODDB>BEGIN
-
2 DBMS_REPAIR.SKIP_CORRUPT_BLOCKS (
-
3 SCHEMA_NAME => \'SCOTT\',
-
4 OBJECT_NAME => \'TEST\',
-
5 OBJECT_TYPE => dbms_repair.table_object,
-
6 FLAGS => dbms_repair.SKIP_FLAG);
-
7 END;
-
8 /
-
- PL/SQL procedure successfully completed.
現在,test表可以使用了,不過 131塊上的資料沒有了。
點選(此處)摺疊或開啟
-
sys@PRODDB>select * from scott.test;
-
-
no rows selected
-
-
sys@PRODDB>set linesize 100
-
sys@PRODDB>desc scott.test
-
Name Null? Type
-
----------------------------------------------------- -------- ------------------------------------
-
EMPNO NUMBER(4)
-
ENAME VARCHAR2(10)
-
JOB VARCHAR2(9)
-
MGR NUMBER(4)
-
HIREDATE DATE
-
SAL NUMBER(7,2)
-
COMM NUMBER(7,2)
- DEPTNO NUMBER(2)
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/12238525/viewspace-1243391/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rac歸檔模式/非歸檔模式下檔案建至本地儲存修復方法-ORA-01157模式
- XFS檔案系統的備份、恢復、修復
- Linux中XFS檔案系統的備份,恢復,修復Linux
- Oracle使用備份檔案集恢復歸檔日誌Oracle
- oracle 如何不備份已經備份的歸檔Oracle
- dg丟失歸檔,使用rman增量備份恢復
- oracle adg備庫歸檔滿了無法同步Oracle
- Oracle設定多個歸檔路徑生成多份歸檔日誌,Rman備份時也只備份其中的一份歸檔日誌Oracle
- rman開啟備份優化對備份歸檔的影響優化
- DG主備日誌缺失,資料無法同步修復
- 從備份片中恢復某個指定得歸檔或者資料檔案
- win10自動修復無法修復你的電腦 華碩win10自動修復無法開機Win10
- 快速修復應用程式無法正確啟動
- win10平板模式無法開啟怎麼辦_win10平板模式無法使用修復方法Win10模式
- Win10無法開機提示“自動修復無法修復你的電腦”的解決方法Win10
- 手工rm刪除歸檔日誌對備份歸檔日誌的影響
- 教你在Linux中如何歸檔和備份Linux
- innobackupex 部分表備份和恢復
- RMAN備份整庫和歸檔日誌的方法
- DM7使用DMRMAN執行歸檔修復
- 請將磁碟插入驅動器 chkdsk無法修復恢復裡面檔案的方法
- 關於mysqldump備份非事務表的注意事項MySql
- DM7使用DMRMAN執行歸檔備份
- Win10 1909無法進入睡眠模式怎麼辦_Win10 1909無法進入睡眠模式如何修復Win10模式
- ORACLE NBU調取oracle rman指令碼備份歸檔不自動刪除歸檔Oracle指令碼
- win10無法自動修復怎麼開機 win10自動修復無法開機的方法Win10
- Oracle-無備份情況下,如何手動恢復控制檔案Oracle
- ghost win10無法啟動修復失敗怎麼修復_ghost win10無法啟動修復失敗如何解決Win10
- win10無法開啟bootbcd修復怎麼辦_win10無法開啟bootbcd修復的解決方法Win10boot
- 詳解Redis持久化(持久化高危漏洞利用與多種對抗方案、RDB、AOF、同步手動持久化、非同步手動非阻塞持久化、備份檢測、備份修復、壓縮原理、雙備份模式、純快取模式)Redis持久化非同步模式快取
- 記一次sshd無法啟動的修復
- 使用Xtrabackup完整備份中恢復單表
- SYSTEM 表空間管理及備份恢復
- 12 使用RMAN備份和恢復檔案
- 對歸檔模式下CLEAR 未歸檔日誌後恢復資料庫的一點看法模式資料庫
- 在Linux中,如何進行備份或歸檔檔案(tar 命令)?Linux
- RAC備份恢復之Voting備份與恢復
- 檔案的基本管理和XFS檔案系統備份恢復
- 用增量備份來快速恢復dg