Oracle 基于RMAN的数据文件恢复

Rman数据备份脚本
RUN {
 CONFIGURE RETENTION POLICY TO RECOVERY WINDOW OF 7 DAYS;
 CONFIGURE CONTROLFILE AUTOBACKUP ON;
 CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO 'D:/app/Administrator/backup/%F';
 ALLOCATE CHANNEL CH1 DEVICE TYPE DISK FORMAT 'D:/app/Administrator/backup/%U';
 BACKUP DATABASE SKIP INACCESSIBLE FILESPERSET 10
   PLUS ARCHIVELOG FILESPERSET 20
   DELETE ALL INPUT;
 RELEASE CHANNEL CH1;
 }
 ALLOCATE CHANNEL FOR MAINTENANCE DEVICE TYPE DISK;
 CROSSCHECK BACKUPSET;
 DELETE NOPROMPT OBSOLETE;
 
 案例如下:
 1.首先执行备份脚本
 2.删除相关的数据文件
 shutdown immediate;
 删除数据文件D:\app\Administrator\oradata\ticket\TBS_DATA.DBF
 startup ;
 
 3.rman恢复
 rman target /
 restore datafile 'D:\app\Administrator\oradata\ticket\TBS_DATA.DBF';
 恢复数据文件
  recover database  datafile 'D:\app\Administrator\oradata\ticket\TBS_DATA.DBF';
  
 4.sqlplus 中打开数据库
 
 alter database open;
 

 

你可能感兴趣的:(oracle)