1.提取控制文件
前提为知道控制文件名称和备份集名称
启动数据库到nomount阶段。
declare
deviceType varchar2(256);
done boolean;
begin
devicetype:=dbms_backup_restore.deviceAllocate(type=>'',ident=>'t1');
dbms_backup_restore.restoresetDataFile;
dbms_backup_restore.restoreControlFileto('D:\app\Administrator\oradata\orcl\CONTROL01.ctl');
dbms_backup_restore.restoreBackupPiece('D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2019_09_23\O1_MF_NCSNF_TAG20190923T040853_GRHOB034_.BKP',done=>done);
dbms_backup_restore.deviceDeallocate;
end;
/
2.提取spfile文件
declare
deviceType varchar2(256);
done boolean;
begin
devicetype:=dbms_backup_restore.deviceAllocate(type=>'',ident=>'t1');
dbms_backup_restore.restoresetDataFile;
dbms_backup_restore.restorespfileto('D:\app\Administrator\product\11.2.0\dbhome_1\database\SPFILEORCL.ORA');
dbms_backup_restore.restoreBackupPiece('D:\APP\ADMINISTRATOR\FLASH_RECOVERY_AREA\ORCL\BACKUPSET\2019_09_25\O1_MF_NCSN1_ORA_OEM_LEVEL_0_GRNQ24VO_.BKP',done=>done);
dbms_backup_restore.deviceDeallocate;
end;
/