Chinaunix首页 | 论坛 | 博客
  • 博客访问: 29300
  • 博文数量: 14
  • 博客积分: 1400
  • 博客等级: 上尉
  • 技术积分: 180
  • 用 户 组: 普通用户
  • 注册时间: 2008-11-03 12:58
文章分类

全部博文(14)

文章存档

2011年(1)

2010年(1)

2009年(12)

我的朋友

分类: Oracle

2009-06-18 11:10:30

STANDBY数据库同样是RAC环境,不过和主数据库采用VOLUMN CLUSTER MANAGER不同,STANDBY数据库采用ASM。
在源数据库中设置FORCE_LOGGING和相应的初始化参数:
SQL> SELECT DBID, NAME, LOG_MODE, FORCE_LOGGING FROM V$DATABASE;
DBID NAME LOG_MODE FOR
---------- --------- ------------ ---
1712482917 RAC11G ARCHIVELOG NO
SQL> ALTER DATABASE FORCE LOGGING;
数据库已更改。
SQL> ALTER SYSTEM SET LOG_ARCHIVE_CONFIG='DG_CONFIG=(rac11g,rac11g_s)';
系统已更改。
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_1=
2 'LOCATION=/data/oracle/oradata/rac11g/archivelog/ VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g';
系统已更改。
SQL> ALTER SYSTEM SET LOG_ARCHIVE_DEST_2='SERVICE=rac11g_s LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g_s';
系统已更改。
SQL> ALTER SYSTEM SET FAL_SERVER=rac11g_s;
系统已更改。
SQL> ALTER SYSTEM SET FAL_CLIENT=rac11g;
系统已更改。
SQL> ALTER SYSTEM SET STANDBY_FILE_MANAGEMENT=AUTO;
系统已更改。
手工在源数据库的两个节点分别添加访问STANDBY数据库的服务名,以及在STANDBY数据库恢复过程中临时使用的服务名:
RAC11G_S =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.2.68)(PORT = 1521))
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.2.69)(PORT = 1521))
(LOAD_BALANCE = yes)
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rac11g_s.us.oracle.com)
)
)
RAC11G1_S =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.2.62)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = rac11g1)
)
)
同样,在STANDBY数据库的TNSNAMES.ORA中也要添加STANDBY和PRIMARY数据库的服务名。
STANDBY数据库的Oracle rac环境已经建立,ASM也已经启动,数据库版本时11g,本打算采用FROM ACTIVE DATABASE方式创建STANDBY,但是这种方式对于源数据库为裸设备,目标数据库使用ASM的情况存在很多的bug,所以仍然使用备份恢复的方法。
首先检查当前环境:
$ env|grep ORA
ORACLE_BASE=/data/oracle
ORACLE_HOME=/data/oracle/product/11.1/database
ORACLE_SID=rac11g1
编辑初始化参数,创建spfile,启动AUXILIARY实例:
rac11g1.__db_cache_size=13757317120
rac11g2.__db_cache_size=13623099392
rac11g2.__java_pool_size=67108864
rac11g1.__java_pool_size=134217728
rac11g2.__large_pool_size=67108864
rac11g1.__large_pool_size=67108864
rac11g1.__oracle_base='/data/oracle'#ORACLE_BASE set from environment
rac11g2.__oracle_base='/data/oracle'#ORACLE_BASE set from environment
rac11g2.__pga_aggregate_target=2147483648
rac11g1.__pga_aggregate_target=2147483648
rac11g2.__sga_target=15032385536
rac11g1.__sga_target=15032385536
rac11g2.__shared_io_pool_size=0
rac11g1.__shared_io_pool_size=0
rac11g1.__shared_pool_size=1006632960
rac11g2.__shared_pool_size=1207959552
rac11g2.__streams_pool_size=0
rac11g1.__streams_pool_size=0
*.audit_file_dest='/data/oracle/admin/rac11g/adump'
*.audit_trail='db'
*.cluster_database_instances=2
*.cluster_database=true
*.compatible='11.1.0.0.0'
*.control_files='+DATA/RAC11G/rac11g_control_1','+DATA/RAC11G/rac11g_control_2','+DATA/RAC11G/rac11g_control_3'
*.db_block_size=16384
*.db_domain='us.oracle.com'
*.db_name='rac11g'
*.diagnostic_dest='/data/oracle'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=rac11gXDB)'
fal_client='RAC11G_S'
fal_server='RAC11G'
log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
db_unique_name='rac11g_s'
rac11g2.instance_number=2
rac11g1.instance_number=1
rac11g1.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.0.2.62)(PORT=1521))'
rac11g2.local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=172.0.2.63)(PORT=1521))'
*.log_archive_config='DG_CONFIG=(rac11g,rac11g_s)'
*.log_archive_format='%t_%s_%r.dbf'
*.memory_target=17179869184
*.open_cursors=300
*.pga_aggregate_target=2147483648
*.processes=600
*.remote_listener='LISTENERS_RAC11G'
*.remote_login_passwordfile='exclusive'
*.sessions=600
rac11g1.sga_target=15032385536
*.sga_target=15032385536
rac11g2.sga_target=15032385536
*.standby_file_management='AUTO'
rac11g2.thread=2
rac11g1.thread=1
rac11g2.undo_tablespace='UNDOTBS2'
rac11g1.undo_tablespace='UNDOTBS1'
db_file_name_convert=('/dev/vx/rdsk/datavg', '+DATA/RAC11G')
log_file_name_convert=('/dev/vx/rdsk/datavg', '+DATA/RAC11G')
下面通过这个初始化参数启动实例:
bash-3.00$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.1.0.6.0 - Production on 星期二 9月 9 18:29:34 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
已连接到空闲例程。
SQL> create spfile from pfile='/data/initrac11g.ora';
文件已创建。
SQL> startup nomount
ORACLE 例程已经启动。
Total System Global Area 1.7108E+10 bytes
Fixed Size 2101632 bytes
Variable Size 3344420480 bytes
Database Buffers 1.3757E+10 bytes
Redo Buffers 4431872 bytes
SQL> exit
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options 断开
和DUPLICATE RAC环境一样的问题,由于本地备份集是存放在ASM中,因此只能通过CATALOG方式,手工修改CATALOG中BACKUP PIECE的HANDLE记录,将其改为目标数据库上ASM中备份集的全路径:
SQL> conn catalog_user/catalog_user已连接。
SQL> col handle format a60
SQL> select bp_key, handle from rc_backup_piece;
BP_KEY HANDLE
---------- ------------------------------------------------------------
1475 /data/01jpk0bj_1_1
SQL> update rc_backup_piece set handle = '+DATA/backup/01jpk0bj_1_1'
2 where bp_key = 1475;
已更新 1 行。
SQL> commit;
提交完成。
确保源数据库的归档日志,在STANDBY数据库中的相同目录下可以被访问,然后通过RMAN来执行DUPLICATE命令:
bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com catalog catalog_user/catalog_user@172.0.2.61/test11g.netdb auxiliary /
Recovery Manager: Release 11.1.0.6.0 - Production on Wed Sep 10 10:02:15 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to recovery catalog database
connected to auxiliary database: RAC11G (not mounted)
RMAN> duplicate target database for standby
2> dorecover;
Starting Duplicate Db at 10-SEP-08
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=660 instance=rac11g1 device type=DISK
contents of Memory Script:
{
set until scn 29148537;
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
executing command: SET until clause
Starting restore at 10-SEP-08
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: restoring control file
ORA-19625: error identifying file /data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
ORA-19600: input file is control file (/data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f)
ORA-19601: output file is control file (+DATA/rac11g/rac11g_control_1)
failover to previous backup
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: restoring control file
channel ORA_AUX_DISK_1: reading from backup piece +DATA/backup/01jpk0bj_1_1
channel ORA_AUX_DISK_1: piece handle=+DATA/backup/01jpk0bj_1_1 tag=TAG20080902T204539
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 00:00:03
output file name=+DATA/rac11g/rac11g_control_1
output file name=+DATA/rac11g/rac11g_control_2
output file name=+DATA/rac11g/rac11g_control_3
Finished restore at 10-SEP-08
sql statement: alter database mount standby database
contents of Memory Script:
{
set until scn 29148537;
set newname for tempfile 1 to
"+DATA/rac11g/rac11g_temp_1_4g";
set newname for tempfile 2 to
"+DATA/rac11g/rac11g_temp_2_16g";
switch clone tempfile all;
set newname for datafile 1 to
"+DATA/rac11g/rac11g_system_1_1g";
set newname for datafile 2 to
"+DATA/rac11g/rac11g_sysaux_1_1g";
set newname for datafile 3 to
"+DATA/rac11g/rac11g_undotbs1_1_4g";
set newname for datafile 4 to
"+DATA/rac11g/rac11g_undotbs2_1_4g";
set newname for datafile 5 to
"+DATA/rac11g/rac11g_users_1_4g";
set newname for datafile 6 to
"+DATA/rac11g/rac11g_ndmain_1_32g";
set newname for datafile 7 to
"+DATA/rac11g/rac11g_ndmain_2_32g";
set newname for datafile 8 to
"+DATA/rac11g/rac11g_ndmain_3_32g";
set newname for datafile 9 to
"+DATA/rac11g/rac11g_ndmain_4_32g";
set newname for datafile 10 to
"+DATA/rac11g/rac11g_ndmain_5_32g";
set newname for datafile 11 to
"+DATA/rac11g/rac11g_ndmain_6_32g";
set newname for datafile 12 to
"+DATA/rac11g/rac11g_undotbs1_2_32g";
set newname for datafile 13 to
"+DATA/rac11g/rac11g_undotbs2_2_32g";
set newname for datafile 14 to
"+DATA/rac11g/rac11g_perfstat_1_8g";
restore
clone database
;
}
executing Memory Script
executing command: SET until clause
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to +DATA/rac11g/rac11g_temp_1_4g in control file
renamed tempfile 2 to +DATA/rac11g/rac11g_temp_2_16g in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting restore at 10-SEP-08
using channel ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: starting datafile backup set restore
channel ORA_AUX_DISK_1: specifying datafile(s) to restore from backup set
channel ORA_AUX_DISK_1: restoring datafile 00001 to +DATA/rac11g/rac11g_system_1_1g
channel ORA_AUX_DISK_1: restoring datafile 00002 to +DATA/rac11g/rac11g_sysaux_1_1g
channel ORA_AUX_DISK_1: restoring datafile 00003 to +DATA/rac11g/rac11g_undotbs1_1_4g
channel ORA_AUX_DISK_1: restoring datafile 00004 to +DATA/rac11g/rac11g_undotbs2_1_4g
channel ORA_AUX_DISK_1: restoring datafile 00005 to +DATA/rac11g/rac11g_users_1_4g
channel ORA_AUX_DISK_1: restoring datafile 00006 to +DATA/rac11g/rac11g_ndmain_1_32g
channel ORA_AUX_DISK_1: restoring datafile 00007 to +DATA/rac11g/rac11g_ndmain_2_32g
channel ORA_AUX_DISK_1: restoring datafile 00008 to +DATA/rac11g/rac11g_ndmain_3_32g
channel ORA_AUX_DISK_1: restoring datafile 00009 to +DATA/rac11g/rac11g_ndmain_4_32g
channel ORA_AUX_DISK_1: restoring datafile 00010 to +DATA/rac11g/rac11g_ndmain_5_32g
channel ORA_AUX_DISK_1: restoring datafile 00011 to +DATA/rac11g/rac11g_ndmain_6_32g
channel ORA_AUX_DISK_1: restoring datafile 00012 to +DATA/rac11g/rac11g_undotbs1_2_32g
channel ORA_AUX_DISK_1: restoring datafile 00013 to +DATA/rac11g/rac11g_undotbs2_2_32g
channel ORA_AUX_DISK_1: restoring datafile 00014 to +DATA/rac11g/rac11g_perfstat_1_8g
channel ORA_AUX_DISK_1: reading from backup piece +DATA/backup/01jpk0bj_1_1
channel ORA_AUX_DISK_1: piece handle=+DATA/backup/01jpk0bj_1_1 tag=TAG20080902T204539
channel ORA_AUX_DISK_1: restored backup piece 1
channel ORA_AUX_DISK_1: restore complete, elapsed time: 01:02:59
Finished restore at 10-SEP-08
contents of Memory Script:
{
switch clone datafile all;
}
executing Memory Script
datafile 1 switched to datafile copy
input datafile copy RECID=1 STAMP=665060742 file name=+DATA/rac11g/rac11g_system_1_1g
datafile 2 switched to datafile copy
input datafile copy RECID=2 STAMP=665060742 file name=+DATA/rac11g/rac11g_sysaux_1_1g
datafile 3 switched to datafile copy
input datafile copy RECID=3 STAMP=665060743 file name=+DATA/rac11g/rac11g_undotbs1_1_4g
datafile 4 switched to datafile copy
input datafile copy RECID=4 STAMP=665060743 file name=+DATA/rac11g/rac11g_undotbs2_1_4g
datafile 5 switched to datafile copy
input datafile copy RECID=5 STAMP=665060743 file name=+DATA/rac11g/rac11g_users_1_4g
datafile 6 switched to datafile copy
input datafile copy RECID=6 STAMP=665060743 file name=+DATA/rac11g/rac11g_ndmain_1_32g
datafile 7 switched to datafile copy
input datafile copy RECID=7 STAMP=665060743 file name=+DATA/rac11g/rac11g_ndmain_2_32g
datafile 8 switched to datafile copy
input datafile copy RECID=8 STAMP=665060743 file name=+DATA/rac11g/rac11g_ndmain_3_32g
datafile 9 switched to datafile copy
input datafile copy RECID=9 STAMP=665060743 file name=+DATA/rac11g/rac11g_ndmain_4_32g
datafile 10 switched to datafile copy
input datafile copy RECID=10 STAMP=665060743 file name=+DATA/rac11g/rac11g_ndmain_5_32g
datafile 11 switched to datafile copy
input datafile copy RECID=11 STAMP=665060743 file name=+DATA/rac11g/rac11g_ndmain_6_32g
datafile 12 switched to datafile copy
input datafile copy RECID=12 STAMP=665060743 file name=+DATA/rac11g/rac11g_undotbs1_2_32g
datafile 13 switched to datafile copy
input datafile copy RECID=13 STAMP=665060743 file name=+DATA/rac11g/rac11g_undotbs2_2_32g
datafile 14 switched to datafile copy
input datafile copy RECID=14 STAMP=665060743 file name=+DATA/rac11g/rac11g_perfstat_1_8g
contents of Memory Script:
{
set until scn 29148537;
recover
standby
clone database
delete archivelog
;
}
executing Memory Script
executing command: SET until clause
Starting recover at 10-SEP-08
using channel ORA_AUX_DISK_1
starting media recovery
archived log for thread 1 with sequence 528 is already on disk as file /data/oracle/oradata/rac11g/archivelog/1_528_660235173.dbf
archived log for thread 1 with sequence 529 is already on disk as file /data/oracle/oradata/rac11g/archivelog/1_529_660235173.dbf
archived log for thread 1 with sequence 530 is already on disk as file /data/oracle/oradata/rac11g/archivelog/1_530_660235173.dbf
archived log for thread 1 with sequence 531 is already on disk as file /data/oracle/oradata/rac11g/archivelog/1_531_660235173.dbf
archived log for thread 1 with sequence 532 is already on disk as file /data/oracle/oradata/rac11g/archivelog/1_532_660235173.dbf
archived log for thread 2 with sequence 193 is already on disk as file /data/oracle/oradata/rac11g/archivelog/2_193_660235173.dbf
archived log for thread 2 with sequence 194 is already on disk as file /data/oracle/oradata/rac11g/archivelog/2_194_660235173.dbf
archived log for thread 2 with sequence 195 is already on disk as file /data/oracle/oradata/rac11g/archivelog/2_195_660235173.dbf
archived log for thread 2 with sequence 196 is already on disk as file /data/oracle/oradata/rac11g/archivelog/2_196_660235173.dbf
archived log for thread 2 with sequence 197 is already on disk as file /data/oracle/oradata/rac11g/archivelog/2_197_660235173.dbf
archived log file name=/data/oracle/oradata/rac11g/archivelog/1_528_660235173.dbf thread=1 sequence=0
archived log file name=/data/oracle/oradata/rac11g/archivelog/2_193_660235173.dbf thread=2 sequence=0
archived log file name=/data/oracle/oradata/rac11g/archivelog/1_529_660235173.dbf thread=1 sequence=529
archived log file name=/data/oracle/oradata/rac11g/archivelog/2_194_660235173.dbf thread=2 sequence=194
archived log file name=/data/oracle/oradata/rac11g/archivelog/1_530_660235173.dbf thread=1 sequence=530
archived log file name=/data/oracle/oradata/rac11g/archivelog/1_531_660235173.dbf thread=1 sequence=531
archived log file name=/data/oracle/oradata/rac11g/archivelog/2_195_660235173.dbf thread=2 sequence=195
archived log file name=/data/oracle/oradata/rac11g/archivelog/1_532_660235173.dbf thread=1 sequence=532
archived log file name=/data/oracle/oradata/rac11g/archivelog/2_196_660235173.dbf thread=2 sequence=196
archived log file name=/data/oracle/oradata/rac11g/archivelog/2_197_660235173.dbf thread=2 sequence=197
media recovery complete, elapsed time: 00:04:27
Finished recover at 10-SEP-08
Finished Duplicate Db at 10-SEP-08
至此STANDBY数据库的恢复过程已经完成
首先登陆实例,检查数据库状态:
bash-3.00$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.1.0.6.0 - Production on Wed Sep 10 13:56:13 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.

Connected to:
Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL> select instance_name, status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
rac11g1 MOUNTED
SQL> select name,
2 open_mode,
3 database_role,
4 guard_status,
5 db_unique_name,
6 primary_db_unique_name
7 from v$database;
NAME OPEN_MODE DATABASE_ROLE GUARD_S DB_UNIQUE_NAME PRIMARY_DB_UNIQUE_NAME
--------- ---------- ---------------- ------- --------------- -----------------------
RAC11G MOUNTED PHYSICAL STANDBY NONE rac11g_s
下面可以将数据库至于应用归档的状态:
SQL> alter database recover managed standby database
2 disconnect from session;
Database altered.
下面检查归档的是否可以正常发送到STANDBY数据库:
SQL> select sequence#, thread# from v$archived_log order by first_time;
no rows selected
SQL> conn sys/test@rac11g as sysdba
Connected.
SQL> alter system archive log current;
System altered.
SQL> conn / as sysdba
Connected.
SQL> select sequence#, thread# from v$archived_log order by first_time;
SEQUENCE# THREAD#
---------- ----------
533 1
198 2
SQL> select sequence#, thread#, applied from v$archived_log order by first_time;
SEQUENCE# THREAD# APP
---------- ---------- ---
532 1 YES
533 1 NO
198 2 YES
可以看到,两个数据库实例的归档日志文件已经发送到本地节点,而且LGWR进程已经将正在写的当前日志文件533写到了本地。
数据库的STANTDBY机制已经正常运行,下面看看能否将STANDBY数据库的两个实例以只读方式打开:
SQL> alter database recover managed standby database cancel;
Database altered.
SQL> alter database open;
Database altered.
SQL> select instance_name, status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
rac11g1 OPEN
SQL> select name,
2 open_mode,
3 database_role,
4 guard_status,
5 db_unique_name,
6 primary_db_unique_name
7 from v$database;
NAME OPEN_MODE DATABASE_ROLE GUARD_S DB_UNIQUE_NAME PRIMARY_DB_UNIQUE_NAME
--------- ---------- ---------------- ------- --------------- -----------------------
RAC11G READ ONLY PHYSICAL STANDBY NONE rac11g_s rac11g
由于SPFILE目前在本地,需要创建一个ASM上面的参数文件:
SQL> create pfile='/export/home/oracle/initrac11g.ora' from spfile;
File created.
SQL> create spfile='+DATA/RAC11G/spfilerac11g.ora'
2 from pfile='/export/home/oracle/initrac11g.ora';
File created.
下面分别编辑两个节点的$ORACLE_HOME/dbs目录下的初始化参数,使得spfile指向这个刚刚创建的spfile文件:
spfile=+DATA/RAC11G/spfilerac11g.ora
下面登陆节点二,尝试打开第二个实例:
$ sqlplus "/ as sysdba"
SQL*Plus: Release 11.1.0.6.0 - Production on 星期三 9月 10 14:53:09 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
已连接到空闲例程。
SQL> startup
ORACLE 例程已经启动。
Total System Global Area 1.7108E+10 bytes
Fixed Size 2101632 bytes
Variable Size 3478638208 bytes
Database Buffers 1.3623E+10 bytes
Redo Buffers 4431872 bytes
数据库装载完毕。数据库已经打开。
SQL> set pages 100 lines 120
SQL> select instance_name, status from v$instance;
INSTANCE_NAME STATUS
---------------- ------------
rac11g2 OPEN
SQL> select instance_name, status from gv$instance;
INSTANCE_NAME STATUS
---------------- ------------
rac11g2 OPEN
rac11g1 OPEN
SQL> select name,
2 open_mode,
3 database_role,
4 guard_status,
5 db_unique_name,
6 primary_db_unique_name
7 from v$database;
NAME OPEN_MODE DATABASE_ROLE GUARD_S DB_UNIQUE_NAME PRIMARY_DB_UNIQUE_NAME
--------- ---------- ---------------- ------- --------------- ----------------------
RAC11G READ ONLY PHYSICAL STANDBY NONE rac11g_s rac11g
从10g以后,不需要指定MOUNT STANDBY数据库,也不需要指定OPEN READ ONLY,Oracle自动会装载STANDBY数据库,并将实例以READ ONLY方式进行打开。
下面设置一下TEMP表空间:
SQL> alter database tempfile '+DATA/RAC11G/rac11g_temp_1_4g' drop;
Database altered.
SQL> alter tablespace temp add tempfile '+DATA/RAC11G/rac11g_temp_1_4g' size 4096m;
Tablespace altered.
至此RAC环境的STANDBY已经成功建立。
刚刚在进行RAC环境的DUPLICATE DATABASE的时候,就碰到了很多问题,由于二者命令比较相似,本来认为这次不会碰到太多的问题,没有想到的是,这次碰到的问题居然比DUPLICATE碰到的问题多出一倍。而且基本上所有碰到的问题都是DUPLICATE操作时不曾遇到的。
最开始为了减少麻烦,打算采用SPFILE的方式,并且利用FROM ACTIVE DATABASE,这样可以不用读取备份集:
bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com auxiliary /
恢复管理器: Release 11.1.0.6.0 - Production on 星期二 9月 9 14:58:19 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
连接到目标数据库: RAC11G (DBID=1712482917)已连接到辅助数据库: RAC11G (未装载)
RMAN> duplicate target database for standby
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> dorecover
4> from active database
5> spfile
6> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
7> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
8> set log_archive_dest_1='LOCATION=+DATA/RAC11G'
9> ;
启动 Duplicate Db 于 09-9月 -08使用目标数据库控制文件替代恢复目录分配的通道: ORA_AUX_DISK_1通道 ORA_AUX_DISK_1: SID=112 设备类型=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: Duplicate Db 命令 (在 09/09/2008 14:58:26 上) 失败

RMAN-06217: 未使用 Net 服务名连接到辅助数据库
这个RMAN-6217错误居然在metalink上都找不到,不过好在错误的描述比较清晰,只需要通过连接服务名的方式连接辅助实例即可。
继续尝试:
bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com auxiliary sys/test@rac11g1
恢复管理器: Release 11.1.0.6.0 - Production on 星期二 9月 9 15:16:52 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
连接到目标数据库: RAC11G (DBID=1712482917)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: 内部恢复管理器程序包初始化失败

RMAN-04006: 来自辅助数据库的错误: ORA-12514: TNS: 监听程序当前无法识别连接描述符中请求的服务
不过这里引发一个问题,由于10g以上默认采用动态注册,由于数据库没有启动,因此动态注册无法启用,没有办法通过服务名连接,只能手工编辑一个SID列表,添加到listener.ora文件中:
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = rac11g1)
(ORACLE_HOME = /data/oracle/product/11.1/database)
)
)
下面重启监听:
$ lsnrctl stop
LSNRCTL for Solaris: Version 11.1.0.6.0 - Production on 09-9月 -2008 15:20:43
Copyright (c) 1991, 2007, Oracle. All rights reserved.
正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))命令执行成功
$ lsnrctl start
LSNRCTL for Solaris: Version 11.1.0.6.0 - Production on 09-9月 -2008 15:20:55
Copyright (c) 1991, 2007, Oracle. All rights reserved.
启动/data/oracle/product/11.1/database/bin/tnslsnr: 请稍候...
TNSLSNR for Solaris: Version 11.1.0.6.0 - Production系统参数文件为/data/oracle/product/11.1/database/network/admin/listener.ora写入/data/oracle/diag/tnslsnr/ser1/listener/alert/log.xml的日志信息监听: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ser1)(PORT=1521)))
正在连接到 (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
LISTENER 的
STATUS
------------------------别名
LISTENER版本 TNSLSNR for Solaris: Version 11.1.0.6.0 - Production启动日期 09-9月 -2008 15:20:55正常运行时间 0 天 0 小时 0 分 0 秒跟踪级别 off安全性 ON: Local OS Authentication
SNMP OFF监听程序参数文件
/data/oracle/product/11.1/database/network/admin/listener.ora监听程序日志文件 /data/oracle/diag/tnslsnr/ser1/listener/alert/log.xml监听端点概要...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ser1)(PORT=1521)))服务摘要
..服务 "rac11g1" 包含 1 个例程。
例程 "rac11g1", 状态 UNKNOWN, 包含此服务的 1 个处理程序...命令执行成功
再次连接错误依旧,这是由于默认配置的RAC环境的TNSNAMES中的服务名对当前不适用,添加一个新的服务名:
RAC11G1_S =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.2.62)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = rac11g1)
)
)
再次连接,报错没有权限:
bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com auxiliary sys/test@rac11g1_s
恢复管理器: Release 11.1.0.6.0 - Production on 星期二 9月 9 15:30:17 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
连接到目标数据库: RAC11G (DBID=1712482917)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: 内部恢复管理器程序包初始化失败

RMAN-04006: 来自辅助数据库的错误: ORA-01031: insufficient privileges
最简单的办法是拷贝源数据库的初始化参数文件到当前的节点的$ORACLE_HOME/dbs目录中,拷贝完成后,终于可以成功连接RMAN:
bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com auxiliary sys/test@rac11g1_s
恢复管理器: Release 11.1.0.6.0 - Production on 星期二 9月 9 15:37:02 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
连接到目标数据库: RAC11G (DBID=1712482917)已连接到辅助数据库: RAC11G (未装载)
执行DUPLICATE时报错:
RMAN> duplicate target database for standby
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> dorecover
4> from active database
5> spfile
6> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
7> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
8> set log_archive_dest_1='LOCATION=+DATA/RAC11G'
9> ;
启动 Duplicate Db 于 09-9月 -08使用目标数据库控制文件替代恢复目录分配的通道: ORA_AUX_DISK_1通道 ORA_AUX_DISK_1: SID=37 设备类型=DISK
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: Duplicate Db 命令 (在 09/09/2008 15:38:01 上) 失败

RMAN-06764: Must specify db_unique_name with FOR STANDBY
由于DUPLICATE创建STANDBY的时候会根据命令中指定的参数和源数据库的参数创建出STANDBY数据库的初始化参数,因此这里需要指明DB_UNIQUE_NAME参数,如此之外,应该把所有STANDBY数据库使用的参数配置完成。
除此之外,应该保证STANDBY数据库中配置了源数据库服务名RAC11G,而源数据库中配置了STANDBY数据库服务名RAC11G_S。
再次执行DUPLICATE操作:
RMAN> duplicate target database for standby
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> dorecover
4> from active database
5> spfile
6> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
7> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
8> set fal_client='RAC11G_S'
9> set fal_server='RAC11G'
10> set log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
11> set log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
12> set standby_archive_dest='+DATA/RAC11G'
13> set db_unique_name='rac11g_s'
14> ;
启动 Duplicate Db 于 09-9月 -08使用通道 ORA_AUX_DISK_1
内存脚本的内容:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g2' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' file
'/dev/vx/rdsk/datavg/rac11g_spfile' auxiliary format
'+DATA/rac11g/spfilerac11g.ora' ;
sql clone "alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''";
}正在执行内存脚本
启动 backup 于 09-9月 -08分配的通道: ORA_DISK_1通道 ORA_DISK_1: SID=484 实例=rac11g2 设备类型=DISK
DBGANY: Mismatched message length! [16:06:39.742] (krmiduem)
DBGANY: Mismatched message length! [16:06:39.744] (krmiduem)
MAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00601: fatal error in recovery manager
RMAN-03004: 执行命令期间出现严重错误

RMAN-00600: internal error, arguments [3045] [] [] [] []
RMAN-03009: backup
命令 (ORA_DISK_1 通道上, 在 09/09/2008 16:06:39 上) 失败
ORA-17629: 无法连接到远程数据库服务器
ORA-17627: ORA-12154: TNS: 无法解析指定的连接标识符
ORA-17629: 无法连接到远程数据库服务器
这个错误是由于配置源数据库时没有使用VIP地址,而指定了一个实例的PUBLIC地址,这里应该使用VIP,确保RMAN可以同时连接到两个实例上:
bash-3.00$ rman target sys/test@rac11g auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 16:11:23 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11G (not mounted)
RMAN> duplicate target database for standby
2> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
3> dorecover
4> from active database
5> spfile
6> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
7> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
8> set fal_client='RAC11G_S'
9> set fal_server='RAC11G'
10> set log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
11> set log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
12> set standby_archive_dest='+DATA/RAC11G'
13> set db_unique_name='rac11g_s'
;
14>
Starting Duplicate Db at 09-SEP-08
using target database control file instead of recovery catalog
allocated channel: ORA_AUX_DISK_1
channel ORA_AUX_DISK_1: SID=38 device type=DISK
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g2' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' file
'/dev/vx/rdsk/datavg/rac11g_spfile' auxiliary format
'+DATA/rac11g/spfilerac11g.ora' ;
sql clone "alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''";
}
executing Memory Script
Starting backup at 09-SEP-08
allocated channel: ORA_DISK_1
channel ORA_DISK_1: SID=611 instance=rac11g1 device type=DISK
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 09/09/2008 16:11:41
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server
continuing other job steps, job failed will not be re-run
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 16:11:41
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on ORA_DISK_1 channel at 09/09/2008 16:11:41
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server
采用本地配置的LOAD_BALANCE服务名,仍然出现上面的错误,看来最好的方式还是通过ALLOCATE CHANNEL的方式手工分配CHANNEL:
bash-3.00$ rman target sys/test@rac11g auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 16:17:44 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11G (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect 'sys/test@rac11g1';
4> allocate channel c2 device type disk connect 'sys/test@rac11g2';
5> allocate auxiliary channel ac1 device type disk;
6> allocate auxiliary channel ac2 device type disk;
7> duplicate target database for standby
8> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
9> dorecover
10> from active database
11> spfile
12> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
13> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
14> set fal_client='RAC11G_S'
15> set fal_server='RAC11G'
16> set log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
17> set log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
18> set standby_archive_dest='+DATA/RAC11G'
19> set db_unique_name='rac11g_s';
20> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=285 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=119 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=39 device type=DISK
allocated channel: ac2
channel ac2: SID=36 device type=DISK
Starting Duplicate Db at 09-SEP-08
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g2' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' file
'/dev/vx/rdsk/datavg/rac11g_spfile' auxiliary format
'+DATA/rac11g/spfilerac11g.ora' ;
sql clone "alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''";
}
executing Memory Script
Starting backup at 09-SEP-08
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 16:18:44
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server
continuing other job steps, job failed will not be re-run
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 16:18:44
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on c2 channel at 09/09/2008 16:18:44
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-12154: TNS:could not resolve the connect identifier specified
ORA-17629: Cannot connect to the remote database server
RMAN> exit

Recovery Manager complete.
这个错误是由于远端配置的tnsnames.ora中存在问题,尝试在源数据库连接目标数据库环境也报错ORA-12154,增加RAC11G1_S服务名后,问题解决:
RAC11G1_S =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 172.0.2.62)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SID = rac11g1)
)
)
刚刚在进行RAC环境的DUPLICATE DATABASE的时候,就碰到了很多问题,由于二者命令比较相似,本来认为这次不会碰到太多的问题,没有想到的是,这次碰到的问题居然比DUPLICATE碰到的问题多出一倍。而且基本上所有碰到的问题都是DUPLICATE操作时不曾遇到的。
执行DUPLICATE DATABASE FOR STANDBY时出现下面的错误:
bash-3.00$ rman target sys/test@rac11g auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 16:28:54 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11G (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk;
6> allocate auxiliary channel ac2 device type disk;
7> duplicate target database for standby
8> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
9> dorecover
10> from active database
11> spfile
12> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
13> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
14> set fal_client='RAC11G_S'
15> set fal_server='RAC11G'
16> set log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
17> set log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
18> set standby_archive_dest='+DATA/RAC11G'
19> set db_unique_name='rac11g_s';
20> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=619 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=119 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=112 device type=DISK
allocated channel: ac2
channel ac2: SID=39 device type=DISK
Starting Duplicate Db at 09-SEP-08
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g2' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' file
'/dev/vx/rdsk/datavg/rac11g_spfile' auxiliary format
'+DATA/rac11g/spfilerac11g.ora' ;
sql clone "alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''";
}
executing Memory Script
Starting backup at 09-SEP-08
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 16:29:06
ORA-19505: failed to identify file "/data/oracle/product/11.1/database/dbs/orapwrac11g2"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
continuing other job steps, job failed will not be re-run
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 16:29:08
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 16:29:06
ORA-19505: failed to identify file "/data/oracle/product/11.1/database/dbs/orapwrac11g2"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
RMAN> exit

Recovery Manager complete.
这个错误是由于连接源数据库的服务名采用了RAC的总体配置,因此很可能连接到实例2上进行恢复,有两种方法解决这个问题,一个是在任意节点上保证密码文件orapwrac11g1和orapwrac11g2都存在,另一种方法更加简单,可以连接源数据库的时候指定唯一一个实例进行连接,比如这里将RAC11G替换为RAC11G1。
bash-3.00$ rman target sys/test@rac11g auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 16:31:00 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11G (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk;
6> allocate auxiliary channel ac2 device type disk;
7> duplicate target database for standby
8> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
9> dorecover
10> from active database
11> spfile
12> parameter_value_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
13> set log_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G'
14> set fal_client='RAC11G_S'
15> set fal_server='RAC11G'
16> set log_archive_dest_1='LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'
17> set log_archive_dest_2='SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'
18> set standby_archive_dest='+DATA/RAC11G'
19> set db_unique_name='rac11g_s';
20> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=619 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=119 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=113 device type=DISK
allocated channel: ac2
channel ac2: SID=39 device type=DISK
Starting Duplicate Db at 09-SEP-08
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g2' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' file
'/dev/vx/rdsk/datavg/rac11g_spfile' auxiliary format
'+DATA/rac11g/spfilerac11g.ora' ;
sql clone "alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''";
}
executing Memory Script
Starting backup at 09-SEP-08
Finished backup at 09-SEP-08
sql statement: alter system set spfile= ''+DATA/rac11g/spfilerac11g.ora''
contents of Memory Script:
{
sql clone "alter system set log_file_name_convert =
''/dev/vx/rdsk/datavg'', ''+DATA/RAC11G'' comment=
'''' scope=spfile";
sql clone "alter system set fal_client =
''RAC11G_S'' comment=
'''' scope=spfile";
sql clone "alter system set fal_server =
''RAC11G'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_1 =
''LOCATION=+DATA/RAC11G VALID_FOR=(ALL_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac11g_s'' comment=
'''' scope=spfile";
sql clone "alter system set log_archive_dest_2 =
''SERVICE=rac11g LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac11g'' comment=
'''' scope=spfile";
sql clone "alter system set standby_archive_dest =
''+DATA/RAC11G'' comment=
'''' scope=spfile";
sql clone "alter system set db_unique_name =
''rac11g_s'' comment=
'''' scope=spfile";
shutdown clone immediate;
startup clone nomount ;
}
executing Memory Script
sql statement: alter system set log_file_name_convert = ''/dev/vx/rdsk/datavg'', ''+DATA/RAC11G'' comment= '''' scope=spfile
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 16:31:11
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of sql command on clone_default channel at 09/09/2008 16:31:11
RMAN-11003: failure during parse/execution of SQL statement: alter system set log_file_name_convert = '/dev/vx/rdsk/datavg', '+DATA/RAC11G' comment= '' scope=spfile
ORA-17510: Attempt to do i/o beyond file size
ORA-17510: Attempt to do i/o beyond file size
RMAN> exit

Recovery Manager complete.
检查了一下,这个问题应该是ASM的bug造成的。关于ORA-17510的错误有一些,但是没有和当前情况相似的。
由于找不到解决这个问题的办法,只好想办法绕过这个bug。于是从这里以后,采用了先在本地创建一个SPFILE的方式,将所有需要修改的参数都提前修改完成,避免在DUPLICATE命令的时候设置SPFILE参数。这样Oracle就不会执行ALTER SYSTEM语句,也就不会导致SPFILE的动态扩展。
随后利用SQLPLUS创建了本地的SPFILE,然后启动到NOMOUNT状态,通过RMAN连接却报错:
bash-3.00$ rman target sys/test@rac11g auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 16:44:09 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-00554: initialization of internal recovery manager package failed
RMAN-04006: error from auxiliary database: ORA-01031: insufficient privileges
这是因为RMAN刚才的恢复操作覆盖了密码文件,所以这里必须重建。从源数据库再次拷贝密码文件到本地,再次执行:
bash-3.00$ rman target sys/test@rac11g auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 17:25:24 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11GS (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk;
6> allocate auxiliary channel ac2 device type disk;
7> duplicate target database for standby
8> dorecover
9> from active database;
10> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=621 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=628 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=333 instance=rac11g1 device type=DISK
allocated channel: ac2
channel ac2: SID=306 instance=rac11g1 device type=DISK
Starting Duplicate Db at 09-SEP-08
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g1' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' ;
}
executing Memory Script
Starting backup at 09-SEP-08
Finished backup at 09-SEP-08
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '+DATA/rac11g/rac11g_control_1';
restore clone controlfile to '+DATA/rac11g/rac11g_control_2' from
'+DATA/rac11g/rac11g_control_1';
restore clone controlfile to '+DATA/rac11g/rac11g_control_3' from
'+DATA/rac11g/rac11g_control_1';
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting backup at 09-SEP-08
channel c1: starting datafile copy
copying standby control file
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 17:25:35
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 17:25:35
ORA-17629: Cannot connect to the remote database server
ORA-17627: ORA-01031: insufficient privileges
ORA-17629: Cannot connect to the remote database server
RMAN> exit

Recovery Manager complete.
这个问题导致的原因比较复杂。在本地测试连接,没有发现任何问题。在远端用sys测试连接辅助实例,也没有发现任何异常的情况。
但是只要执行DUPLICATE命令就会报这个错误。
由于没有其他可供参考的信息,只能根据现有的错误信息进行推测。首先报错发生在CHANNEL c1上,而且是连接远端数据库服务器。说明问题是在执行过程中,源数据库尝试连接辅助实例时出现的错误,怀疑问题可能与密码文件有关。
可是通过命令行测试没有发现任何的问题。而且前面采用SPFILE方式的时候,也经历了类似的步骤,为什么没有报错。
通过观察Oracle执行的脚本发现了问题,Oracle执行了下面的操作:
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g1' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' ;
}
executing Memory Script
这个操作时前面通过SPFILE方式所没有的,这也是为什么原来没有报错,而这里报错的原因。
不过问题又出现了,Oracle这个操作的目录是将远端的密码文件同步到本地服务器上,使得后续的SYS连接可以正常登陆。这个操作本来是没有任何问题的,而且实际上前面我就是采用了操作系统上面的类似操作,将源数据库的密码文件同步到本地的。那么为什么Oracle的rman执行了这个操作后,源数据库再连接辅助实例的时候反而报错了呢。
检查了源数据库的配置后,发现了问题的所在,源数据库采用了裸设备的方式,而本地的$ORACLE_HOME/dbs目录下的密码文件只是一个链接而已。
$ ls -l
total 38404
-rw-rw---- 1 oracle oinstall 1552 Sep 5 16:09 hc_rac11g1.dat
-rw-r--r-- 1 oracle oinstall 8385 Sep 11 1998 init.ora
-rw-r--r-- 1 oracle oinstall 12920 May 3 2001 initdw.ora
-rw-r----- 1 oracle oinstall 43 Jul 16 15:48 initrac11g1.ora
lrwxrwxrwx 1 oracle oinstall 34 Jul 16 14:39 orapwrac11g1 -> /dev/vx/rdsk/datavg/rac11g_pwdfile
-rw-r----- 1 oracle oinstall 19611648 Sep 8 18:27 snapcf_rac11g1.f
很可能Oracle在这里执行备份的时候出现了错误,没有采用裸设备备份而是当作操作系统文件进行了拷贝,导致恢复到辅助实例后,密码文件不可用。
于是先去掉了连接,直接将裸设备中的密码文件拷贝到本地目录,使得RMAN可以正常的拷贝这个文件:
$ dd if=/dev/vx/rdsk/datavg/rac11g_pwdfile of=/data/rac11g_pwfile
204800+0 records in
204800+0 records out
bash-3.00$ rm orapwrac11g1
bash-3.00$ rm orapwrac11g2
bash-3.00$ cp /data/rac11g_pwfile orapwrac11g1
再次执行DUPLICATE,则权限不足的问题被解决。
刚刚在进行RAC环境的DUPLICATE DATABASE的时候,就碰到了很多问题,由于二者命令比较相似,本来认为这次不会碰到太多的问题,没有想到的是,这次碰到的问题居然比DUPLICATE碰到的问题多出一倍。而且基本上所有碰到的问题都是DUPLICATE操作时不曾遇到的。
bash-3.00$ rman target sys/test@rac11g auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 17:38:58 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11GS (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk connect sys/test@rac11g1_s;
6> allocate auxiliary channel ac2 device type disk connect sys/test@rac11g1_s;
7> duplicate target database for standby
8> dorecover
9> from active database;
10> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=621 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=236 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=658 instance=rac11g1 device type=DISK
allocated channel: ac2
channel ac2: SID=307 instance=rac11g1 device type=DISK
Starting Duplicate Db at 09-SEP-08
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g2' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' ;
}
executing Memory Script
Starting backup at 09-SEP-08
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 17:39:16
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 17:39:16
ORA-19505: failed to identify file "/data/oracle/product/11.1/database/dbs/orapwrac11g2"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
RMAN> exit

Recovery Manager complete.
这个错误前面已经提到了,是由于连接到RAC的不同实例造成的,第一次采用了在本地创建一个orapwrac11g2的链接,指向裸设备上的密码问题。由于Oracle读取裸设备上面的密码文件错误,所以前面删除了两个链接,并将裸设备上面的密码文件拷贝到本地。因此这个错误又重现了,下面直接使用RAC11G1服务名,连接指定的实例,从根本上避免这个错误的产生:
bash-3.00$ rman target sys/test@rac11g1 auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 17:40:41 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11GS (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk connect sys/test@rac11g1_s;
6> allocate auxiliary channel ac2 device type disk connect sys/test@rac11g1_s;
7> duplicate target database for standby
8> dorecover
9> from active database;
10> }

using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=619 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=278 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=307 instance=rac11g1 device type=DISK
allocated channel: ac2
channel ac2: SID=333 instance=rac11g1 device type=DISK
Starting Duplicate Db at 09-SEP-08
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g1' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' ;
}
executing Memory Script
Starting backup at 09-SEP-08
Finished backup at 09-SEP-08
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '+DATA/rac11g/rac11g_control_1';
restore clone controlfile to '+DATA/rac11g/rac11g_control_2' from
'+DATA/rac11g/rac11g_control_1';
restore clone controlfile to '+DATA/rac11g/rac11g_control_3' from
'+DATA/rac11g/rac11g_control_1';
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting backup at 09-SEP-08
channel c1: starting datafile copy
copying standby control file
output file name=/data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f tag=TAG20080909T173509 RECID=2 STAMP=664997710
channel c1: datafile copy complete, elapsed time: 00:00:07
Finished backup at 09-SEP-08
Starting restore at 09-SEP-08
channel c1: no AUTOBACKUP in 7 days found
channel c2: no AUTOBACKUP in 7 days found
channel ac1: skipped, AUTOBACKUP already found
channel ac2: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 09-SEP-08
Starting restore at 09-SEP-08
channel c1: no AUTOBACKUP in 7 days found
channel c2: no AUTOBACKUP in 7 days found
channel ac1: skipped, AUTOBACKUP already found
channel ac2: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 09-SEP-08
sql statement: alter database mount standby database
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 17:41:41
RMAN-03015: error occurred in stored script Memory Script
RMAN-03009: failure of sql command on clone_default channel at 09/09/2008 17:41:41
RMAN-11003: failure during parse/execution of SQL statement: alter database mount standby database
ORA-01103: database name 'RAC11G' in control file is not 'RAC11GS'
RMAN> exit

Recovery Manager complete.
这个错误是由于手误造成的,创建SPFILE的时候,PFILE文件指定了前面测试DUPLICATE时候创建的PFILE,导致DB_NAME名称错误。
bash-3.00$ rman target sys/test@rac11g1 auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 18:31:45 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11G (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk connect sys/test@rac11g1_s;
6> allocate auxiliary channel ac2 device type disk connect sys/test@rac11g1_s;
7> duplicate target database for standby
8> dorecover
9> from active database;
10> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=621 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=278 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=325 instance=rac11g1 device type=DISK
allocated channel: ac2
channel ac2: SID=324 instance=rac11g1 device type=DISK
Starting Duplicate Db at 09-SEP-08
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g1' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' ;
}
executing Memory Script
Starting backup at 09-SEP-08
Finished backup at 09-SEP-08
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '+DATA/rac11g/rac11g_control_1';
restore clone controlfile to '+DATA/rac11g/rac11g_control_2' from
'+DATA/rac11g/rac11g_control_1';
restore clone controlfile to '+DATA/rac11g/rac11g_control_3' from
'+DATA/rac11g/rac11g_control_1';
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting backup at 09-SEP-08
channel c1: starting datafile copy
copying standby control file
output file name=/data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f tag=TAG20080909T182613 RECID=3 STAMP=665000774
channel c1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 09-SEP-08
Starting restore at 09-SEP-08
channel c1: no AUTOBACKUP in 7 days found
channel c2: no AUTOBACKUP in 7 days found
channel ac1: skipped, AUTOBACKUP already found
channel ac2: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 09-SEP-08
Starting restore at 09-SEP-08
channel c1: no AUTOBACKUP in 7 days found
channel c2: no AUTOBACKUP in 7 days found
channel ac1: skipped, AUTOBACKUP already found
channel ac2: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 09-SEP-08
sql statement: alter database mount standby database
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 18:32:43
RMAN-05501: aborting duplication of target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_perfstat_1_8g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_undotbs2_2_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_undotbs1_2_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_6_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_5_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_4_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_3_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_2_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_ndmain_1_32g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_users_1_4g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_undotbs2_1_4g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_undotbs1_1_4g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_sysaux_1_1g conflicts with a file used by the target database
RMAN-05001: auxiliary file name /dev/vx/rdsk/datavg/rac11g_system_1_1g conflicts with a file used by the target database
RMAN> exit

Recovery Manager complete.
这个错误是刚才错误的继续,重新编辑PFILE的时候,漏掉了初始化参数db_file_name_convert和log_file_name_convert。使得RMAN在建立数据文件的时候没有通过源数据库与目标数据库文件名称是否相同的检查。
bash-3.00$ rman target sys/test@rac11g1 auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 18:39:10 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11G (DBID=1712482917, not open)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk connect sys/test@rac11g1_s;
6> allocate auxiliary channel ac2 device type disk connect sys/test@rac11g1_s;
7> duplicate target database for standby
8> dorecover
9> from active database
10> db_file_name_convert '/dev/vx/rdsk/datavg', '+DATA/RAC11G';
11> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=619 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=278 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=307 instance=rac11g1 device type=DISK
allocated channel: ac2
channel ac2: SID=333 instance=rac11g1 device type=DISK
Starting Duplicate Db at 09-SEP-08
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 18:39:21
RMAN-05500: the auxiliary database must be not mounted when issuing a DUPLICATE command
RMAN> exit

Recovery Manager complete.
这个错误就很简单了,AUXILIARY实例必须处于NOMOUNT状态,而刚才中途失败的DUPLICATE FOR STANDBY命令已经将数据库处于MOUNT状态,因此需要重新将实例置为NOMOUNT状态。
刚刚在进行RAC环境的DUPLICATE DATABASE的时候,就碰到了很多问题,由于二者命令比较相似,本来认为这次不会碰到太多的问题,没有想到的是,这次碰到的问题居然比DUPLICATE碰到的问题多出一倍。而且基本上所有碰到的问题都是DUPLICATE操作时不曾遇到的。
bash-3.00$ rman target sys/test@rac11g1 auxiliary sys/test@rac11g1_s
Recovery Manager: Release 11.1.0.6.0 - Production on Tue Sep 9 18:54:07 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to auxiliary database: RAC11G (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk connect sys/test@rac11g1_s;
6> allocate auxiliary channel ac2 device type disk connect sys/test@rac11g1_s;
7> duplicate target database for standby
8> dorecover
9> from active database;
10> }
using target database control file instead of recovery catalog
allocated channel: c1
channel c1: SID=621 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=254 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=325 instance=rac11g1 device type=DISK
allocated channel: ac2
channel ac2: SID=324 instance=rac11g1 device type=DISK
Starting Duplicate Db at 09-SEP-08
contents of Memory Script:
{
backup as copy reuse
file '/data/oracle/product/11.1/database/dbs/orapwrac11g1' auxiliary format
'/data/oracle/product/11.1/database/dbs/orapwrac11g1' ;
}
executing Memory Script
Starting backup at 09-SEP-08
Finished backup at 09-SEP-08
contents of Memory Script:
{
backup as copy current controlfile for standby auxiliary format '+DATA/rac11g/rac11g_control_1';
restore clone controlfile to '+DATA/rac11g/rac11g_control_2' from
'+DATA/rac11g/rac11g_control_1';
restore clone controlfile to '+DATA/rac11g/rac11g_control_3' from
'+DATA/rac11g/rac11g_control_1';
sql clone 'alter database mount standby database';
}
executing Memory Script
Starting backup at 09-SEP-08
channel c1: starting datafile copy
copying standby control file
output file name=/data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f tag=TAG20080909T184849 RECID=5 STAMP=665002130
channel c1: datafile copy complete, elapsed time: 00:00:03
Finished backup at 09-SEP-08
Starting restore at 09-SEP-08
channel c1: no AUTOBACKUP in 7 days found
channel c2: no AUTOBACKUP in 7 days found
channel ac1: skipped, AUTOBACKUP already found
channel ac2: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 09-SEP-08
Starting restore at 09-SEP-08
channel c1: no AUTOBACKUP in 7 days found
channel c2: no AUTOBACKUP in 7 days found
channel ac1: skipped, AUTOBACKUP already found
channel ac2: skipped, AUTOBACKUP already found
channel clone_default: copied control file copy
Finished restore at 09-SEP-08
sql statement: alter database mount standby database
contents of Memory Script:
{
set newname for tempfile 1 to
"+DATA/rac11g/rac11g_temp_1_4g";
set newname for tempfile 2 to
"+DATA/rac11g/rac11g_temp_2_16g";
switch clone tempfile all;
set newname for datafile 1 to
"+DATA/rac11g/rac11g_system_1_1g";
set newname for datafile 2 to
"+DATA/rac11g/rac11g_sysaux_1_1g";
set newname for datafile 3 to
"+DATA/rac11g/rac11g_undotbs1_1_4g";
set newname for datafile 4 to
"+DATA/rac11g/rac11g_undotbs2_1_4g";
set newname for datafile 5 to
"+DATA/rac11g/rac11g_users_1_4g";
set newname for datafile 6 to
"+DATA/rac11g/rac11g_ndmain_1_32g";
set newname for datafile 7 to
"+DATA/rac11g/rac11g_ndmain_2_32g";
set newname for datafile 8 to
"+DATA/rac11g/rac11g_ndmain_3_32g";
set newname for datafile 9 to
"+DATA/rac11g/rac11g_ndmain_4_32g";
set newname for datafile 10 to
"+DATA/rac11g/rac11g_ndmain_5_32g";
set newname for datafile 11 to
"+DATA/rac11g/rac11g_ndmain_6_32g";
set newname for datafile 12 to
"+DATA/rac11g/rac11g_undotbs1_2_32g";
set newname for datafile 13 to
"+DATA/rac11g/rac11g_undotbs2_2_32g";
set newname for datafile 14 to
"+DATA/rac11g/rac11g_perfstat_1_8g";
backup as copy reuse
datafile 1 auxiliary format
"+DATA/rac11g/rac11g_system_1_1g" datafile
2 auxiliary format
"+DATA/rac11g/rac11g_sysaux_1_1g" datafile
3 auxiliary format
"+DATA/rac11g/rac11g_undotbs1_1_4g" datafile
4 auxiliary format
"+DATA/rac11g/rac11g_undotbs2_1_4g" datafile
5 auxiliary format
"+DATA/rac11g/rac11g_users_1_4g" datafile
6 auxiliary format
"+DATA/rac11g/rac11g_ndmain_1_32g" datafile
7 auxiliary format
"+DATA/rac11g/rac11g_ndmain_2_32g" datafile
8 auxiliary format
"+DATA/rac11g/rac11g_ndmain_3_32g" datafile
9 auxiliary format
"+DATA/rac11g/rac11g_ndmain_4_32g" datafile
10 auxiliary format
"+DATA/rac11g/rac11g_ndmain_5_32g" datafile
11 auxiliary format
"+DATA/rac11g/rac11g_ndmain_6_32g" datafile
12 auxiliary format
"+DATA/rac11g/rac11g_undotbs1_2_32g" datafile
13 auxiliary format
"+DATA/rac11g/rac11g_undotbs2_2_32g" datafile
14 auxiliary format
"+DATA/rac11g/rac11g_perfstat_1_8g" ;
sql 'alter system archive log current';
}
executing Memory Script
executing command: SET NEWNAME
executing command: SET NEWNAME
renamed tempfile 1 to +DATA/rac11g/rac11g_temp_1_4g in control file
renamed tempfile 2 to +DATA/rac11g/rac11g_temp_2_16g in control file
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
executing command: SET NEWNAME
Starting backup at 09-SEP-08
channel c1: starting datafile copy
input datafile file number=00009 name=/dev/vx/rdsk/datavg/rac11g_ndmain_4_32g
channel c2: starting datafile copy
input datafile file number=00010 name=/dev/vx/rdsk/datavg/rac11g_ndmain_5_32g
RMAN-03009: failure of backup command on c1 channel at 09/09/2008 18:55:34
ORA-19504: failed to create file "+DATA/rac11g/rac11g_ndmain_4_32g"
channel c1 disabled, job failed on it will be run on another channel
RMAN-03009: failure of backup command on c2 channel at 09/09/2008 18:55:34
ORA-19504: failed to create file "+DATA/rac11g/rac11g_ndmain_5_32g"
channel c2 disabled, job failed on it will be run on another channel
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/09/2008 18:55:34
RMAN-03015: error occurred in stored script Memory Script
这个错误是所有错误之中最另人郁闷的,马上就要成功了,没想到碰到了这个错误。查询了metalink,发现有不少ORA-19504错误,但是都和当前问题不完全一致。不过可以肯定一点,问题肯定和ASM有关。
经过再三的测试,发现似乎是由于源数据库发出的连接无法在ASM上恢复数据文件造成的。回想前面碰到的SPFILE的问题,感觉这种FROM ACTIVE DATABASE方式的STANDBY建立方法,如果STANDBY数据库选择了ASM方式存储,那么会导致源数据库的连接无法在ASM上面恢复数据库。
由于metalink上没有详细的描述,而且Oracle的错误提示信息也十分有限,所以到这一步暂时没有办法继续恢复了。而唯一的方法就是绕过这个问题,于是后面的测试又回到了使用备份文件进行STANDBY创建的过程。
bash-3.00$ rman target sys/test@172.0.2.54/rac11g.us.oracle.com catalog catalog_user/catalog_user@172.0.2.61/test11g.netdb auxiliary /
Recovery Manager: Release 11.1.0.6.0 - Production on Wed Sep 10 09:53:12 2008
Copyright (c) 1982, 2007, Oracle. All rights reserved.
connected to target database: RAC11G (DBID=1712482917)
connected to recovery catalog database
connected to auxiliary database: RAC11G (not mounted)
RMAN> run
2> {
3> allocate channel c1 device type disk connect sys/test@rac11g1;
4> allocate channel c2 device type disk connect sys/test@rac11g2;
5> allocate auxiliary channel ac1 device type disk connect sys/test@rac11g1_s;
6> allocate auxiliary channel ac2 device type disk connect sys/test@rac11g1_s;
7> duplicate target database for standby
8> dorecover;
9> }
allocated channel: c1
channel c1: SID=285 instance=rac11g1 device type=DISK
allocated channel: c2
channel c2: SID=104 instance=rac11g2 device type=DISK
allocated channel: ac1
channel ac1: SID=307 instance=rac11g1 device type=DISK
allocated channel: ac2
channel ac2: SID=306 instance=rac11g1 device type=DISK
Starting Duplicate Db at 10-SEP-08
contents of Memory Script:
{
set until scn 29148537;
restore clone standby controlfile;
sql clone 'alter database mount standby database';
}
executing Memory Script
executing command: SET until clause
Starting restore at 10-SEP-08
channel ac1: restoring control file
ORA-19625: error identifying file /data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
ORA-19600: input file is control file (/data/oracle/product/11.1/database/dbs/snapcf_rac11g1.f)
ORA-19601: output file is control file (+DATA/rac11g/rac11g_control_1)
failover to previous backup
channel ac1: starting datafile backup set restore
channel ac1: restoring control file
channel ac1: reading from backup piece /data/oracle/product/11.1/database/dbs/09jq63m1_1_1
channel ac1: ORA-19870: error while restoring backup piece /data/oracle/product/11.1/database/dbs/09jq63m1_1_1
ORA-19505: failed to identify file "/data/oracle/product/11.1/database/dbs/09jq63m1_1_1"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
failover to previous backup
channel ac1: starting datafile backup set restore
channel ac1: restoring control file
channel ac1: reading from backup piece /data/01jpk0bj_1_1
channel ac1: ORA-19870: error while restoring backup piece /data/01jpk0bj_1_1
ORA-19505: failed to identify file "/data/01jpk0bj_1_1"
ORA-27037: unable to obtain file status
SVR4 Error: 2: No such file or directory
Additional information: 3
failover to previous backup
released channel: c1
released channel: c2
released channel: ac1
released channel: ac2
RMAN-00571: ===========================================================
RMAN-00569: =============== ERROR MESSAGE STACK FOLLOWS ===============
RMAN-00571: ===========================================================
RMAN-03002: failure of Duplicate Db command at 09/10/2008 09:53:45
RMAN-03015: error occurred in stored script Memory Script
RMAN-06026: some targets not found - aborting restore
RMAN-06024: no backup or copy of the control file found to restore
终于是最后一个问题了,这个问题其实是在测试DUPLICATE时碰到了,由于Oracle要根据源数据库备份集的路径,在STANDBY数据库的相同位置寻找备份集,所以报错找不到指定的备份集。
只需要根据前面介绍的方法,通过CATALOG方式,编辑CATALOG数据库中BACKUP_PIECE的位置,来骗过Oracle。
具体的方法这里就不重复了,可以参考下面的文章:http://yangtingkun.itpub.net/post/468/471421
没有想到,创建STANDBY过程,准备加上创建脚本写了一篇文章,后期的检查和整理写了一篇文章,而碰到的问题却足足写了四篇。
当然原因是多方面的,RAC环境部署STANDBY相对比较复杂,而且利用DUPLICATE进行STANDBY的创建以前做的也不多。加上FROM ACTIVE DATABASE是11g的新特性,一些bug在所难免,在加上ASM的众多bug,想不碰到问题都比较困难。不过其中一个很重要的原因在于,STANDBY和PRIMARY数据库的物理存储方式不等同,如果采用相同的配置,可能问题会相对少一些。
阅读(1263) | 评论(0) | 转发(0) |
0

上一篇:ORACLE10G AWR使用

下一篇:转载--ASM功能详解

给主人留下些什么吧!~~