【備份恢復】丟失所有控制檔案,利用RMAN進行恢復操作
丟失所有控制檔案之利用RMAN進行恢復操作(利用的是備份現在的控制檔案形式)
——準備工作:
SQL> show parameter control
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
control_file_record_keep_time integer 7
control_files string /u01/app/oracle/oradata/ORA11G
R2/control01.ctl, /u01/app/ora
cle/oradata/ORA11GR2/control02 .ctl
control_management_pack_access string DIAGNOSTIC+TUNING
SQL>
SQL> archive log list
Database log mode No Archive Mode
Automatic archival Disabled
Archive destination /u01/app/oracle/product/11.2.0/dbhome_1/dbs/arch
Oldest online log sequence 12
Current log sequence 14
[oracle@wang ~]$ cd /u01/app
[oracle@wang app]$ ls
oracle oraInventory
[oracle@wang app]$ mkdir backup
[oracle@wang app]$ cd backup/[oracle@wang backup]$ pwd
/u01/app/backup
——修改歸檔路徑:
SQL> alter system set log_archive_dest='/u01/app/backup';
System altered.
SQL> show parameter log_archive_dest
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest string /u01/app/backup
log_archive_dest_1 string
log_archive_dest_10 string
log_archive_dest_11 string
log_archive_dest_12 string
——啟動歸檔:
SQL> shutdown immediate;
Database closed.
Database dismounted.
ORACLE instance shut down.
SQL>
SQL> startup mount;
ORACLE instance started.
Total System Global Area 830930944 bytes
Fixed Size 2257800 bytes
Variable Size 503319672 bytes
Database Buffers 322961408 bytes
Redo Buffers 2392064 bytes
Database mounted.
SQL>SQL> alter database archivelog;
Database altered.
SQL> archive log list;
Database log mode Archive Mode
Automatic archival Enabled
Archive destination /u01/app/backup
Oldest online log sequence 12
Next log sequence to archive 14
Current log sequence 14
——登入到目標資料庫備份:
[oracle@wang ORA11GR2]$ rman target /
Recovery Manager: Release 11.2.0.4.0 - Production on Fri Sep 23 07:13:07 2016
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ORA11GR2 (DBID=237843809, not open)
RMAN> alter database open;
using target database control file instead of recovery catalog
database opened
RMAN> configure channel device type disk format '/u01/app/backup/db_%U.rmn';
new RMAN configuration parameters:
CONFIGURE CHANNEL DEVICE TYPE DISK FORMAT '/u01/app/backup/db_%U.rmn';
new RMAN configuration parameters are successfully stored
RMAN> backup as backupset database include current controlfile plus archivelog format '/u01/app/backup/db_%U.rmn' delete all input;
Starting backup at 23-SEP-16
current log archived
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=35 device type=DISK
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=14 RECID=1 STAMP=923296567
channel ORA_DISK_1: starting piece 1 at 23-SEP-16
channel ORA_DISK_1: finished piece 1 at 23-SEP-16
piece handle=/u01/app/backup/db_01rggopo_1_1.rmn tag=TAG20160923T071607 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/backup/1_14_921272292.dbf RECID=1 STAMP=923296567
Finished backup at 23-SEP-16
Starting backup at 23-SEP-16
using channel ORA_DISK_1
channel ORA_DISK_1: starting full datafile backup set
channel ORA_DISK_1: specifying datafile(s) in backup set
input datafile file number=00001 name=/u01/app/oracle/oradata/ORA11GR2/system01.dbf
input datafile file number=00002 name=/u01/app/oracle/oradata/ORA11GR2/sysaux01.dbf
input datafile file number=00005 name=/u01/app/oracle/oradata/ORA11GR2/example01.dbf
input datafile file number=00003 name=/u01/app/oracle/oradata/ORA11GR2/undotbs01.dbf
input datafile file number=00004 name=/u01/app/oracle/oradata/ORA11GR2/users01.dbf
channel ORA_DISK_1: starting piece 1 at 23-SEP-16
channel ORA_DISK_1: finished piece 1 at 23-SEP-16
piece handle=/u01/app/backup/db_02rggopp_1_1.rmn tag=TAG20160923T071609 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:35
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 23-SEP-16
channel ORA_DISK_1: finished piece 1 at 23-SEP-16
piece handle=/u01/app/backup/db_03rggoqs_1_1.rmn tag=TAG20160923T071609 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
Finished backup at 23-SEP-16
Starting backup at 23-SEP-16
current log archived
using channel ORA_DISK_1
channel ORA_DISK_1: starting archived log backup set
channel ORA_DISK_1: specifying archived log(s) in backup set
input archived log thread=1 sequence=15 RECID=2 STAMP=923296606
channel ORA_DISK_1: starting piece 1 at 23-SEP-16
channel ORA_DISK_1: finished piece 1 at 23-SEP-16
piece handle=/u01/app/backup/db_04rggoqv_1_1.rmn tag=TAG20160923T071647 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:01
channel ORA_DISK_1: deleting archived log(s)
archived log file name=/u01/app/backup/1_15_921272292.dbf RECID=2 STAMP=923296606
Finished backup at 23-SEP-16
1) 本測試透過 RMAN 恢復控制檔案全部丟失
SQL> host
[oracle@wang ORA11GR2]$ ls cont*
control01.ctl control02.ctl
[oracle@wang ORA11GR2]$ rm *.ctl
[oracle@wang ORA11GR2]$
[oracle@wang ORA11GR2]$ ls cont*
ls: cont*: No such file or directory
[oracle@wang ORA11GR2]$
2) 由於控制檔案已經全部丟失,所以一定無法一致性關閉,只能採取極端的手段 abort 選項關閉資料庫
[oracle@wang ORA11GR2]$ exit
exit
SQL> shutdown immediate;
ORA-00210: cannot open the specified control file
ORA-00202: control file: '/u01/app/oracle/oradata/ORA11GR2/control01.ctl'
ORA-27041: unable to open file
Linux-x86_64 Error: 2: No such file or directory
Additional information: 3
SQL>
SQL> shutdown abort;
ORACLE instance shut down.
SQL>
3) 透過 RMAN 恢復控制檔案
RMAN> restore controlfile from '/u01/app/backup/db_03rggoqs_1_1.rmn';
Starting restore at 23-SEP-16
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:01
output file name=/u01/app/oracle/oradata/ORA11GR2/control01.ctl
output file name=/u01/app/oracle/oradata/ORA11GR2/control02.ctl
Finished restore at 23-SEP-16
RMAN> alter database mount;
database mounted
released channel: ORA_DISK_1
說明控制檔案已經恢復回來了
RMAN> recover database;(例項前滾,運用日誌恢復一致性狀態)
Starting recover at 23-SEP-16
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=19 device type=DISK
starting media recovery
archived log for thread 1 with sequence 15 is already on disk as file /u01/app/oracle/oradata/ORA11GR2/redo03.log
archived log for thread 1 with sequence 16 is already on disk as file /u01/app/oracle/oradata/ORA11GR2/redo01.log
archived log file name=/u01/app/oracle/oradata/ORA11GR2/redo03.log thread=1 sequence=15
archived log file name=/u01/app/oracle/oradata/ORA11GR2/redo01.log thread=1 sequence=16
media recovery complete, elapsed time: 00:00:00
Finished recover at 23-SEP-16
RMAN> alter database open resetlogs;(因為備份時的日誌不是最新的,且是根據舊版控制檔案修復資料庫,所以要以resetlogs方式啟動資料庫)
database
opened
完成!!!!!!!!!!
當然也可以將rman的永久配置項的控制檔案自動備份功能開啟,然後每次備份時控制檔案都自動備份一份,恢復是可以用自動控制檔案備份儲存的目錄內的控制檔案完成恢復控制檔案工作!!!!
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/31397003/viewspace-2126762/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【備份恢復】所有控制檔案丟失後 利用trace中的控制檔案備份執行恢復
- 【rman 備份與恢復】恢復丟失所有的控制檔案
- 恢復之利用備份在所有控制檔案丟失情況下恢復(四)
- 恢復之利用備份在所有控制檔案丟失情況下恢復(三)
- 恢復之利用備份在所有控制檔案丟失情況下恢復(二)
- 恢復之利用備份在所有控制檔案丟失情況下恢復(一)
- 【備份恢復】 丟失一個控制檔案 之恢復操作
- rman備份丟失控制檔案恢復
- 只有rman備份集,控制檔案丟失的恢復
- 控制檔案丟失的RMAN恢復
- 【備份恢復】歸檔模式下丟失系統關鍵資料檔案 利用RMAN備份恢復模式
- rman恢復--歸檔模式有備份,丟失資料檔案的恢復模式
- rman恢復--歸檔模式無備份,丟失資料檔案的恢復模式
- 備份與恢復--利用備份的控制檔案恢復
- 丟失全部控制檔案後從RMAN備份集中恢復示例
- RMAN備份恢復之控制檔案的恢復(三)
- RMAN備份恢復之控制檔案的恢復(二)
- RMAN備份恢復之控制檔案的恢復(一)
- rman恢復--丟失控制檔案的恢復
- 模擬控制檔案丟失進行恢復。
- RMAN基於備份控制檔案恢復失敗
- 控制檔案丟失恢復
- 【控制檔案丟失恢復】
- Oracle備份與恢復【丟失控制檔案的恢復】Oracle
- 【備份恢復】非歸檔模式下丟失任意資料檔案 恢復操作模式
- 備份恢復實驗(1)丟失部分控制檔案
- 【備份恢復】恢復 丟失已歸檔重做日誌檔案
- 利用備份的控制檔案恢復
- Oracle備份與恢復【丟失資料檔案的恢復】Oracle
- dg丟失歸檔,使用rman增量備份恢復
- 【管理篇備份恢復】rman恢復測試(二) 控制檔案恢復(三)
- 【管理篇備份恢復】rman恢復測試(二) 控制檔案恢復(二)
- 【管理篇備份恢復】rman恢復測試(二) 控制檔案恢復(一)
- RMAN恢復案例:丟失全部資料檔案恢復
- 【備份恢復】利用 備份控制檔案到指定目錄下的控制檔案 恢復控制檔案
- 利用增量備份恢復gap歸檔丟失DG
- RMAN恢復案例:無恢復目錄,丟失全部資料檔案、控制檔案、日誌檔案恢復
- 恢復之丟失全部控制檔案以及備份中的控制檔案