11GR2 Active Duplicate過程(單例項對單例項)

abstractcyj發表於2015-12-23
今天做了一下RMAN Active Duplicate實驗。歸根結底,弄明白了,其實整個過程還是挺簡單的。
兩臺虛擬機器IP分別是192.168.13.128, 192.168.13.129, 源端service_name: test01, 目標端service_name:dup01

1. SOURCE端與TARGET端都要有相同的目錄結構, 在目標端建立所需的目錄結構
  mkdir -p  /u01/app/oracle/fast_recovery_area/dup01 

   mkdir -p  /u01/app/oracle/oradata/dup01/

   mkdir -p  /u01/app/oracle/admin/dup01/adump

2. 將源端的密碼檔案$ORACLE_HOME/dbs/orapwtest01拷貝至目標端$ORACLE_HOME/dbs/, 改名
    scp oracle@192.168.13.128:/u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwtest01 /u01/app/oracle/product/11.2.0/dbhome_1/dbs
   mv /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwtest01  /u01/app/oracle/product/11.2.0/dbhome_1/dbs/orapwdup01

3. 建立pfile, $ORACLE_HOME/dbs/initdup01.ora, 內容很簡單:
   db_name=dup01
4. active需要靜態監聽, listener.ora檔案內容
  # listener.ora Network Configuration File: /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
  # Generated by Oracle configuration tools.
SID_LIST_LISTENER =
  (SID_LIST =
    (
     SID_DESC =
      (GLOBAL_DBNAME = test01)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = test01)
    )
    (SID_DESC =
      (GLOBAL_DBNAME = dup01)
      (ORACLE_HOME = /u01/app/oracle/product/11.2.0/dbhome_1)
      (SID_NAME = dup01)
    )
  )


LISTENER =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
      (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
    )
  )


ADR_BASE_LISTENER = /u01/app/oracle


5. 源端配置兩個TNS(tnsnames.ora):

  TEST01 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = localhost)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = test01)
    )
  )
dup01 =
  (DESCRIPTION =
    (ADDRESS_LIST =
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.13.129)(PORT = 1521))
    )
    (CONNECT_DATA =
      (SERVICE_NAME = dup01)
    )
  )

6. 將目標端啟動至nomount狀態
  
7.源端登入:
  rman target sys/sys@test01 auxiliary sys/sys@dup01
  DUPLICATE DATABASE TO dup01 FROM ACTIVE DATABASE SPFILE NOFILENAMECHECK;

如果沒出現問題,就可以看到如下輸出:
此處省略若干行....
sql statement: alter system set  db_name =  ''DUP01'' comment= ''Reset to original value by RMAN'' scope=spfile


sql statement: alter system reset  db_unique_name scope=spfile


Oracle instance shut down


connected to auxiliary database (not started)
Oracle instance started


Total System Global Area     835104768 bytes


Fixed Size                     2257840 bytes
Variable Size                541068368 bytes
Database Buffers             285212672 bytes
Redo Buffers                   6565888 bytes
sql statement: CREATE CONTROLFILE REUSE SET DATABASE "DUP01" RESETLOGS ARCHIVELOG 
  MAXLOGFILES     16
  MAXLOGMEMBERS      3
  MAXDATAFILES      100
  MAXINSTANCES     8
  MAXLOGHISTORY      292
 LOGFILE
  GROUP   1  SIZE 50 M ,
  GROUP   2  SIZE 50 M ,
  GROUP   3  SIZE 50 M 
 DATAFILE
  '/u01/app/oracle/oradata/test01/system01.dbf'
 CHARACTER SET ZHS16GBK




contents of Memory Script:
{
   set newname for tempfile  1 to 
 "/u01/app/oracle/oradata/test01/temp01.dbf";
   switch clone tempfile all;
   catalog clone datafilecopy  "/u01/app/oracle/oradata/test01/sysaux01.dbf", 
 "/u01/app/oracle/oradata/test01/undotbs01.dbf", 
 "/u01/app/oracle/oradata/test01/users01.dbf", 
 "/u01/app/oracle/oradata/test01/example01.dbf";
   switch clone datafile all;
}
executing Memory Script


executing command: SET NEWNAME


renamed tempfile 1 to /u01/app/oracle/oradata/test01/temp01.dbf in control file


cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/test01/sysaux01.dbf RECID=1 STAMP=899163477
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/test01/undotbs01.dbf RECID=2 STAMP=899163477
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/test01/users01.dbf RECID=3 STAMP=899163477
cataloged datafile copy
datafile copy file name=/u01/app/oracle/oradata/test01/example01.dbf RECID=4 STAMP=899163477


datafile 2 switched to datafile copy
input datafile copy RECID=1 STAMP=899163477 file name=/u01/app/oracle/oradata/test01/sysaux01.dbf
datafile 3 switched to datafile copy
input datafile copy RECID=2 STAMP=899163477 file name=/u01/app/oracle/oradata/test01/undotbs01.dbf
datafile 4 switched to datafile copy
input datafile copy RECID=3 STAMP=899163477 file name=/u01/app/oracle/oradata/test01/users01.dbf
datafile 5 switched to datafile copy
input datafile copy RECID=4 STAMP=899163477 file name=/u01/app/oracle/oradata/test01/example01.dbf


contents of Memory Script:
{
   Alter clone database open resetlogs;
}
executing Memory Script


database opened
Finished Duplicate Db at 23-DEC-15


RMAN> quit




Recovery Manager complete.




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

相關文章