轉貼_RMAN-DBMS_BACKUP_RESTORE
轉Metalink]
How to extract controlfiles, datafiles, and archived logs from SMR backupsets without using RMAN
R6B x ?,i!K0
|
|
How to extract controlfiles, datafiles, and archived logs from
SMR backupsets without using RMAN
Introduction:
When using RMAN to restore objects (datafiles, controlfiles, or archivelogs)
from backupsets, the object restore can be driven from the recovery catalog
or the target database controlfile. This note explains how to extract
objects from backupsets when the recovery catalog and controlfiles have been
lost. In this scenario, you effectively perform. the RMAN functions through
PL/SQL procedure calls
Contents:
1. Prerequisites
2. Extracting the controlfile from a backupset
3. Extracting datafiles from a backupset
4. Applying incrementals
5. Extracting archivelogs from a backupset
6. A typical scenario
7. Errors
8. Things to be done
1. Prerequisites
The customer must have a knowledge of the contents of backupsets i.e. what
they contain, when the backups were created, and the type of backups. Ideally
they should have logs of the RMAN backup sessions that produced the
backupsets.
Note that the following anonymous PL/SQL blocks are run on the instance of
the database being recovered (the 'target'). The instance must be at least
started (once the controlfile has been restored the database can also be
mounted). Anonymous blocks can be executed in this manner as long as they
call only 'fixed' packages. The DBMS_BACKUP_RESTORE packages are fixed.
IMPORTANT: All the anonymous blocks must be executed by SYS or a user
who has execute privilege on SYS.DBMS_BACKUP_RESTORE
2. Extracting the controlfile from a backupset
The first stage is to extract the controlfile from a backupset. This is
achieved by making use of the following SYS.DBMS_BACKUP_RESTORE packaged
functions & procedures:
FUNCTION deviceAllocate - allocates a device for sequential I/O
PROCEDURE restoreSetDataFile - begins a restore conversation
PROCEDURE restoreControlfileTo - specifies the controlfile destination
PROCEDURE restoreBackupPiece - performs the restore
PROCEDURE deviceDeallocate - deallocates the I/O device
The following anonymous block can be created and executed to restore a
controlfile from a backupset. Before executing it, you MUST edit the block
as follows:
a. The filetable PL/SQL table entries must reflect the backuppieces
comprising the backupset
b. The v_maxPieces variable must reflect the number of backuppieces
comprising the backupset
c. The call to restoreControlfileTo must specify the correct controlfile
path & filename
IMPORTANT: The latest backup of the controlfile should be restored. Because
recovery (using backup controlfile) will be performed manually,
the recovering session will need to start applying redo from
the current log sequence AT THE TIME OF THE CONTROLFILE BACKUP.
Thus, to take advantage of incremental backups, restore a
controlfile taken along with the incremental backups, thus
reducing the amount of redo required during recovery.
DECLARE
v_dev varchar2(50); -- device type allocated for restore
v_done boolean; -- has the controlfile been fully extracted yet
type t_fileTable is table of varchar2(255)
index by binary_integer;
v_fileTable t_fileTable; -- Stores the backuppiece names
v_maxPieces number:=1; -- Number of backuppieces in backupset
BEGIN
-- Initialise the filetable & number of backup pieces in the backupset
-- This section of code MUST be edited to reflect the customer's available
-- backupset before the procedure is compiled and run. In this example, the
-- backupset consists of 4 pieces:
v_fileTable(1):='fulldb_s15_p1';
v_fileTable(2):='fulldb_s15_p2';
v_fileTable(3):='fulldb_s15_p3';
v_fileTable(4):='fulldb_s15_p4';
v_maxPieces:=4;
-- Allocate a device. In this example, I have specified 'sbt_tape' as I am
-- reading backuppieces from the media manager. If the backuppiece is on disk,
-- specify type=>null
v_dev:=sys.dbms_backup_restore.deviceAllocate(type=>'sbt_tape',
ident=>'t1');
-- Begin the restore conversation
sys.dbms_backup_restore.restoreSetDatafile;
-- Specify where the controlfile is to be recreated
sys.dbms_backup_restore.restoreControlfileTo(cfname=>'/support2/OFA_V804/u1/oradata/dbs/ctrl1V804.ctl');
-- Restore the controlfile
FOR i IN 1..v_maxPieces LOOP
sys.dbms_backup_restore.restoreBackupPiece(done=>v_done,
handle=>v_fileTable(i),
params=>null);
IF v_done THEN
GOTO all_done;
END IF;
END LOOP;
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/22036495/viewspace-1024440/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- ORACLE lock 轉貼Oracle
- 轉貼crontab 命令
- 轉貼_字串分隔_拆分字串
- [轉貼]Skip Scan IndexIndex
- 核心管理概述(轉貼)
- 轉貼_roger大師_
- mysql 命令集(轉貼)MySql
- c# web service轉貼C#Web
- 農行的VIP (轉貼)
- SQLServer會話數管理(轉貼)SQLServer會話
- 轉貼:釋出小軟體
- 轉貼:Spring vs. EJBSpring
- 編碼規則指南(轉貼)
- c# orm轉貼入門C#ORM
- 貼個Linux笑話(轉)Linux
- 雙網路卡單IP(轉貼)
- (轉貼)關於程式和執行緒 (轉)執行緒
- DataList控制元件也玩分頁-轉貼 (轉)控制元件
- vb開發通訊軟體(cloud轉貼) (轉)Cloud
- 雨滴式的顯示圖片 (cloud 轉貼) (轉)Cloud
- 轉貼oracle直方圖histogram(二)Oracle直方圖Histogram
- 轉貼_push_subq_sql tuningSQL
- 轉貼:RMAN備份指令碼(Unix)指令碼
- [轉貼]欲練CSS,必先宮IECSS
- Oracle常用dump命令介紹[轉貼]Oracle
- 轉貼萬能查詢網址
- 誰該向誰學習(轉貼)
- 常用的路由器命令[轉貼]路由器
- [轉貼][php擴充套件-amqp]安裝PHP套件MQ
- 轉貼:xhost unable to open display解決方法
- 城市駕車21條經驗(轉貼)
- 轉貼:批量生成awr報告指令碼指令碼
- 獲取檔案路徑(Delphi )----轉貼
- [轉貼]windows的虛擬記憶體Windows記憶體
- 轉貼:google搜尋原理論文1Go
- 系統分析員基本功(轉貼)
- 轉貼:Oracle維護常用SQL語句OracleSQL
- LINUX 基準安全清單(轉貼)Linux