dbms_backup_restore用于从备份集中读取各类文件。
--crontrol file
declare
devtype varchar2(256);
done boolean;
begin
devtype := sys.dbms_backup_restore.deviceallocate(type => '',
ident => 't1');
sys.dbms_backup_restore.restoresetdatafile;
sys.dbms_backup_restore.restorecontrolfileto(cfname => 'p:\controlfile.ctl');
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'P:\BACKUP2\ETK2RRUM_1_1',
params => null);
sys.dbms_backup_restore.devicedeallocate;
end;
--restore datafile
select file_id, file_name, bytes / 1048576
from dba_data_files
order by 1 asc
declare
devtype varchar2(256);
done boolean;
begin
devtype := sys.dbms_backup_restore.deviceallocate(type => '',
ident => 't1');
sys.dbms_backup_restore.restoresetdatafile;
sys.dbms_backup_restore.restoredatafileto(dfnumber => 01,
toname => 'P:\SYSTEM01.DBF');
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_20_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_1_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_2_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_3_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_4_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_5_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_6_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_7_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_8_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_9_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_10_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_11_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_12_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_13_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_14_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_15_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_16_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_17_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_18_1',
params => null);
sys.dbms_backup_restore.restorebackuppiece(done => done,
handle => 'p:\backup2\ESK2RP8M_19_1',
params => null);
sys.dbms_backup_restore.devicedeallocate;
end;
=========================
Reference
阅读(1598) | 评论(0) | 转发(0) |