码迷,mamicode.com
首页 > 其他好文 > 详细

oper-O11gR2+ASM+RAC使用duplicate快速复制一个库到单实例

时间:2018-11-23 16:09:50      阅读:151      评论:0      收藏:0      [点我收藏+]

标签:location   esc   别名   taf   asm   content   check   ddr   span   

环境:

源库:O11gR2+ASM+RAC+rhel6.4

目标库:O11gR2+rhel6.4单实例

步骤

1、配置静态监听

源库:/u01/app/11.2.0/grid_1/network/admin/listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
     (SID_DESC =
        (GLOBAL_DBNAME = bpm)
        (ORACLE_HOME = /u01/app/oracle/product/11.2.0/db_1)
        (SID_NAME = bpm1)
      )
  )

目标库:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora

SID_LIST_LISTENER =
  (SID_LIST =
     (SID_DESC =
        (GLOBAL_DBNAME = bpm)
        (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
        (SID_NAME = bpm)
      )
  )

2、配置别名tnsname.ora

源库:/u01/app/oracle/product/11.2.0/db_1/network/admin/tnsnames.ora

bpm =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.25.2)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bpm)
    )
  )
  
bpmt =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.27.32)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bpm)
    )
  )

目标库:/u01/app/oracle/product/11.2.0/dbhome_1/network/admin/tnsname.ora

bpm =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.25.2)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bpm)
    )
  )
  
bpmt =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.27.32)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = bpm)
    )
  )

3、配置口令文件

    3.1 直接从源库复制口令文件至备库

    3.2 创建新的口令文件

    orapwd file=orapwbpm password=xxxx entries=5

4、编写复制脚本

run {
 set newname for datafile 1 to /u01/app/oracle/oradata/bpm/system01.dbf;
 set newname for datafile 2 to /u01/app/oracle/oradata/bpm/sysaux01.dbf;
 set newname for datafile 3 to /u01/app/oracle/oradata/bpm/undotbs1.dbf;
 set newname for datafile 4 to /u01/app/oracle/oradata/bpm/users01.dbf;
 set newname for datafile 5 to /u01/app/oracle/oradata/bpm/undotbs2.dbf;
 set newname for datafile 6 to /u01/app/oracle/oradata/bpm/bpm01.dbf;
 set newname for tempfile 1 to /u01/app/oracle/oradata/bpm/temp01.dbf;
 set newname for tempfile 2 to /u01/app/oracle/oradata/bpm/bpm_t_tbs01.dbf; 
duplicate target database to bpm from active database
 spfile  
 set db_unique_name=bpmt
 set control_files=/u01/app/oracle/oradata/bpm/control01.ctl,/u01/app/oracle/oradata/bpm/control02.ctl
 set log_file_name_convert=+DATA,/u01/app/oracle/oradata/
 set log_archive_dest_1=LOCATION=/u01/app/oracle/fast_recovery_area
 set db_recovery_file_dest=/u01/app/oracle/fast_recovery_area
 set DB_RECOVERY_FILE_DEST_SIZE=3G
 set db_create_file_dest=/u01/app/oracle/oradata/bpm
 set cluster_database=false
 set audit_file_dest=/u01/app/oracle/admin/bpm/adump
 set MEMORY_TARGET=2G
 nofilenamecheck;
}

实际测试过程中

db_file_name_convert=‘+DATA’,‘/u01/app/oracle/oradata/‘ 没有生效导致报错,使用set newname代替...后期再测试

5、执行数据库复制(在源库或者目标库执行都可以)

rman target backup/oracle@bpm auxiliary backup/oracle@bpmt

   执行上诉编写好的脚本

6、复制完处理

  6.1 清除thread 2信息  

alter database disable thread 2;
alter database drop logfile group
3; alter database drop logfile group 4;
drop tablespace  undotbs2 including contents and datafiles;

7、测试

   select * from dual;

 

oper-O11gR2+ASM+RAC使用duplicate快速复制一个库到单实例

标签:location   esc   别名   taf   asm   content   check   ddr   span   

原文地址:https://www.cnblogs.com/zhuohy/p/10007928.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!