ITPub博客

首页 > Linux操作系统 > Linux操作系统 > rman冷备从rac恢复到single-异机

rman冷备从rac恢复到single-异机

原创 Linux操作系统 作者:oracle_mao 时间:2012-04-28 09:09:48 0 删除 编辑

rac---single instance(rman)
测试机器:
IP:192.168.1.139
IP:192.168.1.140
备注:----这2个是一套rac测试环境,但这里rac-单实例的测试我们只使用192.168.1.139
1、在hpux的机器上造一个pfile文件(因为rman备份文件是从hpux的rac环境下备份出来的,所以这里要用想同平台的os当然也可以用其他平台,但是需要转化)
*.audit_file_dest='/pmsdb/oracle/admin/PMSPTLDB/adump'----需要创建目录
*.audit_trail='db'
*.compatible='11.1.0.0.0'
#*.control_files='/home/test/pmsptl/controlfile/control01.dbf'
*.control_files='+DATA_ZKF/pmsptldb/controlfile/current.461.780856553','+DATA_ZKF/pmsptldb/controlfile/current.462.780856553','+DATA_ZKF/pmsptldb/controlfile/current.463.780856553'--随便写3个就行,一会待数据库恢复后,还需要重新改
*.db_block_size=8192
*.db_create_file_dest='+DATA_ZKF'
*.db_domain=''
*.db_name='PMSPTLDB'----原库的db_name
*.db_recovery_file_dest='+DATA_ZKF'
*.db_recovery_file_dest_size=10737418240
*.diagnostic_dest='/pmsdb/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=PRDCSEXDB)'
*.log_archive_dest_1='LOCATION=+DATA_ZKF/'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_max_target=27322744832
*.memory_target=27322744832
*.open_cursors=300
*.processes=2500
*.remote_login_passwordfile='exclusive'
*.sessions=2755
*.undo_tablespace='UNDOTBS2'

2、用pfile文件在139上启动实例到nomount状态
export ORACLE_SID=PTLP1----原库中的一个ORACLE_SID
sqlplus / as sysdba
startup nomount pfile='/pmsdb/oracle/11.1.0/dbs/initPTLP1.ora';

3、rman链接,恢复控制文件
先做链接
rman target /
RMAN> restore controlfile from '/rmanbak/PMSPTLDB:6628:780497013:1.ctl;
备注:这里备份文件所指的位置,是和原服务器备份文件一样的位置。如果在目标服务器我们把scp过来的备份文件放在其他目录下,那就需要做一个链接。当然,还有其他办法,但是这个办法是最简单的

4、将数据库mount
RMAN>alter database mount;

5、恢复数据库
run {
allocate channel c1 type disk;
allocate channel c2 type disk;
allocate channel c3 type disk;
allocate channel c4 type disk;
set newname for datafile          1 to '+DATA_ZKF';---由于在两边服务器的目录不一样,所以这里需要newname
set newname for datafile          2 to '+DATA_ZKF';
set newname for datafile          3 to '+DATA_ZKF';
set newname for datafile          4 to '+DATA_ZKF';
set newname for datafile          5 to '+DATA_ZKF';
set newname for datafile          6 to '+DATA_ZKF';
set newname for datafile          7 to '+DATA_ZKF';
set newname for datafile          8 to '+DATA_ZKF';
set newname for datafile          9 to '+DATA_ZKF';
set newname for datafile         10 to '+DATA_ZKF';
set newname for datafile         11 to '+DATA_ZKF';
set newname for datafile         12 to '+DATA_ZKF';
set newname for datafile         13 to '+DATA_ZKF';
set newname for datafile         14 to '+DATA_ZKF';
set newname for datafile         15 to '+DATA_ZKF';
set newname for datafile         16 to '+DATA_ZKF';
set newname for datafile         17 to '+DATA_ZKF';
set newname for datafile         18 to '+DATA_ZKF';
set newname for datafile         19 to '+DATA_ZKF';
set newname for datafile         20 to '+DATA_ZKF';
set newname for datafile         21 to '+DATA_ZKF';
set newname for datafile         22 to '+DATA_ZKF';
set newname for datafile         23 to '+DATA_ZKF';
set newname for datafile         24 to '+DATA_ZKF';
set newname for datafile         25 to '+DATA_ZKF';
set newname for datafile         26 to '+DATA_ZKF';
set newname for datafile         27 to '+DATA_ZKF';
set newname for datafile         28 to '+DATA_ZKF';
set newname for datafile         29 to '+DATA_ZKF';
set newname for datafile         30 to '+DATA_ZKF';
set newname for datafile         31 to '+DATA_ZKF';
set newname for datafile         32 to '+DATA_ZKF';
set newname for datafile         33 to '+DATA_ZKF';
set newname for datafile         34 to '+DATA_ZKF';
set newname for datafile         35 to '+DATA_ZKF';
set newname for datafile         36 to '+DATA_ZKF';
set newname for datafile         37 to '+DATA_ZKF';
set newname for datafile         38 to '+DATA_ZKF';
set newname for datafile         39 to '+DATA_ZKF';
set newname for datafile         40 to '+DATA_ZKF';
set newname for datafile         41 to '+DATA_ZKF';
set newname for datafile         42 to '+DATA_ZKF';
set newname for datafile         43 to '+DATA_ZKF';
set newname for datafile         44 to '+DATA_ZKF';
set newname for datafile         45 to '+DATA_ZKF';
set newname for datafile         46 to '+DATA_ZKF';
set newname for datafile         47 to '+DATA_ZKF';
set newname for datafile         48 to '+DATA_ZKF';
set newname for datafile         49 to '+DATA_ZKF';
set newname for datafile 50 to '+DATA_ZKF';                     
set newname for datafile 54 to '+DATA_ZKF';                     
set newname for datafile 58 to '+DATA_ZKF';                     
set newname for datafile 62 to '+DATA_ZKF';                     
set newname for datafile 66 to '+DATA_ZKF';                     
set newname for datafile 70 to '+DATA_ZKF';                     
set newname for datafile 48 to '+DATA_ZKF';                     
set newname for datafile 52 to '+DATA_ZKF';                     
set newname for datafile 56 to '+DATA_ZKF';                     
set newname for datafile 60 to '+DATA_ZKF';                     
set newname for datafile 64 to '+DATA_ZKF';                     
set newname for datafile 68 to '+DATA_ZKF';                     
set newname for datafile 72 to '+DATA_ZKF';                     
set newname for datafile 51 to '+DATA_ZKF';                     
set newname for datafile 55 to '+DATA_ZKF';                     
set newname for datafile 59 to '+DATA_ZKF';                     
set newname for datafile 63 to '+DATA_ZKF';                     
set newname for datafile 67 to '+DATA_ZKF';                     
set newname for datafile 71 to '+DATA_ZKF';                     
set newname for datafile 49 to '+DATA_ZKF';                     
set newname for datafile 53 to '+DATA_ZKF';                     
set newname for datafile 57 to '+DATA_ZKF';                     
set newname for datafile 61 to '+DATA_ZKF';                     
set newname for datafile 65 to '+DATA_ZKF';                     
set newname for datafile 69 to '+DATA_ZKF';
set newname for datafile         73 to '+DATA_ZKF';
set newname for datafile         74 to '+DATA_ZKF';
set newname for datafile         75 to '+DATA_ZKF';
set newname for datafile         76 to '+DATA_ZKF';
set newname for datafile         77 to '+DATA_ZKF';
set newname for datafile         78 to '+DATA_ZKF';
set newname for datafile         79 to '+DATA_ZKF';
set newname for datafile         80 to '+DATA_ZKF';
set newname for datafile         81 to '+DATA_ZKF';
set newname for datafile         82 to '+DATA_ZKF';
set newname for datafile         83 to '+DATA_ZKF';
set newname for datafile         84 to '+DATA_ZKF';
set newname for datafile         85 to '+DATA_ZKF';
restore database from tag='TAG20120413T124228';
switch datafile all;---如果不切换,它还是会去原来的目录下寻找
release channel c1;
release channel c2;
release channel c3;
release channel c4;
};

6、启动数据库
RMAN>alter database open resetlogs;
备注:由于原库是冷备,所以这里不需要recovery

7、创建spfile文件,或者修改控制文件位置

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

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

注册时间:2011-03-28

  • 博文量
    94
  • 访问量
    746492