rman 非歸檔模式下open庫備份與mount恢復
非歸檔,open
模式下
一 將表空間users設定為只讀
SQL> show user
USER is "SYS"
SQL> alter tablespace users read only;
Tablespace altered.
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------------------------------------ ------------------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS READ ONLY
EXAMPLE ONLINE
CHEN_TEMP ONLINE
CHEN01 ONLINE
TEST ONLINE
9 rows selected.
二 open,非歸檔狀態下,備份只讀表空間
RMAN> run{
2> allocate channel c1 type disk;
3> backup tablespace users;
4> }
allocated channel: c1
channel c1: SID=141 device type=DISK
Starting backup at 07-JUL-15
channel c1: starting full datafile backup set
channel c1: specifying datafile(s) in backup set
input datafile file number=00004 name=/u01/app/oracle/oradata/ogg1/users01.dbf
channel c1: starting piece 1 at 07-JUL-15
channel c1: finished piece 1 at 07-JUL-15
piece handle=/u01/app/oracle/flash_recovery_area/OGG1/backupset/2015_07_07/o1_mf_nnndf_TAG20150707T162539_bsq383fm_.bkp tag=TAG20150707T162539 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
Finished backup at 07-JUL-15
Starting Control File and SPFILE Autobackup at 07-JUL-15
piece handle=/u01/app/oracle/flash_recovery_area/OGG1/autobackup/2015_07_07/o1_mf_s_884449540_bsq384q6_.bkp comment=NONE
Finished Control File and SPFILE Autobackup at 07-JUL-15
released channel: c1
三 剪下只讀表空間到其他目錄,模擬故障
[oracle@ogg1 ogg1]$ mv users01.dbf /home/oracle/
SQL> conn chen/chen
Connected.
SQL> select * from t1;
ID
----------
10000
10000
四 清空資料庫緩衝區和共享池,查詢表報錯(表所在表空間為users)
SQL> alter system flush buffer_cache;
System altered.
SQL> alter system flush shared_pool;
System altered.
SQL> select * from t1;
select * from t1
*
ERROR at line 1:
ORA-01116: error in opening database file 4
ORA-01110: data file 4: '/u01/app/oracle/oradata/ogg1/users01.dbf'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
五 透過備份恢復表空間users,報錯,不能在open狀態下進行恢復
RMAN> restore tablespace users;
Starting restore at 07-JUL-15
using channel ORA_DISK_1
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 00004 to /u01/app/oracle/oradata/ogg1/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/OGG1/backupset/2015_07_07/o1_mf_nnndf_TAG20150707T162539_bsq383fm_.bkp
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of restore command at 07/07/2015 17:26:43
ORA-19870: error while restoring backup piece /u01/app/oracle/flash_recovery_area/OGG1/backupset/2015_07_07/o1_mf_nnndf_TAG20150707T162539_bsq383fm_.bkp
ORA-19573: cannot obtain exclusive enqueue for datafile 4
'/u01/app/oracle/flash_recovery_area/OGG1/backupset/2015_07_07/o1_mf_nnndf_TAG20150707T162539_bsq383fm_.bkp'
六 掛載資料庫,進行恢復
[oracle@ogg1 2015_07_07]$ rman target / nocatalog
Recovery Manager: Release 11.2.0.1.0 - Production on Tue Jul 7 17:52:57 2015
Copyright (c) 1982, 2009, Oracle and/or its affiliates. All rights reserved.
connected to target database (not started)
RMAN> startup mount
RMAN> restore tablespace users;
Starting restore at 07-JUL-15
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 00004 to /u01/app/oracle/oradata/ogg1/users01.dbf
channel ORA_DISK_1: reading from backup piece /u01/app/oracle/flash_recovery_area/OGG1/backupset/2015_07_07/o1_mf_nnndf_TAG20150707T162539_bsq383fm_.bkp
channel ORA_DISK_1: piece handle=/u01/app/oracle/flash_recovery_area/OGG1/backupset/2015_07_07/o1_mf_nnndf_TAG20150707T162539_bsq383fm_.bkp tag=TAG20150707T162539
channel ORA_DISK_1: restored backup piece 1
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
Finished restore at 07-JUL-15
RMAN> recover tablespace users;
Starting recover at 07-JUL-15
using channel ORA_DISK_1
starting media recovery
media recovery complete, elapsed time: 00:00:00
Finished recover at 07-JUL-15
RMAN> alter database open;
database opened
七 恢復成功,read write表空間
SQL> conn chen/chen
Connected.
SQL> select * from t1;
ID
----------
10000
10000
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------------------------------------ ------------------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS READ ONLY
EXAMPLE ONLINE
CHEN_TEMP ONLINE
CHEN01 ONLINE
TEST ONLINE
9 rows selected.
SQL> alter tablespace users read write;
Tablespace altered.
SQL> select tablespace_name,status from dba_tablespaces;
TABLESPACE_NAME STATUS
------------------------------------------------------------ ------------------
SYSTEM ONLINE
SYSAUX ONLINE
UNDOTBS1 ONLINE
TEMP ONLINE
USERS ONLINE
EXAMPLE ONLINE
CHEN_TEMP ONLINE
CHEN01 ONLINE
TEST ONLINE
9 rows selected.
歡迎關注我的微信公眾號"IT小Chen",共同學習,共同成長!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29785807/viewspace-1726595/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- rman 非歸檔模式下停庫備份與恢復模式
- 備份&恢復之四:非歸檔模式下的備份與恢復模式
- 恢復之非歸檔模式下資料庫非正常關閉的備份與恢復模式資料庫
- 【備份恢復】非歸檔模式下丟失任意資料檔案 恢復操作模式
- RMAN備份、恢復實驗室 之 備份篇 【歸檔模式】模式
- 【備份恢復】歸檔模式下丟失系統關鍵資料檔案 利用RMAN備份恢復模式
- 非歸檔資料庫RMAN備份資料庫
- 無備份恢復(歸檔模式)模式
- 恢復之非歸檔模式下的恢復模式
- rman恢復--歸檔模式有備份,丟失資料檔案的恢復模式
- rman恢復--歸檔模式無備份,丟失資料檔案的恢復模式
- oracle RMAN 非歸檔資料庫恢復Oracle資料庫
- 非歸檔模式恢復資料庫模式資料庫
- 非歸檔模式下恢復資料庫兩例模式資料庫
- RMAN資料庫恢復 之歸檔模式有(無)備份-丟失資料檔案的恢復資料庫模式
- 非歸檔無備份下控制檔案丟失的恢復
- 歸檔模式下,offline表空間備份與恢復模式
- Oracle的奇葩設定之非歸檔模式與RMAN備份Oracle模式
- Rman Crosscheck刪除失效歸檔-備份恢復ROS
- 非RMAN熱備份資料庫和恢復資料庫
- 基於非歸檔的冷備份恢復
- rman datafile恢復(歸檔模式)模式
- 備份&恢復之八:RMAN備份歸檔模式下損壞(丟失)多個資料檔案,進行整個資料庫的恢復模式資料庫
- rman在歸檔與非歸檔時備份資料庫的簡單示例資料庫
- 非歸檔模式下的資料備份模式
- dg丟失歸檔,使用rman增量備份恢復
- RMAN在歸檔/非歸檔,庫關閉/mounted/開啟狀態下的備份
- 資料庫備份與恢復(使用歸檔後滾)資料庫
- rman資料庫全庫備份與恢復資料庫
- 【備份恢復】noarchive模式下使用增量備份恢復資料庫Hive模式資料庫
- 歸檔模式下,使用RMAN的同一備份兩次用於不完全恢復模式
- RMAN恢復(rman只備份資料庫,但不備份歸檔,歸檔透過簡單的rsync或scp來傳送到異地備份)資料庫
- RMAN備份及恢復歸檔日誌的語法
- 備份與恢復--從備份的歸檔日誌中恢復資料
- RMAN備份與恢復之加密備份加密
- RMAN備份、恢復實驗室 之 備份篇 【rman: can't open target】
- RMAN備份與恢復(新舊控制檔案及歸檔日誌)測試
- ORACLE非歸檔下的恢復Oracle