duplicate rman複製資料庫技術

sun642514265發表於2013-05-30
環境介紹:
rhel5.4 32位 192.168.0.201,hostname=dg1  ORACLE_SID=orcl
rhel5.4 32位 192.168.0.202,hostname=dg2  ORACLE_SID=orcl

oracle版本: 11.2.0.1 32位企業版


主庫(192.168.0.201)

1、首先在主庫上建立測試資料(略)

2、通過rman建立備份檔案

[oracle@dg1 ~]$mkdir -p /u01/app/oracle/bak

[oracle@dg1 ~]$ rman target /


RMAN> backup database format '/u01/app/oracle/bak/%d_%s.bak' plus archivelog format '/u01/app/oracle/bak/%d_%s.bak';


從庫(192.168.0.202)

1、安裝資料庫軟體

2、建立相應目錄

[oracle@dg2 ~]$ mkdir -p /u01/app/oracle/bak

[oracle@dg2 ~]$ mkdir -p /u01/app/oracle/oradata/orcl

[oracle@dg2 ~]$ mkdir -p /u01/app/oracle/admin/orcl/{adump,bdump,cdump,dpdump,udump,pfile}
 
[oracle@dg2 ~]$ mkdir -p /u01/app/oracle/archive/orcl

[oracle@dg2 ~]$ mkdir -p /u01/app/oracle/oradata/orcl

[oracle@dg2 ~]$ mkdir -p /u01/app/oracle/flash_recovery_area/orcl



3、建立口令檔案(和主庫必須一致)

[oracle@dg2 ~]$ cd $ORACLE_HOME/dbs

[oracle@dg2 dbs]$ orapwd file=orapworcl password=orcl entries=30

4、複製主庫引數檔案到從庫

如果沒有該引數檔案,那麼create pfile from spfile;建立

[oracle@dg1 ~]$ cd $ORACLE_HOME/dbs

[oracle@dg1 dbs]$ scp initorcl.ora 192.168.0.202:$ORACLE_HOME/dbs

5、配置tns監聽程式(主庫也要配置)(netca建立--本地網路服務名配置)


DG2 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.202)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

DG1 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.0.201)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = orcl)
    )
  )

6、複製主庫備份集資訊到備庫

[oracle@dg1 ~]$ cd /u01/app/oracle/bak

[oracle@dg1 bak]$ scp * 192.168.0.202:/u01/app/oracle/bak/

reverse mapping checking getaddrinfo for bogon failed - POSSIBLE BREAK-IN ATTEMPT!
oracle@192.168.0.202's password: 
ORCL_32.bak                                                                   100%   32MB  15.8MB/s   00:02    
ORCL_33.bak                                                                   100%  745MB   6.3MB/s   01:59    
ORCL_34.bak                                                                   100% 9600KB   9.4MB/s   00:01    
ORCL_35.bak                                                                   100%   48KB  47.5KB/s   00:00 


7、將資料庫啟動到nomount狀態(如果啟動有問題,請檢查你的引數檔案)

oracle@dg2 ~]$ sqlplus "/as sysdba"

SQL> startup nomount;
ORACLE instance started.

Total System Global Area  368263168 bytes
Fixed Size    1336596 bytes
Variable Size  306186988 bytes
Database Buffers   54525952 bytes
Redo Buffers    6213632 bytes


8、使用rman對從庫進行恢復

[oracle@dg2 ~]$ rman target sys/orcl@dg1 auxiliary /

Recovery Manager: Release 11.2.0.1.0 - Production on Thu May 30 10:07:21 2013

Copyright (c) 1982, 2009, Oracle and/or its affiliates.  All rights reserved.

connected to target database: ORCL (DBID=1344401817)
connected to auxiliary database: ORCL (not mounted)


RMAN> duplicate target database to orcl nofilenamecheck;

···················
·····················
························
database opened
Finished Duplicate Db at 30-MAY-13

恢復完成。

對資料庫進行查詢看看吧。。。





來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/28698327/viewspace-762416/,如需轉載,請註明出處,否則將追究法律責任。

相關文章