Oracle恢復實驗(四)
環境:Oracle10g、Red Hat 4,Oracle執行在歸檔模式。
場景:所有控制檔案和資料檔案丟失。
具體步驟:
1、主機斷電,導致資料檔案和所有控制檔案全部丟失
SQL> !rm -f /home/oracle/oracle/product/oradata/orcl/*.ctl
SQL> !rm -f /home/oracle/oracle/product/oradata/orcl/*.dbf
SQL> !ls /home/oracle/oracle/product/oradata/orcl
redo01.log redo02.log redo03.log
SQL> shutdown abort
ORACLE instance shut down.
2、嘗試開啟資料庫
SQL> startup
ORACLE instance started.
Total System Global Area 130023424 bytes
Fixed Size 1218100 bytes
Variable Size 62917068 bytes
Database Buffers 62914560 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
提示找不到控制檔案
3、拷貝資料檔案和控制檔案
SQL> !cp /disk2/oracle/coldbak/*.ctl /home/oracle/oracle/product/oradata/orcl/
SQL> !cp /disk2/oracle/coldbak/*.dbf /home/oracle/oracle/product/oradata/orcl/
4、嘗試開啟資料庫
SQL> startup
ORACLE instance started.
Total System Global Area 130023424 bytes
Fixed Size 1218100 bytes
Variable Size 62917068 bytes
Database Buffers 62914560 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-00338: log 2 of thread 1 is more recent than control file
ORA-00312: online log 2 thread 1:
'/home/oracle/oracle/product/oradata/orcl/redo02.log'
提示控制檔案比較舊,記錄的日誌序號比redo日誌的小。
5、獲取重建控制檔案的指令碼
SQL> alter database backup controlfile to trace;
Database altered.
從udump目錄中找到指令碼。
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/home/oracle/oracle/product/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/home/oracle/oracle/product/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/home/oracle/oracle/product/oradata/orcl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/home/oracle/oracle/product/oradata/orcl/system01.dbf',
'/home/oracle/oracle/product/oradata/orcl/undotbs01.dbf',
'/home/oracle/oracle/product/oradata/orcl/sysaux01.dbf',
'/home/oracle/oracle/product/oradata/orcl/users01.dbf'
CHARACTER SET AL32UTF8
;
6、重啟資料庫到nomount狀態、執行重建控制檔案指令碼
SQL> shutdown immediate
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 130023424 bytes
Fixed Size 1218100 bytes
Variable Size 62917068 bytes
Database Buffers 62914560 bytes
Redo Buffers 2973696 bytes
7、嘗試開啟資料庫
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/home/oracle/oracle/product/oradata/orcl/system01.dbf'
8、介質恢復
SQL> recover database;
Media recovery complete.
9、開啟資料庫
SQL> alter database open;
Database altered.
SQL> conn scott/oracle
Connected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
RECOVER_TEST TABLE
RECOVER_TEST2 TABLE
6 rows selected.
SQL> select count(*) from recover_test2;
COUNT(*)
----------
28672
場景:所有控制檔案和資料檔案丟失。
具體步驟:
1、主機斷電,導致資料檔案和所有控制檔案全部丟失
SQL> !rm -f /home/oracle/oracle/product/oradata/orcl/*.ctl
SQL> !rm -f /home/oracle/oracle/product/oradata/orcl/*.dbf
SQL> !ls /home/oracle/oracle/product/oradata/orcl
redo01.log redo02.log redo03.log
SQL> shutdown abort
ORACLE instance shut down.
2、嘗試開啟資料庫
SQL> startup
ORACLE instance started.
Total System Global Area 130023424 bytes
Fixed Size 1218100 bytes
Variable Size 62917068 bytes
Database Buffers 62914560 bytes
Redo Buffers 2973696 bytes
ORA-00205: error in identifying control file, check alert log for more info
提示找不到控制檔案
3、拷貝資料檔案和控制檔案
SQL> !cp /disk2/oracle/coldbak/*.ctl /home/oracle/oracle/product/oradata/orcl/
SQL> !cp /disk2/oracle/coldbak/*.dbf /home/oracle/oracle/product/oradata/orcl/
4、嘗試開啟資料庫
SQL> startup
ORACLE instance started.
Total System Global Area 130023424 bytes
Fixed Size 1218100 bytes
Variable Size 62917068 bytes
Database Buffers 62914560 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-00338: log 2 of thread 1 is more recent than control file
ORA-00312: online log 2 thread 1:
'/home/oracle/oracle/product/oradata/orcl/redo02.log'
提示控制檔案比較舊,記錄的日誌序號比redo日誌的小。
5、獲取重建控制檔案的指令碼
SQL> alter database backup controlfile to trace;
Database altered.
從udump目錄中找到指令碼。
CREATE CONTROLFILE REUSE DATABASE "ORCL" NORESETLOGS ARCHIVELOG
MAXLOGFILES 16
MAXLOGMEMBERS 3
MAXDATAFILES 100
MAXINSTANCES 8
MAXLOGHISTORY 292
LOGFILE
GROUP 1 '/home/oracle/oracle/product/oradata/orcl/redo01.log' SIZE 50M,
GROUP 2 '/home/oracle/oracle/product/oradata/orcl/redo02.log' SIZE 50M,
GROUP 3 '/home/oracle/oracle/product/oradata/orcl/redo03.log' SIZE 50M
-- STANDBY LOGFILE
DATAFILE
'/home/oracle/oracle/product/oradata/orcl/system01.dbf',
'/home/oracle/oracle/product/oradata/orcl/undotbs01.dbf',
'/home/oracle/oracle/product/oradata/orcl/sysaux01.dbf',
'/home/oracle/oracle/product/oradata/orcl/users01.dbf'
CHARACTER SET AL32UTF8
;
6、重啟資料庫到nomount狀態、執行重建控制檔案指令碼
SQL> shutdown immediate
Database dismounted.
ORACLE instance shut down.
SQL> startup nomount
ORACLE instance started.
Total System Global Area 130023424 bytes
Fixed Size 1218100 bytes
Variable Size 62917068 bytes
Database Buffers 62914560 bytes
Redo Buffers 2973696 bytes
7、嘗試開啟資料庫
SQL> alter database open;
alter database open
*
ERROR at line 1:
ORA-01113: file 1 needs media recovery
ORA-01110: data file 1: '/home/oracle/oracle/product/oradata/orcl/system01.dbf'
8、介質恢復
SQL> recover database;
Media recovery complete.
9、開啟資料庫
SQL> alter database open;
Database altered.
SQL> conn scott/oracle
Connected.
SQL> select * from tab;
TNAME TABTYPE CLUSTERID
------------------------------ ------- ----------
DEPT TABLE
EMP TABLE
BONUS TABLE
SALGRADE TABLE
RECOVER_TEST TABLE
RECOVER_TEST2 TABLE
6 rows selected.
SQL> select count(*) from recover_test2;
COUNT(*)
----------
28672
相關文章
- 【Oracle 恢復表空間】 實驗Oracle
- oracle 增量備份恢復驗證Oracle
- Oracle Database 12c RAC損壞ocr和votedisk恢復實驗OracleDatabase
- NBU恢復oracleOracle
- 表空間TSPITR恢復-實驗
- Oracle案例12——NBU Oracle恢復Oracle
- oracle冷備恢復Oracle
- oracle 異機恢復Oracle
- 【RECO_ORACLE】Oracle 12c之CDB與PDB的備份與恢復(四)PDB的幾種恢復方式Oracle
- Oracle RMAN恢復測試Oracle
- Oracle 不完全恢復Oracle
- 【11g 庫異地恢復】實驗
- 【12c 庫異機恢復】實驗
- Oracle RushQL勒索病毒恢復方法Oracle
- Oracle 備份 與 恢復 概述Oracle
- Oracle 備份恢復之 FlashbackOracle
- Oracle恢復誤刪資料Oracle
- ORACLE備份&恢復案例(轉)Oracle
- oracle基於SCN增量恢復Oracle
- Oracle Redo丟失恢復方案Oracle
- Oracle RMAN 表空間恢復Oracle
- 實驗:centos6刪除核心並恢復CentOS
- 備份與恢復oracle_homeOracle
- Oracle 備份和恢復介紹Oracle
- oracle使用小記、刪除恢復Oracle
- ORACLE備份&恢復案例三(轉)Oracle
- Oracle資料庫恢復之resetlogsOracle資料庫
- ORACLE備份&恢復案例二(轉)Oracle
- Networker恢復oracle rac到單機Oracle
- 兩篇oracle異機恢復文章Oracle
- ORACLE本地磁碟備份恢復Oracle
- 【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(1)Oracle 10g
- 【資料遷移1】Oracle 10gR2 rman異機恢復實驗(FS->RAW)(2)Oracle 10g
- 7_Oracle truncate異常恢復之plsql修復OracleSQL
- 6_Oracle truncate異常恢復之bbed修復Oracle
- Oracle 12c 備份與恢復Oracle
- Oracle資料庫冷備和恢復Oracle資料庫
- Oracle 備份恢復篇之RMAN catalogOracle
- ORACLE DG從庫 Rman備份恢復Oracle