使用RMAN恢復目錄(catalog)解析
首先理解什麼是catalog 恢復目錄,實際上就是把資料庫的一部分分出來作為catalog,來長時間存備份資訊,在實際生產中,有時候會遇到要恢復資料庫到一年或是更長時間之前的狀態,我們知道控制檔案存在很多重要的資料庫結構資訊,但是你的控制檔案早已經被覆蓋,你就不能完成任務,而catalog就不一樣了,它可以儲存很長時間,當然它也不只是可以存控制檔案,也可以存別的備份副本,你可以把它簡單的理解成儲存時間長的控制檔案,已經在控制檔案清除的資訊,重新載入回來。
Tablespace created.
1,建立恢復目錄所有者預設表空間
SYS@ENMOEDU> create tablespace ts_catalog datafile '/u01/app/oracle/oradata/ENMOEDU/ts_catalog.dbf' size 15m;
2,建立恢復目錄所有者
SYS@ENMOEDU> grant connect,resource ,recovery_catalog_owner to rcower;
Grant succeeded.
Grant succeeded.
3.建立恢復目錄
[oracle@ENMOEDU ~]$ rman catalog rcower/oracle@ENMOEDU #catalog庫連線到另一個目標資料庫的的網路服務名(就是tnsname.ora 中開頭的名字)為ENMOEDU
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:37:55 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
RMAN> create catalog; #自動建立了恢復目錄相關的表,
recovery catalog created
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:37:55 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to recovery catalog database
RMAN> create catalog; #自動建立了恢復目錄相關的表,
recovery catalog created
註冊目標資料庫 註冊之後目標資料庫原檔案會同步到catalog
[oracle@ENMOEDU ~]$ rman target sys/oracle@ENMOEDU catalog rcower/oracle@ENMOEDU;
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:47:57 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ENMOEDU (DBID=87396644)
connected to recovery catalog database
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:47:57 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ENMOEDU (DBID=87396644)
connected to recovery catalog database
RMAN> register database;
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
database registered in recovery catalog
starting full resync of recovery catalog
full resync complete
檢視已經註冊的目標庫
[oracle@ENMOEDU ~]$ sqlplus rcower/oracle@ENMOEDU
SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 15 00:51:27 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
RCOWER@ENMOEDU> SELECT * FROM RC_DATABASE;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
1 2 87396644 ENMOEDU 1 07-OCT-13
SQL*Plus: Release 11.2.0.3.0 Production on Fri Aug 15 00:51:27 2014
Copyright (c) 1982, 2011, Oracle. All rights reserved.
Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.3.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
RCOWER@ENMOEDU> SELECT * FROM RC_DATABASE;
DB_KEY DBINC_KEY DBID NAME RESETLOGS_CHANGE# RESETLOGS
---------- ---------- ---------- -------- ----------------- ---------
1 2 87396644 ENMOEDU 1 07-OCT-13
從恢復目錄中登出目標資料庫
oracle@ENMOEDU ~]$ rman target sys/oracle@ENMOEDU catalog rcower/oracle@ENMOEDU; #目標庫和catalog庫可以為同一個庫,但是實際上是沒有意義的,因為你庫打不開時,是無法使用catalog的
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:47:57 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ENMOEDU (DBID=87396644)
connected to recovery catalog database
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:47:57 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ENMOEDU (DBID=87396644)
connected to recovery catalog database
RMAN> unregister database;
將其他備份副本匯入到恢復目錄,
Recovery Manager: Release 11.2.0.3.0 - Production on Fri Aug 15 00:47:57 2014
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ENMOEDU (DBID=87396644)
connected to recovery catalog database
Copyright (c) 1982, 2011, Oracle and/or its affiliates. All rights reserved.
connected to target database: ENMOEDU (DBID=87396644)
connected to recovery catalog database
將一個檔案匯入恢復目錄
RMAN> catalog backuppiece '/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2014_08_16/o1_mf_nnndf_TAG20140816T113253_9yxn76sb_.bkp';
using target database control file instead of recovery catalog
cataloged backup piece
backup piece handle=/u01/app/oracle/fast_recovery_area/ENMOEDU/backupset/2014_08_16/o1_mf_nnndf_TAG20140816T113253_9yxn76sb_.bkp RECID=26 STAMP=855748159
如果使用了快速恢復區,可以這樣一次性匯入。
RMAN> catalog recovery area noprompt;
searching for all files in the recovery area
no files found to be unknown to the database
List of files in Recovery Area not managed by the database
==========================================================
File Name: /u01/app/oracle/fast_recovery_area/ENMOEDU/control02.ctl
RMAN-07526: Reason: File is not an Oracle Managed File
number of files not managed by recovery area is 1, totaling 9.38MB
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/29734436/viewspace-1255842/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- 【備份恢復】RMAN catalog 恢復目錄資料庫資料庫
- 【RMAN】使用恢復目錄catalog備份目標資料庫的演示資料庫
- oracle實驗記錄 (恢復-rman catalog)Oracle
- 建立恢復目錄catalog並註冊目標庫
- rman不使用恢復目錄恢復資料庫示例及問題資料庫
- Oracle 10g使用RMAN恢復目錄筆記Oracle 10g筆記
- ORACLE RMAN異機異目錄恢復Oracle
- rman之建立恢復目錄筆記筆記
- 建立恢復目錄recover catalog(OCM複習總結)
- RMAN恢復目錄資料庫的搭建資料庫
- 【備份恢復】之RMAN 恢復目錄庫(客戶端備份資訊註冊到目標庫恢復目錄中)客戶端
- Oracle 備份恢復篇之RMAN catalogOracle
- 恢復目錄資料庫(Recovery Catalog)作用及演示例項資料庫
- 透過搭建恢復目錄實現RMAN異地備份和恢復
- oracle實驗記錄 (恢復-rman恢復)Oracle
- RMAN 中使用控制檔案代替恢復目錄需要注意的引數
- 【RMAN】資料庫到恢復目錄的註冊過程資料庫
- RMAN恢復案例:無恢復目錄,丟失全部資料檔案、控制檔案、日誌檔案恢復
- RMAN-在恢復目錄中註冊和取消資料庫資料庫
- RMAN說,我能備份(12)--RMAN中的恢復目錄和備份優化優化
- RMAN Catalog環境下異機全庫恢復例項
- 生產庫的恢復目錄被RMAN恢復出來的資料庫庫使用後出現的問題資料庫
- rman恢復 使用switch映像副本進行恢復
- RMAN 備份與恢復深入解析(二)
- RMAN 備份與恢復深入解析(一)
- Oracle 11G 恢復目錄Oracle
- 中小型資料庫 RMAN CATALOG 備份恢復方案(二)資料庫
- 中小型資料庫 RMAN CATALOG 備份恢復方案(一)資料庫
- 使用rman恢復控制檔案
- RMAN恢復 執行重要檔案RMAN恢復
- [記錄]oracle RMAN 備份恢復總結Oracle
- oracle實驗記錄 (恢復-rman保留策略)Oracle
- oracle實驗記錄 (恢復-rman基於控制檔案的恢復)Oracle
- 【RMAN】rman使用NORESTELOGS 方式恢復資料庫REST資料庫
- 使用RMAN恢復一個資料庫到另一個目錄結構不同的資料庫中資料庫
- 玩轉恢復目錄資料庫(一)資料庫
- 玩轉恢復目錄資料庫(二)資料庫
- 玩轉恢復目錄資料庫(四)資料庫