Chinaunix首页 | 论坛 | 博客
  • 博客访问: 1134124
  • 博文数量: 276
  • 博客积分: 10077
  • 博客等级: 上将
  • 技术积分: 2513
  • 用 户 组: 普通用户
  • 注册时间: 2007-08-24 20:31
文章分类

全部博文(276)

文章存档

2020年(1)

2015年(5)

2012年(2)

2011年(6)

2010年(7)

2009年(224)

2008年(31)

我的朋友

分类: Oracle

2009-01-07 15:12:59

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) |
给主人留下些什么吧!~~