概述
1 备份参数文件
$ORACLE_HOME$/dbs
2 按照RAMN备份时的路径复制文件及备份
要求完全按照原服务器路径来
3 删除旧库
SYS@orcl>shutdown immediate;
SYS@orcl>startup mount restrict;
SYS@orcl>drop database;
4 还原参数文件
cp /backup/other/* /app/oracle/product/11.2.0/dbhome_1/dbs/
5 还原控制文件
rman target /
RMAN> startup nomount;
RMAN> restore controlfile from '/backup/other/c-1325328971-20150701-01';
6 挂载控制文件。
RMAN> alter database mount;
7 查看各数据/临时文件的路径,
RMAN> report schema;
8 检查恢复数据库到指定的时间点,需要的备份集,包括数据库备份集,及日志文件的备份集是否齐全
RMAN> crosscheck backup;
RMAN> restore database until time '2015-07-01 14:00:00' preview summary;
9 根据数据7步的文件路径生成恢复脚本(注意要保证下面路径确实存在,如果不存在要补上)
run
{allocate channel d1 type disk;
allocate channel d2 type disk;
set archivelog destination to '/backup/tmplog';
set newname for datafile 1 to '/app/oracle/oradata/orcl/datafile/system.260.797548131';
set newname for datafile 2 to '/app/oracle/oradata/orcl/datafile/sysaux.267.797548131';
set newname for datafile 3 to '/app/oracle/oradata/orcl/datafile/undotbs1.263.797548131';
set newname for datafile 4 to '/app/oracle/oradata/orcl/datafile/users.266.797548131';
set newname for datafile 5 to '/app/oracle/oradata/orcl/datafile/undotbs2.259.797548341';
set newname for datafile 6 to '/app/oracle/oradata/orcl/datafile/eas_d_hleas_standard.268.797536759';
set newname for datafile 7 to '/app/oracle/oradata/orcl/datafile/eas_d_hleas_temp2.269.797536799';
set newname for datafile 8 to '/app/oracle/oradata/orcl/datafile/eas_d_hlwl_standard.271.800633637';
set newname for datafile 9 to '/app/oracle/oradata/orcl/datafile/eas_d_hlwl_temp2.272.800633731';
set newname for datafile 10 to '/app/oracle/oradata/orcl/datafile/eas_d_hlwl_index.273.800633759';
set newname for datafile 11 to '/app/oracle/oradata/orcl/datafile/hlwl_data_ts.292.829046739';
set newname for datafile 12 to '/app/oracle/oradata/orcl/datafile/hlwl_index_ts.296.862571959';
set newname for datafile 13 to '/app/oracle/oradata/orcl/datafile/hlwl_index_ts.293.829046757';
set newname for datafile 14 to '/app/oracle/oradata/orcl/datafile/sysaux.294.829149347';
set newname for datafile 15 to '/app/oracle/oradata/orcl/datafile/movets.281.835217279';
set newname for datafile 16 to '/app/oracle/oradata/orcl/datafile/movets_idx.280.835217465';
set newname for datafile 17 to '/app/oracle/oradata/orcl/datafile/hlwl_data_ts02';
set newname for datafile 18 to '/app/oracle/oradata/orcl/datafile/eas_d_hlwl_standard02.dbf';
set newname for datafile 19 to '/app/oracle/oradata/orcl/datafile/eas_d_hlwl_standard03.dbf';
set newname for datafile 20 to '/app/oracle/oradata/orcl/datafile/hlwl_data_ts.289.862572033';
set newname for datafile 21 to '/app/oracle/oradata/orcl/datafile/hlwl_index_ts.284.879677831';
set newname for datafile 25 to '/app/oracle/oradata/orcl/datafile/hlwl_data_ts.275.868207823';
set newname for datafile 27 to '/app/oracle/oradata/orcl/datafile/hlwl_lob_ts06';
set newname for tempfile 1 to '/app/oracle/oradata/orcl/tempfile/temp.264.797548243';
set newname for tempfile 2 to '/app/oracle/oradata/orcl/tempfile/temp.261.853322227';
restore database;
switch datafile all;
switch tempfile all;
release channel d1;
release channel d2;
}
10 追加日志文件(如果加载新的控制文件,需要重启数据库,以便加载的文件生效)
RMAN> catalog start with '/backup/logbackup';
11 恢复到指定时间
RMAN> run
{allocate channel d1 type disk;
set until time '2015-07-01 16:00:00';
set archivelog destination to '/backup2/tmplog';
recover database delete archivelog;
release channel d1;
}
12 禁止block 变化跟踪
SQL> alter database disable block change tracking;
13 变更日志文件位置
SQL> select * from v$logfile;
alter database rename file '+DBDATA/orcl/onlinelog/inst2_redo0201.log' to '/app/oracle/oradata/orcl/onlinelog/inst2_redo0201.log';
alter database rename file '+FLASHDATA/orcl/onlinelog/inst2_redo0202.log' to '/app/oracle/oradata/orcl/onlinelog/inst2_redo0202.log';
alter database rename file '+DBDATA/orcl/onlinelog/inst1_redo0101.log' to '/app/oracle/oradata/orcl/onlinelog/inst1_redo0101.log';
alter database rename file '+FLASHDATA/orcl/onlinelog/inst1_redo0102.log' to '/app/oracle/oradata/orcl/onlinelog/inst1_redo0102.log';
alter database rename file '+DBDATA/orcl/onlinelog/inst1_redo0301.log' to '/app/oracle/oradata/orcl/onlinelog/inst1_redo0301.log';
alter database rename file '+FLASHDATA/orcl/onlinelog/inst1_redo0302.log' to '/app/oracle/oradata/orcl/onlinelog/inst1_redo0302.log';
alter database rename file '+DBDATA/orcl/onlinelog/inst2_redo0401.log' to '/app/oracle/oradata/orcl/onlinelog/inst2_redo0401.log';
alter database rename file '+FLASHDATA/orcl/onlinelog/inst2_redo0402.log' to '/app/oracle/oradata/orcl/onlinelog/inst2_redo0402.log';
alter database rename file '+DBDATA/orcl/onlinelog/inst1_redo0501.log' to '/app/oracle/oradata/orcl/onlinelog/inst1_redo0501.log';
alter database rename file '+FLASHDATA/orcl/onlinelog/inst1_redo0502.log' to '/app/oracle/oradata/orcl/onlinelog/inst1_redo0502.log';
alter database rename file '+DBDATA/orcl/onlinelog/inst2_redo0601.log' to '/app/oracle/oradata/orcl/onlinelog/inst2_redo0601.log';
alter database rename file '+FLASHDATA/orcl/onlinelog/inst2_redo0602.log' to '/app/oracle/oradata/orcl/onlinelog/inst2_redo0602.log';
alter database rename file '+DBDATA/orcl/onlinelog/inst1_redo0701.log' to '/app/oracle/oradata/orcl/onlinelog/inst1_redo0701.log';
alter database rename file '+FLASHDATA/orcl/onlinelog/inst1_redo0702.log' to '/app/oracle/oradata/orcl/onlinelog/inst1_redo0702.log';
alter database rename file '+DBDATA/orcl/onlinelog/inst2_redo0801.log' to '/app/oracle/oradata/orcl/onlinelog/inst2_redo0801.log';
alter database rename file '+FLASHDATA/orcl/onlinelog/inst2_redo0802.log' to '/app/oracle/oradata/orcl/onlinelog/inst2_redo0802.log';
14 禁止归档,并打开数据库。
SQL> alter database noarchivelog;
SQL> alter database open resetlogs;
15 禁止节点2实例。(因为是双rac在非集群上恢复所以要删除其它实例)
SQL> SELECT * FROM v$thread; --查看实例信息
SQL> alter database disable thread 2;
SQL> select group#,thread#,members,archived,status from v$log;--查看日志组
SQL> alter database drop logfile group 2; --禁用在线日志
SQL> alter database drop logfile group 4;
SQL> alter database drop logfile group 6;
SQL> alter database drop logfile group 8;
SQL> drop tablespace UNDOTBS2 including contents and datafiles; --删除节点2实例使用的回滚表空间
SQL> alter user hlwl identified by "1"; --修改主用户 hlwl 的密码
SQL> exec dbms_scheduler.disable(); --禁止 hlwl 用户里的定时作业
最后
以上就是醉熏小蜜蜂为你收集整理的oracle 12c异机恢复,RMAN 异机恢复数据(Oracle 11g)的全部内容,希望文章能够帮你解决oracle 12c异机恢复,RMAN 异机恢复数据(Oracle 11g)所遇到的程序开发问题。
如果觉得靠谱客网站的内容还不错,欢迎将靠谱客网站推荐给程序员好友。
发表评论 取消回复