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):='C:\backup_test\ORA_DF631909818_S143_P1_C1'; v_fileTable(2):='C:\backup_test\ORA_DF631909818_S144_P1_C1'; v_maxPieces:=2; -- 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=>null, ident=>'d1'); -- Begin the restore conversation sys.dbms_backup_restore.restoreSetDatafile; -- Specify where the controlfile is to be recreated sys.dbms_backup_restore.restoreControlfileTo(cfname=>'D:\oracle\oradata\DABAK_TEST\control01.ctl'); --sys.dbms_backup_restore.restorespfileto('D:\oracle\oradata\DABAK_TEST\spfile'); -- 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; <> -- Deallocate the device sys.dbms_backup_restore.deviceDeallocate; END; /