ITPub博客

首页 > 数据库 > Oracle > oracle的RMAN异机恢复

oracle的RMAN异机恢复

原创 Oracle 作者:peng163fj 时间:2015-04-13 15:42:05 0 删除 编辑

装载前阶段

1.        将备份文件放到相同位置

2.        设置sidunix export windows set oracle_sid=orcl 注意大写

3.        进入set dbid=...可以在log中看到

4.        进入nomount状态,startup force nomount

5.        恢复SPFILE restore spfile from ‘位置

6.        恢复控制文件 restore controlfile from ‘位置’,如报错dummy而非orclshutdownstart

装载mount后阶段

7.        注意把控制文件复制过去,然后chown –R oracle.oinstall /u01/test1/

8.        然后是alter databse mount,不是startup,否则datafile没法复制

9.        ORA-00205: error in identifyingcontrol file, check alert log for more info

10.    alart log/U01/oradata/test1adump里,

11.    ORA-01102: cannot mountdatabase in EXCLUSIVE mode 注意两个数据库不能一起开

12.    select file_id,file_name from dba_data_files;查看数据文件,为14步打基础

13.    catalog start with 'F:\backup';这个用于定位恢复文件的位置




select  file_id,file_name from dba_data_files;
select file_id,file_name from dba_temp_files;

跨平台迁移时,可用catalog start with '/u01/install/soft'; 来制定恢复源的路径

完成后,rman>recover database,会有报错,可以不管
最后
SQL> startup pfile='/u01/install/soft/2.ora' upgrade;--如果版本不一致


startup nomount pfile='/home/backup/20150525/spfile.ora'

restore controlfile from '/home/backup/20150525/RMSDB_20150525_308_1_cONTROL';
报错就用ps -ef|more ora 看看有没有多余的进程,kill -9 一个个杀




完整恢复命令
startup nomount pfile='/u02/backup/ism.ora';


restore controlfile from '/u02/backup/ISM_20150807_320_1_CONTROL';


alter database mount;


column c1 format a5
column c2 format a40
select trim(file#) c1,name c2 from v$datafile;
select trim(file#) c1,name c2 from v$tempfile;


catalog start with '/u02/backup';


run
{
set newname for datafile 1 to"/u02/oracle/app/oradata/ism/SYSTEM.DBF";
set newname for datafile 2 to"/u02/oracle/app/oradata/ism/SYSAUX.DBF";
set newname for datafile 3 to"/u02/oracle/app/oradata/ism/UNDOTBS1.DBF";
set newname for datafile 4 to"/u02/oracle/app/oradata/ism/USERS.DBF";
set newname for datafile 5 to"/u02/oracle/app/oradata/ism/NNC_DATA01.DBF";
set newname for datafile 6 to"/u02/oracle/app/oradata/ism/NNC_DATA02.DBF";
set newname for datafile 7 to"/u02/oracle/app/oradata/ism/NNC_DATA03.DBF";
set newname for datafile 8 to"/u02/oracle/app/oradata/ism/NNC_INDEX01.DBF";
set newname for datafile 9 to"/u02/oracle/app/oradata/ism/NNC_INDEX02.DBF";
set newname for datafile 10 to"/u02/oracle/app/oradata/ism/NNC_INDEX03.DBF";
set newname for tempfile 1 to"/u02/oracle/app/oradata/ism/TEMP.DBF";
restore database;
switch datafile all;
}
shutdown immediate

startup pfile='/u02/backup/ism.ora' upgrade ;

upgrade后还没有完,要做以下几个步骤
0.修改temp指向
CREATE TEMPORARY TABLESPACE TMP 
TEMPFILE '/u01/app/oradata/TEMP01.DBF'
SIZE 8G
AUTOEXTEND OFF;

alter database default temporary tablespace tmp;
drop tablespace temp including contents and datafiles;
1.建立spfile
create spfile from pfile='/u01/backup/init.ora';
2.rman备份
show all;---改掉所有路径错误的
3.listener配置
alter system set local_listener='';
alter system register;
4.升级收尾
如果不想每次开启都用startup upgrade,就老实点泡脚本,预计时间1小时左右
@/u01/oracle/app/product/11.2.0/dbhome_1/rdbms/admin/catupgrd.sql













来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/21302630/viewspace-1571811/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论

注册时间:2013-11-20

  • 博文量
    155
  • 访问量
    382676