rman进行数据库的备份与恢复

通过rman进行备份与恢复的基本步骤

1.进入rman target sys/密码
2.编辑脚本,放在d:\sql下命名为level0.sql
run {

  configure controlfile autobackup on;

  configure controlfile autobackup format for device type disk to 'd:\backup\%F';

  allocate channel d1 type disk;

  allocate channel d2 type disk;

  backup incremental level=0 database format 'd:\backup\d_%T_%s.bak';

  release channel d1;

  release channel d2;

}
level1.sql
run {

  configure controlfile autobackup on;

  configure controlfile autobackup format for device type disk to 'd:\backup1\%F';

  allocate channel d1 type disk;

  allocate channel d2 type disk;

  backup incremental level=1 database format 'd:\backup1\d_%T_%s.bak';

  release channel d1;

  release channel d2;

}

3.RMAN>@d:\sql\level0.sql
4.RMAN>@d:\sql\level1.sql
备份完成
5.通过rman还原数据库
6.修改
修改d:\develop\oracle\product\10.2.0\orcl\admin\orcl\pfile\init.ora.12848886686 文件,添加参数:
 _allow_resetlogs_corruption=true
7.在sqlplus下connect sys/密码
8.SQL>startup pfile="d:\develop\oracle\product\10.2.0\orcl\admin\orcl\pfile\init.ora.12848886686" nomount;
9.在RMAN下
select dbid from v$database;

记住这个数,本例中dbid为:1276583931
10.connect target sys/密码 ;
11.set dbid=1276583931;
12.restore controlfile from 'd:\backup1\c-1276583931-20110803-00’;
13.restore spfile from 'd:\backup1\c-1276583931-20110803-00';
14.alter database mount;
15.restore database;
16.Alter database open resetlogs;

 

 

 

 

 

你可能感兴趣的:(ORACLE随笔)