備份恢復之資料檔案丟失
一、實驗環境
執行環境:
[root@localhost ~]# lsb_release -a
LSB Version: :core-3.1-ia32:core-3.1-noarch:graphics-3.1-ia32:graphics-3.1-noarch
Distributor ID: RedHatEnterpriseServer
Description: Red Hat Enterprise Linux Server release 5.4 (Tikanga)
Release: 5.4
Codename: Tikanga
資料庫版本:
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Prod
PL/SQL Release 10.2.0.1.0 - Production
CORE 10.2.0.1.0 Production
TNS for Linux: Version 10.2.0.1.0 - Production
NLSRTL Version 10.2.0.1.0 - Production
歸檔狀態:
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination USE_DB_RECOVERY_FILE_DEST
二、實驗步驟
1、對資料庫進行一次全備
2、將資料庫檔案任一刪除一個(system表空間的資料檔案或者undo表空間的資料檔案)
3、通過RMAN對進行恢復
三、具體過程
1、檢視資料檔案
SQL> select t.name tname,d.name dname from v$datafile d,v$tablespace t
2 where t.ts#=d.ts#;
TNAME DNAME
------- ------------------------------------------------------------
SYSTEM /u01/app/oracle/oradata/lzcdb/system01.dbf
UNDOTBS /u01/app/oracle/oradata/lzcdb/undotbs01.dbf
1
SYSAUX /u01/app/oracle/oradata/lzcdb/sysaux01.dbf
USERS /u01/app/oracle/oradata/lzcdb/users01.dbf
LZCDB01 /u01/app/oracle/oradata/lzcdb/lzcdb0101
LZCDB01 /u01/app/oracle/oradata/lzcdb/lzcdb0102
2、將控制檔案刪除
SQL> !rm /u01/app/oracle/oradata/lzcdb/system01.dbf
SQL> !ls /u01/app/oracle/oradata/lzcdb/system01.dbf
ls: /u01/app/oracle/oradata/lzcdb/system01.dbf: No such file or directory
成功刪除
3、在刪除資料檔案之後資料庫有可能會直接掛掉,但由於我的實驗資料庫沒有任何負載所以現在手動將其關閉
(注意同時動態檢視alert日子)
SQL> shutdown abort;
ORACLE instance shut down.
SQL> startup
ORACLE instance started.
Total System Global Area 285212672 bytes
Fixed Size 1218992 bytes
Variable Size 96470608 bytes
Database Buffers 184549376 bytes
Redo Buffers 2973696 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/lzcdb/system01.dbf'
在有mount狀態啟動到open狀態是會出現如上錯誤,此時檢視alert日誌會看到如下資訊
ALTER DATABASE OPEN
Thu Jun 14 17:25:03 2012
ORA-01110: data file 1: '/u01/app/oracle/oradata/lzcdb/system01.dbf'
ORA-27037: unable to obtain file status
Linux Error: 2: No such file or directory
Additional information: 3
我們可以看到錯誤資訊提示我們system01.dbf檔案找不到
4、使用RMAN恢復
[oracle@localhost ~]$ rman target sys/oracle/lzcdb
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jun 14 17:28:33 2012
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: LZCDB (DBID=404353836, not open)
RMAN> list backup;
using target database control file instead of recovery catalog
List of Backup Sets
===================
BS Key Type LV Size Device Type Elapsed Time Completion Time
------- ---- -- ---------- ----------- ------------ ---------------
3 Full 920.27M DISK 00:01:58 14-JUN-12
BP Key: 3 Status: AVAILABLE Compressed: NO Tag: TAG20120614T091107
Piece Name: /u01/app/oracle/flash_recovery_area/03ndgj9b_1_1
List of Datafiles in backup set 3
File LV Type Ckp SCN Ckp Time Name
---- -- ---- ---------- --------- ----
1 Full 682642 14-JUN-12 /u01/app/oracle/oradata/lzcdb/system01.dbf
2 Full 682642 14-JUN-12 /u01/app/oracle/oradata/lzcdb/undotbs01.dbf
3 Full 682642 14-JUN-12 /u01/app/oracle/oradata/lzcdb/sysaux01.dbf
4 Full 682642 14-JUN-12 /u01/app/oracle/oradata/lzcdb/users01.dbf
可以看到我的實驗庫的備份資訊如上
RMAN> restore datafile 1; ------這兒我用的是system01.dbf檔案號
RMAN> recover database;
將資料庫啟動!
四、實驗總結
在實驗的過程中遇到了一些小插曲,由於自己搗鼓的時候有部分歸檔日誌被我刪掉了卻且沒有其他備份。
所以當我執行
RMAN> recover database;
恢復資料庫時告訴我
RMAN-03002: failure of recover command at 06/14/2012 18:18:06
RMAN-06053: unable to perform. media recovery because of missing log
RMAN-06025: no backup of log thread 1 seq 36 lowscn 730729 found to restore
這樣我就只能將整個資料庫恢復到我上次的全備點了,這就造成了大量資料的丟失
所以體會就是歸檔日誌不要隨便刪除,除非你已經確定它沒有用了或者你有備份!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26723566/viewspace-732848/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 電腦檔案丟失資料恢復資料恢復
- dg丟失歸檔,使用rman增量備份恢復
- Sql Server資料庫檔案丟失的恢復方法SQLServer資料庫
- 【資料庫資料恢復】Sql Server資料庫檔案丟失的資料恢復過程資料庫資料恢復SQLServer
- 【北亞資料恢復】MongoDB資料遷移檔案丟失的MongoDB資料恢復案例資料恢復MongoDB
- 【資料庫資料恢復】mdb_catalog.wt檔案丟失的MongoDB資料恢復案例資料庫資料恢復MongoDB
- 【伺服器資料恢復】xfs檔案系統資料丟失的資料恢復案例伺服器資料恢復
- DATA GUARD主庫丟失資料檔案的恢復(3)
- DATA GUARD主庫丟失資料檔案的恢復(1)
- DATA GUARD主庫丟失資料檔案的恢復(2)
- MongoDB資料庫報錯,資料庫檔案丟失資料恢復案例MongoDB資料庫資料恢復
- 伺服器資料恢復案例之RAID資訊丟失資料恢復伺服器資料恢復AI
- 資料庫資料恢復—MongoDB資料庫檔案丟失,啟動報錯的資料恢復案例資料庫資料恢復MongoDB
- macOS Big Sur系統如何恢復丟失的資料檔案?Mac
- 硬碟資料丟失如何恢復?硬碟
- 分割槽丟失資料恢復資料恢復
- 剪下的檔案還能恢復嗎,恢復剪貼丟失的檔案
- 丟失的隨身碟檔案如何恢復?
- 【虛擬機器資料恢復】Hyper-V虛擬化檔案丟失的資料恢復案例虛擬機資料恢復
- 備份與恢復:polardb資料庫備份與恢復資料庫
- 伺服器資料丟失了怎麼恢復/分割槽丟失恢復教程伺服器
- 怎樣恢復Mac檔案及資料夾資料?BackupLoupe for mac(資料恢復備份助手)3.5.4Mac資料恢復
- RMAN備份恢復典型案例——資料檔案存在壞快
- RAC備份恢復之Voting備份與恢復
- 檔案丟失不用怕:超實用的Mac資料恢復軟體!Mac資料恢復
- 資料庫備份恢復資料庫
- 【伺服器資料恢復】SAN LUN對映出錯導致檔案系統資料丟失的資料恢復案例伺服器資料恢復
- chkdsk 後資料丟失的恢復方法
- 伺服器RAID資料丟失恢復伺服器AI
- OMV資料恢復NAS陣列丟失資料恢復陣列
- 如何恢復伺服器資料丟失伺服器
- 從備份片中恢復某個指定得歸檔或者資料檔案
- 12 使用RMAN備份和恢復檔案
- 伺服器資料恢復—重灌系統導致XFS檔案系統分割槽丟失的資料恢復案例伺服器資料恢復
- 【Vsan資料恢復】斷電導致Vsan分散式儲存虛擬磁碟檔案丟失的資料恢復案例資料恢復分散式
- 【伺服器資料恢復】虛擬機器檔案丟失導致Hyper-V癱瘓的資料恢復伺服器資料恢復虛擬機
- XFS檔案系統的備份、恢復、修復
- Mysql資料備份與恢復MySql
- 【伺服器資料恢復】XFS檔案系統分割槽分割槽丟失無法訪問的資料恢復案例伺服器資料恢復