以前裝過10g的,沒有做筆記,昨天使用duplicate方法裝了個11g ADG,過程艱辛,記錄下:
一、環境配置
主庫
IP地址:192.168.233.128/24
操作系統版本:rhel5.8 64bit
數據庫版本:11.2.0.1 64bit
數據庫sid名:orcl
數據庫名:orcl
數據庫db_unique_name:orcl1
主機名:pr
物理備庫
IP地址:192.168.233.129/24
操作系統版本:rhel5.8 64bit
數據庫版本:11.2.0.1 64bit
數據庫sid名:orcl
數據庫名:orcl
數據庫db_unique_name:orcl2
主機名:st
二、修改主備庫listener.ora,tnsnames.ora文件如下
[oracle@pr admin]$ more listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = pr)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
[oracle@pr admin]$ more tnsnames.ora
orcl1=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.233.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl1)
)
)
orcl2=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.233.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl2)
)
)
[oracle@st admin]$ more listener.ora
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = st)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1521))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(GLOBAL_DBNAME = orcl2)
(ORACLE_HOME = /export/11g/product)
(SID_NAME = orcl)
)
)
[oracle@st admin]$ more tnsnames.ora
orcl1=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.233.128)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl1)
)
)
orcl2=
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.233.129)(PORT = 1521))
)
(CONNECT_DATA =
(SERVICE_NAME = orcl2)
)
)
三、修改主庫、備庫的pfile文件,紅色部分為新增加的部分。
[oracle@pr dbs]$ more initorcl.ora[oracle@st dbs]$ more initorcl.ora
四、在備庫上創建相應的目錄
如udump/,oradate/
五、將備庫啟動到nomount狀態,然後連接主庫進行duplicate操作
[oracle@st dbs]rman targetsys/oracle@orcl1 auxiliarysys/oracle@orcl2
RMAN> duplicate target database for standby from activedatabase nofilenamecheck;
Starting Duplicate Db at 10-NOV-14
using target databasecontrol file instead of recovery catalog
allocated channel:ORA_AUX_DISK_1
channel ORA_AUX_DISK_1:SID=20 device type=DISK
contents of MemoryScript:
{
backup as copy reuse
targetfile '/export/11g/product/dbs/orapworcl' auxiliary format
'/export/11g/product/dbs/orapworcl' ;
}
executing Memory Script
Starting backup at 10-NOV-14
allocated channel:ORA_DISK_1
channel ORA_DISK_1:SID=43 device type=DISK
Finished backup at10-NOV-14
contents of MemoryScript:
{
backup as copy current controlfile forstandby auxiliary format '/export/11g/oradata/orcl/control01.ctl';
restore clone controlfile to '/export/11g/flash_recovery_area/orcl/control02.ctl' from
'/export/11g/oradata/orcl/control01.ctl';
}
executing Memory Script
Starting backup at 10-NOV-14
using channel ORA_DISK_1
channel ORA_DISK_1:starting datafile copy
copying standby controlfile
output filename=/export/11g/product/dbs/snapcf_orcl.f tag=TAG20141110T094600 RECID=5STAMP=863257560
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:03
Finished backup at10-NOV-14
Starting restore at 10-NOV-14
using channelORA_AUX_DISK_1
channel ORA_AUX_DISK_1:copied control file copy
Finished restore at10-NOV-14
contents of MemoryScript:
{
sql clone 'alter database mount standbydatabase';
}
executing Memory Script
sql statement: alterdatabase mount standby database
contents of MemoryScript:
{
set newname for tempfile 1 to
"/export/11g/oradata/orcl/temp01.dbf";
switch clone tempfile all;
set newname for datafile 1 to
"/export/11g/oradata/orcl/system01.dbf";
set newname for datafile 2 to
"/export/11g/oradata/orcl/sysaux01.dbf";
set newname for datafile 3 to
"/export/11g/oradata/orcl/undotbs01.dbf";
set newname for datafile 4 to
"/export/11g/oradata/orcl/users01.dbf";
set newname for datafile 5 to
"/export/11g/oradata/orcl/example01.dbf";
backup as copy reuse
datafile 1 auxiliary format
"/export/11g/oradata/orcl/system01.dbf" datafile
2 auxiliary format
"/export/11g/oradata/orcl/sysaux01.dbf" datafile
3 auxiliary format
"/export/11g/oradata/orcl/undotbs01.dbf" datafile
4 auxiliary format
"/export/11g/oradata/orcl/users01.dbf" datafile
5 auxiliary format
"/export/11g/oradata/orcl/example01.dbf" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SETNEWNAME
renamed tempfile 1 to/export/11g/oradata/orcl/temp01.dbf in control file
executing command: SETNEWNAME
executing command: SETNEWNAME
executing command: SETNEWNAME
executing command: SETNEWNAME
executing command: SETNEWNAME
Starting backup at 10-NOV-14
using channel ORA_DISK_1
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00001 name=/export/11g/oradata/orcl/system01.dbf
output filename=/export/11g/oradata/orcl/system01.dbf tag=TAG20141110T094610
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:56
channel ORA_DISK_1: startingdatafile copy
input datafile filenumber=00002 name=/export/11g/oradata/orcl/sysaux01.dbf
output filename=/export/11g/oradata/orcl/sysaux01.dbf tag=TAG20141110T094610
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:35
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00005 name=/export/11g/oradata/orcl/example01.dbf
output filename=/export/11g/oradata/orcl/example01.dbf tag=TAG20141110T094610
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:16
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00003 name=/export/11g/oradata/orcl/undotbs01.dbf
output filename=/export/11g/oradata/orcl/undotbs01.dbf tag=TAG20141110T094610
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:07
channel ORA_DISK_1:starting datafile copy
input datafile filenumber=00004 name=/export/11g/oradata/orcl/users01.dbf
output filename=/export/11g/oradata/orcl/users01.dbf tag=TAG20141110T094610
channel ORA_DISK_1:datafile copy complete, elapsed time: 00:00:07
Finished backup at10-NOV-14
sql statement: altersystem archive log current
contents of MemoryScript:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched todatafile copy
input datafile copyRECID=5 STAMP=863257693 file name=/export/11g/oradata/orcl/system01.dbf
datafile 2 switched todatafile copy
input datafile copyRECID=6 STAMP=863257694 file name=/export/11g/oradata/orcl/sysaux01.dbf
datafile 3 switched todatafile copy
input datafile copyRECID=7 STAMP=863257694 file name=/export/11g/oradata/orcl/undotbs01.dbf
datafile 4 switched todatafile copy
input datafile copyRECID=8 STAMP=863257694 file name=/export/11g/oradata/orcl/users01.dbf
datafile 5 switched todatafile copy
input datafile copyRECID=9 STAMP=863257694 file name=/export/11g/oradata/orcl/example01.dbf
Finished Duplicate Db at10-NOV-14
RMAN> exit
Recovery Managercomplete.
至此備庫創建完成。
期間遇到很多的問題,現在總結如下:
1、執行[oracle@st dbs]rman target sys/oracle@orcl1 auxiliarysys/oracle@orcl2時候,提示不能連接到orcl1,但是能ping同pr,原來是防火牆沒有開通過
2、tnsname.ora文件中service_name 與連接對端的監聽中的service_name相對應。
3、備庫中的配置了靜態監聽,具體原因參見:http://blog.itpub.net/23135684/viewspace-692707
4、執行duplicate target database for standby from active database nofilenamecheck;運行過程中出現了以下錯誤,是因為缺少文中的第四步,沒有在備庫上創建相應的目錄。
RMAN> duplicate target database for standby from active database;
Starting Duplicate Db at 10-NOV-14
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=19 device type=DISK
……省略
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '/export/11g/oradata/orcl/control01.ctl';
restore clone controlfile to '/export/11g/flash_recovery_area/orcl/control02.ctl' from
'/export/11g/oradata/orcl/control01.ctl';
}
executing Memory Script
Starting backup at 10-NOV-14
using channel ORA_DISK_1
channel ORA_DISK_1: starting datafile copy
copying standby control file
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/10/2014 09:24:29
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 11/10/2014 09:24:29
ORA-17628: Oracle error 19505 returned by remote Oracle server
5、執行duplicate target database for standby from active database nofilenamecheck;,運行過程中出現了以下錯誤,是因為沒有使用nofilenamecheck。
RMAN> duplicate target database for standby from active database;
Starting Duplicate Db at 10-NOV-14
using channel ORA_AUX_DISK_1
…… …… 省略
contents of Memory Script:
{
sql clone 'alter database mount standby database';
}
executing Memory Script
sql statement: alter database mount standby database
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 11/10/2014 09:33:14
RMAN-05501: aborting duplication of target database
RMAN-05001: auxiliary file name /export/11g/oradata/orcl/example01.dbf conflicts with a file used by the target database
RMAN-05001: auxiliary file name /export/11g/oradata/orcl/users01.dbf conflicts with a file used by the target database
RMAN-05001: auxiliary file name /export/11g/oradata/orcl/undotbs01.dbf conflicts with a file used by the target database
RMAN-05001: auxiliary file name /export/11g/oradata/orcl/sysaux01.dbf conflicts with a file used by the target database
RMAN-05001: auxiliary file name /export/11g/oradata/orcl/system01.dbf conflicts with a file used by the target database