在前面的单实例数据库迁移至rac环境配置过程中,介绍了使用standby技术构建单实例主库对应rac物理备库的data guard模型,本节中将介绍rac主库对应单实例物理备库的data guard模型构建;在MAA架构中,ASM提供了存储方面的网格,RAC提供了数据库层面上的网格计算,data guard则着重强调在数据的备份和容灾方面,更多MAA方面的知识,参考下面的链接!
http://www.oracle.com/technetwork/database/features/availability/maa-090890.html

一:主备库的环境介绍
主库:
数据库版本:10.2.0.5
OS版本:centos4.8 64位
数据库名:rac(两个实例)
实例名:rac1,rac2
IP地址:192.168.1.41/24,192.168.1.42/24
db_unique_name: rac
服务名:rac.yang.com
监听器端口:1521
存储类型:OMF+ASM磁盘组,+DATA,+FRA

备库:
数据库版本:10.2.0.5
OS版本:rhel5.4 64位
数据库名:rac (单实例)
实例名:orcl
IP地址:192.168.1.49/24
db_unique_name: orcl
服务名:orcl.yang.com
监听器端口:1521
存储类型:文件系统+OMF

在开始前确保主库rac环境正常,备库只需要安装数据库软件即可,不需要建库

[oracle@rac1 ~]$ crs_stat -t -v
Name           Type           R/RA   F/FT   Target    State     Host       
----------------------------------------------------------------------
ora.rac.db     application    0/0    0/1    ONLINE    ONLINE    rac1       
ora....c1.inst application    0/5    0/0    ONLINE    ONLINE    rac1       
ora....c2.inst application    0/5    0/0    ONLINE    ONLINE    rac2       
ora....SM1.asm application    0/5    0/0    ONLINE    ONLINE    rac1       
ora....C1.lsnr application    0/5    0/0    ONLINE    ONLINE    rac1       
ora.rac1.gsd   application    0/5    0/0    ONLINE    ONLINE    rac1       
ora.rac1.ons   application    0/3    0/0    ONLINE    ONLINE    rac1       
ora.rac1.vip   application    0/0    0/0    ONLINE    ONLINE    rac1       
ora....SM2.asm application    0/5    0/0    ONLINE    ONLINE    rac2       
ora....C2.lsnr application    0/5    0/0    ONLINE    ONLINE    rac2       
ora.rac2.gsd   application    0/5    0/0    ONLINE    ONLINE    rac2       
ora.rac2.ons   application    0/3    0/0    ONLINE    ONLINE    rac2       
ora.rac2.vip   application    0/0    0/0    ONLINE    ONLINE    rac2 
二:配置监听器和tnsnames.ora文件如下,rac节点2上需要同样进行配置

[oracle@rac1 ~]$ cat $ORACLE_HOME/network/admin/listener.ora
LISTENER_RAC1 =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521)(IP = FIRST))
      (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.41)(PORT = 1521)(IP = FIRST))
    )
  )

SID_LIST_LISTENER_RAC1 =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (GLOBAL_DBNAME=rac_DGMGRL.yang.com)
      (SID_NAME = rac1)
    )
  )

[oracle@rac1 ~]$ sqlplus sys/[email protected]:1521/rac_DGMGRL.yang.com as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jan 12 10:56:05 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options
SQL>

[oracle@rac1 ~]$ cat $ORACLE_HOME/admin/tnsnames.ora
LISTENERS_RAC =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
  )

LISTENER_RAC1 =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
  )

LISTENER_RAC2 =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
  )

RAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac.yang.com)
    )
  )

RAC1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac.yang.com)
      (INSTANCE_NAME = rac1)
    )
  )

RAC2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac.yang.com)
      (INSTANCE_NAME = rac2)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = server49.yang.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.yang.com)
      (INSTANCE_NAME = orcl)
    )
  )

三:备库的静听器配置和tnsnames.ora文件如下

[oracle@server49 ~]$ cat /u01/app/oracle/product/10.2.0/db1/network/admin/listener.ora
LISTENER_ORCL =
  (DESCRIPTION_LIST =
    (DESCRIPTION =
      (ADDRESS = (PROTOCOL = TCP)(HOST = server49.yang.com)(PORT = 1521)
    )
  )

SID_LIST_LISTENER_ORCL =
  (SID_LIST =
    (SID_DESC =
      (ORACLE_HOME = /u01/app/oracle/product/10.2.0/db_1)
      (GLOBAL_DBNAME=orcl_DGMGRL.yang.com)
      (SID_NAME = orcl)
    )
  )

[oracle@server49 ~]$ cat /u01/app/oracle/product/10.2.0/db1/network/admin/tnsnames.ora
LISTENER_ORCL =
  (ADDRESS_LIST =
    (ADDRESS = (PROTOCOL = TCP)(HOST = server49.yang.com)(PORT = 1521))
  )

RAC =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac.yang.com)
    )
  )

RAC1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip.yang.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac.yang.com)
      (INSTANCE_NAME = rac1)
    )
  )

RAC2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip.yang.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = rac.yang.com)
      (INSTANCE_NAME = rac2)
    )
  )

ORCL =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = server49.yang.com)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = orcl.yang.com)
      (INSTANCE_NAME = orcl)
    )
  ) 

四:在主库上修改初始化参数文件如下

[oracle@rac1 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jan 12 11:14:29 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
SQL> conn /as sysdba
Connected.

SQL> alter database force logging;
Database altered.

SQL> alter system set log_file_name_convert='+FLASH/rac','/u01/app/oracle/flash_recover_area/orcl','+DATA/rac','/u01/app/oracle/oradata/orcl' scope=spfile;
System altered.

SQL> alter system set db_file_name_convert='+DATA/rac','/u01/app/oracle/oradata/orcl' scope=spfile;
System altered.

SQL> alter system set dg_broker_config_file1='+DATA/rac/dgbroker/dg_config_file1.dat';
System altered.

SQL> alter system set dg_broker_config_file2='+FRA/rac/dgbroker/dg_config_file2.dat';
System altered.

SQL> alter system set fal_client='rac1' sid='rac1';
System altered.

SQL> alter system set fal_client='rac2' sid='rac2';
System altered.

SQL> alter system set fal_server='orcl';
System altered.

SQL> alter system set local_listener='LISTENER_RAC1' sid='rac1';
System altered.

SQL> alter system set local_listener='LISTENER_RAC2' sid='rac2';
System altered.

SQL> alter system set log_archive_config='DG_CONFIG=(rac,orcl)';
System altered.

SQL> alter system set log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=rac';
System altered.

SQL> alter system set log_archive_dest_state_2='defer';
System altered.

SQL> alter system set log_archive_dest_2='SERVICE=orcl LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=orcl';
System altered.

SQL> alter system set log_archive_dest_3='LOCATION=+FRA/rac/standbylog/ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=rac';
System altered.

SQL> alter system set log_archive_dest_state_1=enable;
System altered.

SQL> alter system set log_archive_dest_state_3=enable;
System altered.

SQL> alter system set log_archive_max_processes=5;
System altered.

SQL> alter system set remote_listener='LISTENERS_RAC';
System altered.

SQL> alter system set remote_login_passwordfile='EXCLUSIVE' scope=spfile;
System altered.

SQL> alter system set standby_archive_dest='+FRA/rac/standbylog';
System altered.

SQL> alter system set standby_file_management='auto';
System altered.

五:由spfile生成pfile,同时增加相应的standby日志组

SQL> create pfile='/home/oracle/backup/initrac.ora' from spfile;
File created.

SQL> select thread#,group# from v$log;

   THREAD#     GROUP#
---------- ----------
         1          1
         1          2
         2          3
         2          4

SQL> alter database add standby logfile thread 1 group 11 size 50M,group 12 size 50M,group 13 size 50M;
Database altered.

SQL> alter database add standby logfile thread 2 group 14 size 50M,group 15 size 50M,group 16 size 50M;
Database altered.

SQL> select thread#,group# from v$standby_log;

   THREAD#     GROUP#
---------- ----------
         1         11
         1         12
         1         13
         2         14
         2         15
         2         16

六:利用rman备份主库文件,并复制到备库上

[oracle@rac1 ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Jan 12 11:53:51 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: RAC (DBID=2360349352)

RMAN> run {
2> allocate channel c1 device type disk;
3> allocate channel c2 device type disk;
4> backup incremental level 0
5> format '/home/oracle/backup/db_%U'
6> tag 'bak_for_maa' database
7> plus archivelog;
8> release channel c1;
9> release channel c2;
10> }

RMAN> backup current controlfile for standby format '/home/oracle/backup/control01.ctl';
[oracle@rac1 ~]$ scp -rp backup/ server49.yang.com:/home/oracle/ 

七:在备库上进行duplicate操作,需要创建相关的目录,准备密码文件,以及修改参数文件等

[oracle@server49 orcl]$ env |grep ORA
ORACLE_SID=orcl
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db1

[oracle@server49 orcl]$ pwd
/u01/app/oracle/admin/orcl
[oracle@server49 orcl]$ ls
adump  bdump  cdump  dpdump  pfile  udump

[oracle@server49 ~]$ orapwd file=$ORACLE_HOME/dbs/orapworcl password=123456
[oracle@server49 ~]$ cat /home/oracle/backup/initrac.ora
*.__db_cache_size=100663296
*.__java_pool_size=4194304
*.__large_pool_size=4194304
*.__shared_pool_size=96468992
*.__streams_pool_size=0
*.audit_file_dest='/u01/app/oracle/admin/orcl/adump'
*.background_dump_dest='/u01/app/oracle/admin/orcl/bdump'
*.compatible='10.2.0.5.0'
*.control_files='/u01/app/oracle/oradata/ORCL/controlfile/control01.ctl'
*.core_dump_dest='/u01/app/oracle/admin/orcl/cdump'
*.db_block_size=8192
*.db_create_file_dest='/u01/app/oracle/oradata'
*.db_create_online_log_dest_1='/u01/app/oracle/flash_recovery_area/'
*.db_domain='yang.com'
*.db_file_multiblock_read_count=16
*.db_file_name_convert='+DATA/rac','/u01/app/oracle/oradata/ORCL'
*.db_name='rac'
*.db_recovery_file_dest='/u01/app/oracle/flash_recovery_area/'
*.db_recovery_file_dest_size=21474836480
*.dg_broker_config_file1='/u01/app/oracle/product/10.2.0/db1/dbs/dg_config_file1.dat'
*.dg_broker_config_file2='/u01/app/oracle/product/10.2.0/db1/dbs/dg_config_file2.dat'
*.dispatchers='(PROTOCOL=TCP) (SERVICE=racXDB)'
*.fal_client='orcl'
*.fal_server='rac'
*.job_queue_processes=10
*.local_listener='LISTENER_ORCL'
*.log_archive_config='DG_CONFIG=(rac,orcl)'
*.log_archive_dest_1='LOCATION=USE_DB_RECOVERY_FILE_DEST VALID_FOR=(ONLINE_LOGFILES,ALL_ROLES) DB_UNIQUE_NAME=orcl'
*.log_archive_dest_2='SERVICE=rac LGWR ASYNC VALID_FOR=(ONLINE_LOGFILES,PRIMARY_ROLE) DB_UNIQUE_NAME=rac'
*.log_archive_dest_3='LOCATION=/u01/app/oracle/flash_recovery_area/ORCL/standbylog/ VALID_FOR=(STANDBY_LOGFILES,STANDBY_ROLE) DB_UNIQUE_NAME=orcl'
*.log_archive_dest_state_1='ENABLE'
*.log_archive_dest_state_2='defer'
*.log_archive_dest_state_3='ENABLE'
*.log_archive_format='%t_%s_%r.dbf'
*.log_archive_max_processes=5
*.log_file_name_convert='+FLASH/rac','/u01/app/oracle/flash_recovery_area/ORCL','+DATA/rac','/u01/app/oracle/oradata/ORCL'
*.open_cursors=300
*.pga_aggregate_target=71303168
*.processes=150
*.remote_login_passwordfile='EXCLUSIVE'
*.sga_target=213909504
*.standby_archive_dest='/u01/app/oracle/flash_recovery_area/ORCL/standbylog/'
*.standby_file_management='auto'
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS1'
*.user_dump_dest='/u01/app/oracle/admin/orcl/udump'

[oracle@server49 ~]$ sqlplus /nolog
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jan 12 13:49:40 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn /as sysdba
Connected to an idle instance.
SQL> startup nomount pfile='/home/oracle/backup/initrac.ora';
ORACLE instance started.

Total System Global Area  213909504 bytes
Fixed Size                  2095152 bytes
Variable Size             104859600 bytes
Database Buffers          100663296 bytes
Redo Buffers                6291456 bytes

SQL> create spfile from pfile='/home/oracle/backup/initrac.ora';
File created.

[oracle@server49 ~]$ rman target sys/123456@rac auxiliary /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Jan 12 13:59:30 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: RAC (DBID=2360349352)
connected to auxiliary database: RAC (not mounted)

RMAN> duplicate target database for standby;
[oracle@server49 ~]$ rman target /
Recovery Manager: Release 10.2.0.5.0 - Production on Thu Jan 12 14:49:38 2012
Copyright (c) 1982, 2007, Oracle.  All rights reserved.
connected to target database: RAC (DBID=2360349352, not open) 

RMAN> report schema;

using target database control file instead of recovery catalog
RMAN-06139: WARNING: control file is not current for REPORT SCHEMA
Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    440      SYSTEM               ***     /u01/app/oracle/oradata/ORCL/datafile/system.264.772367249
2    35       UNDOTBS1             ***     /u01/app/oracle/oradata/ORCL/datafile/undotbs1.258.772367251
3    250      SYSAUX               ***     /u01/app/oracle/oradata/ORCL/datafile/sysaux.265.772367249
4    5        USERS                ***     /u01/app/oracle/oradata/ORCL/datafile/users.309.772367251
5    100      EXAMPLE              ***     /u01/app/oracle/oradata/ORCL/datafile/example.289.772367357
6    25       UNDOTBS2             ***     /u01/app/oracle/oradata/ORCL/datafile/undotbs2.259.772367523
List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    0        TEMP                 32767       /u01/app/oracle/oradata/ORCL/tempfile/temp.285.772367353

八:在备库上还原日志文件,修改onlinelog和standby log的路径

SQL> show parameter name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string      +DATA/rac, /u01/app/oracle/ora
                                                 data/ORCL
db_name                              string      rac
db_unique_name                       string      orcl
global_names                         boolean     FALSE
instance_name                        string      orcl
lock_name_space                      string
log_file_name_convert                string      +FLASH/rac, /u01/app/oracle/fl
                                                 ash_recovery_area/ORCL, +DATA/
                                                 rac, /u01/app/oracle/oradata/O
                                                 RCL

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      orcl.yang.com

SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     9
Next log sequence to archive   10
Current log sequence           10

RMAN> restore archivelog all;

[oracle@server49 ~]$ ls /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_01_12/
o1_mf_1_3_7jx11wrr_.arc  o1_mf_1_8_7jx11s7b_.arc  o1_mf_2_4_7jx123sx_.arc
o1_mf_1_4_7jx11scv_.arc  o1_mf_1_9_7jx12d26_.arc  o1_mf_2_5_7jx123q4_.arc
o1_mf_1_5_7jx11rpy_.arc  o1_mf_2_1_7jx11rds_.arc  o1_mf_2_6_7jx124xf_.arc
o1_mf_1_6_7jx11rvt_.arc  o1_mf_2_2_7jx124gw_.arc  o1_mf_2_7_7jx12bz0_.arc
o1_mf_1_7_7jx11s0q_.arc  o1_mf_2_3_7jx12419_.arc


SQL> select group#,member from v$logfile;

    GROUP# MEMBER
---------- --------------------------------------------------
         2 +FRA/rac/onlinelog/group_2.306.772367347
         1 +FRA/rac/onlinelog/group_1.307.772367339
         3 +FRA/rac/onlinelog/group_3.305.772367577
         4 +FRA/rac/onlinelog/group_4.304.772367577
        11 +FRA/rac/onlinelog/group_11.303.772371907
        12 +FRA/rac/onlinelog/group_12.302.772371907
        13 +FRA/rac/onlinelog/group_13.301.772371915
        14 +FRA/rac/onlinelog/group_14.300.772371979
        15 +FRA/rac/onlinelog/group_15.299.772371979
        16 +FRA/rac/onlinelog/group_16.298.772371981

SQL> alter system set standby_file_management=manual;
System altered.

SQL> alter database rename file '+FRA/rac/onlinelog/group_2.306.772367347' to '/u01/app/oracle/oradata/ORCL/onlinelog/group_2.306.772367347';
Database altered.

SQL> select member from v$logfile;

MEMBER
--------------------------------------------------------------------------------
/u01/app/oracle/oradata/ORCL/onlinelog/group_2.306.772367347
/u01/app/oracle/oradata/ORCL/onlinelog/group_1.307.772367339
/u01/app/oracle/oradata/ORCL/onlinelog/group_3.305.772367577
/u01/app/oracle/oradata/ORCL/onlinelog/group_4.304.772367577
/u01/app/oracle/oradata/ORCL/onlinelog/group_11.303.772371907
/u01/app/oracle/oradata/ORCL/onlinelog/group_12.302.772371907
/u01/app/oracle/oradata/ORCL/onlinelog/group_13.301.772371915
/u01/app/oracle/oradata/ORCL/onlinelog/group_14.300.772371979
/u01/app/oracle/oradata/ORCL/onlinelog/group_15.299.772371979
/u01/app/oracle/oradata/ORCL/onlinelog/group_16.298.772371981

SQL> alter system set standby_file_management=auto;
System altered.

九:将备库置于实时应用归档日志状态并观察日志输出

SQL> select name,database_role from v$database;

NAME      DATABASE_ROLE
--------- ----------------
RAC       PHYSICAL STANDBY

SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.

[oracle@server49 ~]$ tail -f /u01/app/oracle/admin/orcl/bdump/alert_orcl.log
Clearing online redo logfile 4 complete
Media Recovery Log /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_01_12/o1_mf_1_9_7jx12d26_.arc
Media Recovery Log /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_01_12/o1_mf_2_7_7jx12bz0_.arc
Thu Jan 12 15:17:17 CST 2012
Media Recovery Waiting for thread 1 sequence 10

SQL> select first_time,next_time,sequence#,applied,thread# from v$archived_log order by 5,3;

FIRST_TIME          NEXT_TIME            SEQUENCE# APP    THREAD#
------------------- ------------------- ---------- --- ----------
2012-01-12:10:32:16 2012-01-12:11:51:23          3 NO           1
2012-01-12:10:32:16 2012-01-12:11:51:23          3 NO           1
2012-01-12:11:51:23 2012-01-12:11:56:14          4 NO           1
2012-01-12:11:51:23 2012-01-12:11:56:14          4 NO           1
2012-01-12:11:56:14 2012-01-12:12:03:36          5 NO           1
2012-01-12:11:56:14 2012-01-12:12:03:36          5 NO           1
2012-01-12:12:03:36 2012-01-12:12:58:27          6 NO           1
2012-01-12:12:03:36 2012-01-12:12:58:27          6 NO           1
2012-01-12:12:58:27 2012-01-12:13:06:02          7 NO           1
2012-01-12:12:58:27 2012-01-12:13:06:02          7 NO           1
2012-01-12:13:06:02 2012-01-12:13:08:02          8 YES          1

FIRST_TIME          NEXT_TIME            SEQUENCE# APP    THREAD#
------------------- ------------------- ---------- --- ----------
2012-01-12:13:06:02 2012-01-12:13:08:02          8 NO           1
2012-01-12:13:08:02 2012-01-12:13:14:12          9 NO           1
2012-01-12:13:08:02 2012-01-12:13:14:12          9 YES          1
2012-01-12:10:32:58 2012-01-12:11:51:25          1 NO           2
2012-01-12:10:32:58 2012-01-12:11:51:25          1 NO           2
2012-01-12:11:51:25 2012-01-12:11:56:11          2 NO           2
2012-01-12:11:51:25 2012-01-12:11:56:11          2 NO           2
2012-01-12:11:56:11 2012-01-12:12:03:36          3 NO           2
2012-01-12:11:56:11 2012-01-12:12:03:36          3 NO           2
2012-01-12:12:03:36 2012-01-12:12:58:28          4 NO           2
2012-01-12:12:03:36 2012-01-12:12:58:28          4 NO           2

FIRST_TIME          NEXT_TIME            SEQUENCE# APP    THREAD#
------------------- ------------------- ---------- --- ----------
2012-01-12:12:58:28 2012-01-12:13:06:02          5 NO           2
2012-01-12:12:58:28 2012-01-12:13:06:02          5 NO           2
2012-01-12:13:06:02 2012-01-12:13:08:06          6 NO           2
2012-01-12:13:06:02 2012-01-12:13:08:06          6 NO           2
2012-01-12:13:08:06 2012-01-12:13:14:13          7 NO           2
2012-01-12:13:08:06 2012-01-12:13:14:13          7 NO           2

十:测试,主库上新建表空间,建表后切换日志,备库置于只读模式验证数据一致性

[oracle@rac1 ~]$ sqlplus sys/123456@rac as sysdba
SQL*Plus: Release 10.2.0.5.0 - Production on Thu Jan 12 15:21:46 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, Real Application Clusters, OLAP, Data Mining
and Real Application Testing options

SQL> create tablespace maa datafile size 100M;
Tablespace created.

SQL> create table hr.maa_test tablespace maa as select * from dba_source;
Table created.

SQL> alter system archive log current;
System altered.

SQL> alter system set log_archive_dest_state_2=enable;
System altered.

SQL> alter system archive log current;
System altered.

SQL> select first_time,next_time,sequence#,applied,thread# from v$archived_log  where sequence# >10 order by 5,3;

FIRST_TIME          NEXT_TIME            SEQUENCE# APP    THREAD#
------------------- ------------------- ---------- --- ----------
2012-01-12:14:07:46 2012-01-12:14:07:46         11 YES          1
2012-01-12:14:17:59 2012-01-12:14:18:04         12 YES          1
2012-01-12:14:18:04 2012-01-12:15:23:28         13 YES          1
2012-01-12:15:23:28 2012-01-12:15:24:14         14 YES          1
2012-01-12:15:24:14 2012-01-12:15:25:30         15 YES          1
2012-01-12:14:25:54 2012-01-12:15:24:13         11 YES          2
2012-01-12:15:24:13 2012-01-12:15:25:36         12 YES          2

节点1:
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     15
Next log sequence to archive   16
Current log sequence           16

节点2:
SQL> conn /as sysdba
Connected.
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            USE_DB_RECOVERY_FILE_DEST
Oldest online log sequence     12
Next log sequence to archive   13
Current log sequence           13.

SQL> alter database recover managed standby database cancel;
Database altered.

SQL> alter database open read only;
Database altered.

SQL> select tablespace_name from dba_tablespaces;

TABLESPACE_NAME
------------------------------
SYSTEM
UNDOTBS1
SYSAUX
TEMP
USERS
UNDOTBS2
EXAMPLE
MAA

SQL> select count(*) from hr.maa_test;

  COUNT(*)
----------
    295528

SQL> alter database recover managed standby database using current logfile disconnect from session;
Database altered.

SQL> select * from v$archive_gap;
no rows selected

SQL> select process, client_process, sequence#, status from v$managed_standby;

PROCESS   CLIENT_P  SEQUENCE# STATUS
--------- -------- ---------- ------------
ARCH      ARCH             17 CLOSING
ARCH      ARCH             14 CLOSING
ARCH      ARCH              0 CONNECTED
ARCH      ARCH              0 CONNECTED
ARCH      ARCH              0 CONNECTED
RFS       UNKNOWN           0 IDLE
RFS       UNKNOWN           0 IDLE
RFS       UNKNOWN           0 IDLE
RFS       UNKNOWN           0 IDLE
RFS       UNKNOWN           0 IDLE
RFS       UNKNOWN           0 IDLE

PROCESS   CLIENT_P  SEQUENCE# STATUS
--------- -------- ---------- ------------
RFS       UNKNOWN           0 IDLE
RFS       UNKNOWN           0 IDLE
MRP0      N/A              15 APPLYING_LOG
RFS       LGWR             18 IDLE
RFS       LGWR             15 IDLE

SQL> select thread#, max (sequence#) from v$log_history group by thread#;

   THREAD# MAX(SEQUENCE#)
---------- --------------
         1             17
         2             14

备库上相关的文件如下:
[oracle@server49 ~]$ ls /u01/app/oracle/flash_recovery_area/ORCL/standbylog/
1_10_772367339.dbf  1_14_772367339.dbf  2_10_772367339.dbf  2_14_772367339.dbf
1_11_772367339.dbf  1_15_772367339.dbf  2_11_772367339.dbf  2_8_772367339.dbf
1_12_772367339.dbf  1_16_772367339.dbf  2_12_772367339.dbf  2_9_772367339.dbf
1_13_772367339.dbf  1_17_772367339.dbf  2_13_772367339.dbf
[oracle@server49 ~]$ ls /u01/app/oracle/flash_recovery_area/ORCL/archivelog/2012_01_12/
o1_mf_1_3_7jxs4g18_.arc  o1_mf_1_8_7jxs4cxn_.arc  o1_mf_2_4_7jxs4k77_.arc
o1_mf_1_4_7jxs4d5z_.arc  o1_mf_1_9_7jxs4of6_.arc  o1_mf_2_5_7jxs4k43_.arc
o1_mf_1_5_7jxs4c3h_.arc  o1_mf_2_1_7jxs4bpl_.arc  o1_mf_2_6_7jxs4l0r_.arc
o1_mf_1_6_7jxs4cnh_.arc  o1_mf_2_2_7jxs4km1_.arc  o1_mf_2_7_7jxs4nbr_.arc
o1_mf_1_7_7jxs4csf_.arc  o1_mf_2_3_7jxs4kds_.arc

[oracle@server49 ~]$ ls /u01/app/oracle/oradata/ORCL/controlfile/
control01.ctl
[oracle@server49 ~]$ ls /u01/app/oracle/oradata/ORCL/datafile/
example.289.772367357    sysaux.265.772367249  undotbs1.258.772367251  users.309.772367251
o1_mf_maa_7jxt3t7d_.dbf  system.264.772367249  undotbs2.259.772367523
[oracle@server49 ~]$ ls /u01/app/oracle/oradata/ORCL/onlinelog/
group_11.303.772371907  group_14.300.772371979  group_3.305.772367577
group_12.302.772371907  group_15.299.772371979  group_4.304.772367577
group_1.307.772367339   group_16.298.772371981
group_13.301.772371915  group_2.306.772367347
[oracle@server49 ~]$ ls /u01/app/oracle/oradata/ORCL/tempfile/
temp.285.772367353

参考文档:http://www.oracledba.org/10g/dr/10gR2_dataguard_RAC_to_RAC.html,感谢作者分享!