1. 程式人生 > >oper-O11gR2+ASM+RAC使用duplicate快速復制一個庫到單實例

oper-O11gR2+ASM+RAC使用duplicate快速復制一個庫到單實例

bho 靜態監聽 backup arch 步驟 bpm tables asm class

環境:

源庫: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快速復制一個庫到單實例