【RMAN】SYSTEM表空間資料檔案丟失恢復模擬
只要存在有效的RMAN備份,恢復SYSTEM表空間資料檔案丟失故障是比較容易的。
注意,這裡強調的是存在有效可用的備份介質。曾經遇到一個非常無奈的場景:catalog資料庫與備份的目標庫放在了同一個資料庫中,此時當SYSTEM表空間發生不測之後,因為catalog資料庫與目標資料庫同時發生問題,導致恢復變得艱難。敬告:制定備份策略的時候一定要考慮周全。
這裡演示的是最常見的使用RMAN恢復SYSTEM表空間丟失的資料方法。
1.連線到catalog資料庫完成對資料庫的備份
[oracle@secdb oradata]$ rman target / catalog rman_catalog/rman_catalog@catalog
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 15 22:14:24 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=4067316777)
connected to recovery catalog database
RMAN> run{
backup full database
format '/u01/app/oracle/rmanbak/full_bk1_%u%p%s.rmn'
include current controlfile;
backup archivelog all
format '/u01/app/oracle/rmanbak/arch_bk1_%u%p%s.rmn'
delete all input;
}
…… 省略輸出結果 ……
2.模擬SYSTEM表空間資料檔案丟失
sys@ora10g> col name for a60
sys@ora10g> select file#,name from v$datafile;
FILE# NAME
---------- ----------------------------------------------------------
1 /u01/app/oracle/oradata/ora10g/system01.dbf
2 /u01/app/oracle/oradata/ora10g/undotbs01.dbf
3 /u01/app/oracle/oradata/ora10g/sysaux01.dbf
4 /u01/app/oracle/oradata/ora10g/users01.dbf
5 /u01/app/oracle/oradata/ora10g/example01.dbf
6 /u01/app/oracle/oradata/ora10g/user_08.dbf
sys@ora10g> ! rm -f /u01/app/oracle/oradata/ora10g/system01.dbf
故障現象舉例:
sys@ora10g> select * from cat;
select * from cat
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora10g/system01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
sys@ora10g> shutdown immediate;
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora10g/system01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
sys@ora10g> shutdown abort;
ORACLE instance shut down.
NotConnected@> startup;
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219136 bytes
Variable Size 125830592 bytes
Database Buffers 180355072 bytes
Redo Buffers 7168000 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora10g/system01.dbf'
NotConnected@> select status from v$instance;
STATUS
------------
MOUNTED
3.使用RMAN完成資料檔案恢復
1)連線到catalog資料庫
[oracle@secdb oradata]$ rman target / catalog rman_catalog/rman_catalog@catalog
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 15 22:16:51 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=4067316777, not open)
connected to recovery catalog database
2)還原1號資料檔案,此檔案即為SYSTEM表空間丟失的資料檔案
RMAN> restore datafile 1;
Starting restore at 15-JUL-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/ora10g/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rmanbak/full_bk1_0flis4k9115.rmn
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/rmanbak/full_bk1_0flis4k9115.rmn tag=TAG20100715T171449
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 15-JUL-10
3)對1號資料檔案進行恢復
RMAN> recover datafile 1;
Starting recover at 15-JUL-10
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 15-JUL-10
4)將資料庫啟動到OPEN狀態
RMAN> alter database open;
database opened
5)驗證資料庫的可用性
[oracle@secdb oradata]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 15 22:24:14 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
sys@ora10g> select status from v$instance;
STATUS
------------
OPEN
4.小結
恢復丟失的資料檔案的過程是非常簡便的。真正要重視的備份策略的科學性和備份介質的有效性,前者需要需要對備份策略做深入的策劃,後者可以透過定期的備份介質有效性驗證來保證。
Good luck.
secooler
10.07.15
-- The End --
注意,這裡強調的是存在有效可用的備份介質。曾經遇到一個非常無奈的場景:catalog資料庫與備份的目標庫放在了同一個資料庫中,此時當SYSTEM表空間發生不測之後,因為catalog資料庫與目標資料庫同時發生問題,導致恢復變得艱難。敬告:制定備份策略的時候一定要考慮周全。
這裡演示的是最常見的使用RMAN恢復SYSTEM表空間丟失的資料方法。
1.連線到catalog資料庫完成對資料庫的備份
[oracle@secdb oradata]$ rman target / catalog rman_catalog/rman_catalog@catalog
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 15 22:14:24 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=4067316777)
connected to recovery catalog database
RMAN> run{
backup full database
format '/u01/app/oracle/rmanbak/full_bk1_%u%p%s.rmn'
include current controlfile;
backup archivelog all
format '/u01/app/oracle/rmanbak/arch_bk1_%u%p%s.rmn'
delete all input;
}
…… 省略輸出結果 ……
2.模擬SYSTEM表空間資料檔案丟失
sys@ora10g> col name for a60
sys@ora10g> select file#,name from v$datafile;
FILE# NAME
---------- ----------------------------------------------------------
1 /u01/app/oracle/oradata/ora10g/system01.dbf
2 /u01/app/oracle/oradata/ora10g/undotbs01.dbf
3 /u01/app/oracle/oradata/ora10g/sysaux01.dbf
4 /u01/app/oracle/oradata/ora10g/users01.dbf
5 /u01/app/oracle/oradata/ora10g/example01.dbf
6 /u01/app/oracle/oradata/ora10g/user_08.dbf
sys@ora10g> ! rm -f /u01/app/oracle/oradata/ora10g/system01.dbf
故障現象舉例:
sys@ora10g> select * from cat;
select * from cat
*
ERROR at line 1:
ORA-00604: error occurred at recursive SQL level 1
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora10g/system01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
sys@ora10g> shutdown immediate;
ORA-01116: error in opening database file 1
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora10g/system01.dbf'
ORA-27041: unable to open file
Linux Error: 2: No such file or directory
Additional information: 3
sys@ora10g> shutdown abort;
ORACLE instance shut down.
NotConnected@> startup;
ORACLE instance started.
Total System Global Area 314572800 bytes
Fixed Size 1219136 bytes
Variable Size 125830592 bytes
Database Buffers 180355072 bytes
Redo Buffers 7168000 bytes
Database mounted.
ORA-01157: cannot identify/lock data file 1 - see DBWR trace file
ORA-01110: data file 1: '/u01/app/oracle/oradata/ora10g/system01.dbf'
NotConnected@> select status from v$instance;
STATUS
------------
MOUNTED
3.使用RMAN完成資料檔案恢復
1)連線到catalog資料庫
[oracle@secdb oradata]$ rman target / catalog rman_catalog/rman_catalog@catalog
Recovery Manager: Release 10.2.0.1.0 - Production on Thu Jul 15 22:16:51 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
connected to target database: ORA10G (DBID=4067316777, not open)
connected to recovery catalog database
2)還原1號資料檔案,此檔案即為SYSTEM表空間丟失的資料檔案
RMAN> restore datafile 1;
Starting restore at 15-JUL-10
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=156 devtype=DISK
channel ORA_DISK_1: starting datafile backupset restore
channel ORA_DISK_1: specifying datafile(s) to restore from backup set
restoring datafile 00001 to /u01/app/oracle/oradata/ora10g/system01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/rmanbak/full_bk1_0flis4k9115.rmn
channel ORA_DISK_1: restored backup piece 1
piece handle=/u01/app/oracle/rmanbak/full_bk1_0flis4k9115.rmn tag=TAG20100715T171449
channel ORA_DISK_1: restore complete, elapsed time: 00:00:25
Finished restore at 15-JUL-10
3)對1號資料檔案進行恢復
RMAN> recover datafile 1;
Starting recover at 15-JUL-10
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:03
Finished recover at 15-JUL-10
4)將資料庫啟動到OPEN狀態
RMAN> alter database open;
database opened
5)驗證資料庫的可用性
[oracle@secdb oradata]$ sqlplus / as sysdba
SQL*Plus: Release 10.2.0.1.0 - Production on Thu Jul 15 22:24:14 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
sys@ora10g> select status from v$instance;
STATUS
------------
OPEN
4.小結
恢復丟失的資料檔案的過程是非常簡便的。真正要重視的備份策略的科學性和備份介質的有效性,前者需要需要對備份策略做深入的策劃,後者可以透過定期的備份介質有效性驗證來保證。
Good luck.
secooler
10.07.15
-- The End --
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/519536/viewspace-668139/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 撤消表空間資料檔案丟失的恢復.
- rman恢復資料檔案 恢復表空間
- RMAN恢復案例:丟失全部資料檔案恢復
- RMAN完全恢復丟失的資料檔案
- 恢復案例:歸檔模式下丟失非系統表空間資料檔案的恢復模式
- 當資料檔案表空間丟失的時候怎麼恢復該資料檔案
- 模擬控制檔案丟失進行恢復。
- 【原創】模擬控制檔案丟失的資料庫恢復資料庫
- rman 恢復---歸檔丟失and資料檔案損壞
- RMAN恢復案例:丟失非系統資料檔案恢復
- INDEX表空間檔案丟失或者損壞的恢復Index
- undo表空間檔案丟失恢復(1)--有備份
- 備份與恢復系列 九 丟失表空間資料檔案的還原與恢復
- 模擬資料檔案丟失
- 控制檔案丟失的RMAN恢復
- rman恢復--歸檔模式有備份,丟失資料檔案的恢復模式
- rman恢復--歸檔模式無備份,丟失資料檔案的恢復模式
- system表空間檔案損壞----完全恢復
- TEMP表空間的檔案丟失或損壞後的恢復
- RMAN恢復案例:無恢復目錄,丟失全部資料檔案、控制檔案、日誌檔案恢復
- 利用rman做資料檔案丟失的恢復實驗
- 資料檔案丟失的恢復
- 資料檔案丟失如何恢復
- RMAN恢復表空間,資料檔案,歸檔檔案,控制檔案等介紹
- 【管理篇備份恢復】rman恢復測試(一) 表空間資料檔案
- 新建的表空間(或資料檔案)丟失以及控制檔案丟失,有新建表空間(或資料檔案)前的控制文
- RMAN_部分資料檔案丟失或者損壞的恢復
- RMAN資料庫恢復 之歸檔模式有(無)備份-丟失資料檔案的恢復資料庫模式
- rman恢復:資料檔案丟失,控制檔案丟失,聯機日誌檔案丟失(非當前使用與當前使用)
- undo表空間檔案丟失恢復(2)--無備份有redo的情況下恢復
- undo表空間檔案丟失恢復(3)--無備份無redo的情況下恢復
- undo表空間檔案丟失恢復(4)--無備份無recover的情況下恢復
- 資料庫所有檔案丟失後透過RMAN實現恢復資料庫
- . 資料庫臨時表空間的資料檔案的丟失資料庫
- 【虛擬機器資料恢復】Hyper-V虛擬化檔案丟失的資料恢復案例虛擬機資料恢復
- Oracle RMAN 表空間恢復Oracle
- 普通資料檔案丟失的恢復方法
- 資料檔案丟失損壞的恢復--