AIX高手挑战赛,这道题难倒你了吗?

        记得,之前在某论坛在线参加了一次AIX高手挑战赛,成绩不太理想,顺手把其中的某道题以txt文本方式记录下来了,刚才整理机器的时候,看到该题目,就整理在这儿了,那么这道题目也难倒你了吗?

        Oracle10g或者11g的Real Application Cluster(RAC)版本,在AIX操作系统上是使用User Datagram Protocol(UDP)协议作为interprocess通讯的。为了提高Oracle的性能,需要调整UDP参数的设置。需要使用no命令来修改udp_sendspace和udp_recvspace参数。如:将udp_sendspace参数设置成为:[(DB_BLOCK_SIZE*DB_FILE_MULTIBLOCK_READ_COUNT)+4096],并且不小于65536; 将udp_recvspace参数设置为>=4*udp_sendspace; 如果需要,增加sb_max参数(缺省是1048576),因为sb_max必须>=udp_recvspace. 为了确定udp_recvspace是否设置的合适,可以使用如下哪条命令:

A  netstat -s | grep "socket buffer overflows" 

B  lsattr -El udp_recvspace 

C  no -a | grep udp_recvspace 

D  以上都不是 

        答案应该选哪个呢?各位网友,可以回复给出你的答案…..

解决11gR2 RAC 客户端ORA-12545错误一则

在一套Linux环境下X86_64的11gR2 RAC数据库集群中,客户端通过SCAN IP访问数据库时遇到下述错误:

C:\Users\huangw.GILLION>sqlplus hr/hr@11grac

SQL*Plus: Release 11.2.0.2.0 Production on Tue Mar 13 10:54:55 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.

ERROR:
ORA-12545: Connect failed because target host or object does not exist

其中,客户端的tnsnames.ora文件配置如下,其中172.16.0.203为SCAN IP,并且客户端ping SCAN IP一切正常 :

11grac =
(DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST=172.16.0.203)(PORT = 1521))
     (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = devdb)
    )
  )

ping SCAN IP:

C:\Users\huangw.GILLION>ping 172.16.0.203

Pinging 172.16.0.203 with 32 bytes of data:
Reply from 172.16.0.203: bytes=32 time=1ms TTL=64
Reply from 172.16.0.203: bytes=32 time<1ms TTL=64
Reply from 172.16.0.203: bytes=32 time<1ms TTL=64
Reply from 172.16.0.203: bytes=32 time<1ms TTL=64

Ping statistics for 172.16.0.203:
    Packets: Sent = 4, Received = 4, Lost = 0 (0% loss),
Approximate round trip times in milli-seconds:
    Minimum = 0ms, Maximum = 1ms, Average = 0ms

服务器端网络配置信息如下:

[root@rac1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
#127.0.0.1              localhost.localdomain localhost
127.0.0.1               localhost
::1             localhost6.localdomain6 localhost6

172.16.0.191            rac1.localdomain        rac1
172.16.0.193            rac1-vip.localdomain    rac1-vip
192.168.93.1            rac1-priv.localdomain   rac1-priv

172.16.0.192            rac2.localdomain        rac2
172.16.0.194            rac2-vip.localdomain    rac2-vip
192.168.93.2            rac2-priv.localdomain   rac2-priv

172.16.0.203            rac-scan.localdomain    rac-scan
[root@rac1 ~]# 

服务器端SCAN IP信息如下:

[root@rac1 ~]# /u01/app/11.2.0/grid/bin/srvctl config scan
SCAN name: 172.16.0.203, Network: 1/172.16.0.0/255.255.240.0/eth0
SCAN VIP name: scan1, IP: /rac-scan.localdomain/172.16.0.203
[root@rac1 ~]# /u01/app/11.2.0/grid/bin/srvctl status scan
SCAN VIP scan1 is enabled
SCAN VIP scan1 is running on node rac2
[root@rac1 ~]# /u01/app/11.2.0/grid/bin/srvctl status scan_listener
SCAN Listener LISTENER_SCAN1 is enabled
SCAN listener LISTENER_SCAN1 is running on node rac2
[root@rac1 ~]# 

服务器端集群信息如下:

[root@rac1 ~]# /u01/app/11.2.0/grid/bin/crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.DATADG.dg  ora....up.type ONLINE    ONLINE    rac1        
ora.GRIDDG.dg  ora....up.type ONLINE    ONLINE    rac1        
ora....ER.lsnr ora....er.type ONLINE    ONLINE    rac1        
ora....N1.lsnr ora....er.type ONLINE    ONLINE    rac2        
ora.asm        ora.asm.type   ONLINE    ONLINE    rac1        
ora.devdb.db   ora....se.type ONLINE    ONLINE    rac1        
ora.eons       ora.eons.type  ONLINE    ONLINE    rac1        
ora.gsd        ora.gsd.type   OFFLINE   OFFLINE               
ora....network ora....rk.type ONLINE    ONLINE    rac1        
ora.oc4j       ora.oc4j.type  OFFLINE   OFFLINE               
ora.ons        ora.ons.type   ONLINE    ONLINE    rac1        
ora....SM1.asm application    ONLINE    ONLINE    rac1        
ora....C1.lsnr application    ONLINE    ONLINE    rac1        
ora.rac1.gsd   application    OFFLINE   OFFLINE               
ora.rac1.ons   application    ONLINE    ONLINE    rac1        
ora.rac1.vip   ora....t1.type ONLINE    ONLINE    rac1        
ora....SM2.asm application    ONLINE    ONLINE    rac2        
ora....C2.lsnr application    ONLINE    ONLINE    rac2        
ora.rac2.gsd   application    OFFLINE   OFFLINE               
ora.rac2.ons   application    ONLINE    ONLINE    rac2        
ora.rac2.vip   ora....t1.type ONLINE    ONLINE    rac2        
ora....ry.acfs ora....fs.type ONLINE    ONLINE    rac1        
ora.scan1.vip  ora....ip.type ONLINE    ONLINE    rac2        
[root@rac1 ~]# 

通过查找MetaLink:ORA-12545 or ORA-12537 While Connecting to RAC through SCAN name [ID 970619.1]得到解决方法,修改数据库的local_listener参数:

修改之前:

[root@rac1 ~]# su - oracle
rac1-> sqlplus

SQL*Plus: Release 11.2.0.1.0 Production on Tue Mar 13 10:42:58 2012

Copyright (c) 1982, 2009, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management, OLAP,
Data Mining and Real Application Testing options

SQL> set line 160
SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +DATADG/devdb/spfiledevdb.ora
SQL> show parameter instance_name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      devdb1
SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string      (DESCRIPTION=(ADDRESS_LIST=(AD
                                                 DRESS=(PROTOCOL=TCP)(HOST=rac1
                                                 -vip)(PORT=1521))))
remote_listener                      string      rac-scan:1521
SQL> 

修改local_listener参数:

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.0.193)(PORT=1521))))' sid='devdb1';

System altered.
SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=172.16.0.194)(PORT=1521))))' sid='devdb2';

System altered.

SQL> show parameter listener

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
listener_networks                    string
local_listener                       string      (DESCRIPTION=(ADDRESS_LIST=(AD
                                                 DRESS=(PROTOCOL=TCP)(HOST=172.
                                                 16.0.193)(PORT=1521))))
remote_listener                      string      rac-scan:1521
SQL> 

修改之后,客户端连接正常:

C:\Users\huangw.GILLION>sqlplus hr/hr@11grac

SQL*Plus: Release 11.2.0.2.0 Production on Tue Mar 13 11:04:00 2012

Copyright (c) 1982, 2010, Oracle.  All rights reserved.


Connected to:
Oracle Database 11g Enterprise Edition Release 11.2.0.1.0 - 64bit Production
With the Partitioning, Real Application Clusters, Automatic Storage Management,
Data Mining and Real Application Testing options

SQL> show user;
USER is "HR"
SQL> select * from tab;

TNAME                          TABTYPE  CLUSTERID
------------------------------ ------- ----------
COUNTRIES                      TABLE
DEPARTMENTS                    TABLE
EMPLOYEES                      TABLE
EMP_DETAILS_VIEW               VIEW
JOBS                           TABLE
JOB_HISTORY                    TABLE
LOCATIONS                      TABLE
REGIONS                        TABLE

8 rows selected.

SQL>

至此,问题解决。

产生问题原因:

Client is able to resolve all Fully Qualified Domain Name (FQDN) SCAN and VIP name but not short ones(without domain name) as its in different domain; even though FQDN names were specified during Grid Infrastructure setup, due to bug 9150053 by default DBCA set database parameter local_listener to short node VIP name while database is created.

解决方法除了上述之外,我们也可以按照下面的方法解决,其实,都是换汤不换药,个人倾向于直接在监听里配置IP地址:

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac1-vip.localdomain)(PORT=1521))))' sid='devdb1';

System altered.

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=rac2-vip.localdomain)(PORT=1521))))' sid='devdb2';

System altered.

SQL> alter system register;

System altered.

SQL> 

Oracle 10g RAC 配置物理dataguard系列3:物理备库配置步骤

在上一篇文章Oracle 10g RAC 配置物理dataguard系列2:备库安装、升级oracle软件、配置ASM实例中,我们已经在物理备库上顺利安装、升级oracle软件同RAC主库版本一致的10.2.0.5,并且配置好ASM实例,这些准备工作一切就绪之后。接下来,我们需要在物理备库机器上一步一步的配置physical dataguard。

1  主库执行RMAN备份的准备工作:

其实,在配置physical standby dataguard时,主库必须要置于归档模式,且建议将数据库也置于FORCE LOGGING模式。在这里,我们在系列一文章里查看主库基本信息中,已经看到这些已经准备就绪。否则,需要将主库置于归档+FORCE LOGGING模式,在这里就省略这一步骤,当然我们也可以通过下述得以确认。在主库的第一个节点上执行:

[root@oracle-rac1 ~]# su - oracle
[oracle@oracle-rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? glndb
[oracle@oracle-rac1 ~]$ export ORACLE_SID=glndb1
[oracle@oracle-rac1 ~]$ env | grep ORA
ORACLE_SID=glndb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
[oracle@oracle-rac1 ~]$ /u01/app/oracle/product/10.2.0/crs/bin/crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.glndb.db   application    ONLINE    ONLINE    oracle-rac2 
ora...._svc.cs application    ONLINE    ONLINE    oracle-rac1 
ora....db1.srv application    ONLINE    ONLINE    oracle-rac2 
ora....b1.inst application    ONLINE    ONLINE    oracle-rac1 
ora....b2.inst application    ONLINE    ONLINE    oracle-rac2 
ora....svc2.cs application    ONLINE    ONLINE    oracle-rac2 
ora....db2.srv application    ONLINE    ONLINE    oracle-rac2 
ora....SM1.asm application    ONLINE    ONLINE    oracle-rac1 
ora....C1.lsnr application    ONLINE    ONLINE    oracle-rac1 
ora....ac1.gsd application    ONLINE    ONLINE    oracle-rac1 
ora....ac1.ons application    ONLINE    ONLINE    oracle-rac1 
ora....ac1.vip application    ONLINE    ONLINE    oracle-rac1 
ora....SM2.asm application    ONLINE    ONLINE    oracle-rac2 
ora....C2.lsnr application    ONLINE    ONLINE    oracle-rac2 
ora....ac2.gsd application    ONLINE    ONLINE    oracle-rac2 
ora....ac2.ons application    ONLINE    ONLINE    oracle-rac2 
ora....ac2.vip application    ONLINE    ONLINE    oracle-rac2 
[oracle@oracle-rac1 ~]$
[oracle@oracle-rac1 ~]$ sqlplus

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Feb 16 10:27:39 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn / as sysdba
Connected.
SQL> select name,log_mode,force_logging from gv$database;

NAME      LOG_MODE     FOR
--------- ------------ ---
GLNDB     ARCHIVELOG   YES
GLNDB     ARCHIVELOG   YES

SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      glndb1
SQL> show parameter db_unique_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      glndb 
SQL> set line 160
SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1       7706   52428800          1 NO  CURRENT              445956133 16-FEB-12
         2          1       7705   52428800          1 YES INACTIVE             445918203 15-FEB-12
         4          2       3273   52428800          1 NO  CURRENT              445956150 16-FEB-12
         5          2       3272   52428800          1 YES INACTIVE             445817248 15-FEB-12

SQL> show parameter log_archive

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string
log_archive_dest                     string
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string      location=/home/oracle/arch1
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_9                   string
log_archive_dest_state_1             string      defer
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_duplex_dest              string
log_archive_format                   string      ARC_%t_%S_%r.arc
log_archive_local_first              boolean     TRUE
log_archive_max_processes            integer     2
log_archive_min_succeed_dest         integer     1
log_archive_start                    boolean     FALSE
log_archive_trace                    integer     0
SQL> alter system set log_archive_dest_2='location=/home/oracle/arch1 valid_for=(all_logfiles,all_roles) db_unique_name=glndb' sid='glndb1';

System altered.

SQL> show parameter log_archive

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string
log_archive_dest                     string
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string      location=/home/oracle/arch1 va
                                                 lid_for=(all_logfiles,all_role
                                                 s) db_unique_name=glndb
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_7                   string
log_archive_dest_8                   string
log_archive_dest_9                   string
log_archive_dest_state_1             string      defer
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable
log_archive_duplex_dest              string
log_archive_format                   string      ARC_%t_%S_%r.arc
log_archive_local_first              boolean     TRUE
log_archive_max_processes            integer     2
log_archive_min_succeed_dest         integer     1
log_archive_start                    boolean     FALSE
log_archive_trace                    integer     0
SQL>

节点2连接SQL*PLUS登录数据库:

SQL> show parameter instance_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      glndb2
SQL> show parameter db_unique_name

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_unique_name                       string      glndb
SQL> show parameter log_archive

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string
log_archive_dest                     string
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string      location=/home/oracle/arch2
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_9                   string
log_archive_dest_state_1             string      DEFER
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_duplex_dest              string
log_archive_format                   string      ARC_%t_%S_%r.arc
log_archive_local_first              boolean     TRUE
log_archive_max_processes            integer     2
log_archive_min_succeed_dest         integer     1
log_archive_start                    boolean     FALSE
log_archive_trace                    integer     0
SQL> alter system set log_archive_dest_2='location=/home/oracle/arch2 valid_for=(all_logfiles,all_roles) db_unique_name=glndb' sid='glndb2';

System altered.

SQL> show parameter log_archive

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string
log_archive_dest                     string
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string      location=/home/oracle/arch2 va
                                                 lid_for=(all_logfiles,all_role
                                                 s) db_unique_name=glndb
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_7                   string
log_archive_dest_8                   string
log_archive_dest_9                   string
log_archive_dest_state_1             string      DEFER
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable
log_archive_duplex_dest              string
log_archive_format                   string      ARC_%t_%S_%r.arc
log_archive_local_first              boolean     TRUE
log_archive_max_processes            integer     2
log_archive_min_succeed_dest         integer     1
log_archive_start                    boolean     FALSE
log_archive_trace                    integer     0
SQL>

我们分别修改了两个节点的归档路径,节点1的归档指向/home/oracle/arch1,节点2的归档指向/home/oracle/arch2,这两个路径事先已经建好,这一步骤必须完成!

由于我们的RAC主库归档路径都各自指向本地存储,并没有放到共享存储上,所以,这里我们在用RMAN做备份的时候,需要连接到每个实例上进行备份。我们备份的路径分别指向每台机器的/oracle_backup,且在每个节点上也事先建好/oracle_backup路径,且确保oracle用户有对该路径的路写权限!

接下来,在节点1上执行备份,注意下述的rman备份命令中的GLNDB2连接字符串是连接到节点2的实例上,已经在节点1的/u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora事先配置好。

[oracle@oracle-rac1 ~]$ cat /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

GLNDB2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.36)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = glndb)
      (INSTANCE_NAME = glndb2)
    )
  )

GLNDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.35)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = glndb)
      (INSTANCE_NAME = glndb1)
    )
  )

GLNDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.35)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.36)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = glndb)
    )
  )
[oracle@oracle-rac1 ~]$

2  节点1上开始执行主库的RMAN备份:

[oracle@oracle-rac1 ~]$ env | grep ORA
ORACLE_SID=glndb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
[oracle@oracle-rac1 ~]$ rman

Recovery Manager: Release 10.2.0.5.0 - Production on Thu Feb 16 11:01:19 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: GLNDB (DBID=3995745524)

RMAN> show all;

RMAN configuration parameters are:
CONFIGURE RETENTION POLICY TO REDUNDANCY 1; # default
CONFIGURE BACKUP OPTIMIZATION ON;
CONFIGURE DEFAULT DEVICE TYPE TO DISK; # default
CONFIGURE CONTROLFILE AUTOBACKUP OFF; # default
CONFIGURE CONTROLFILE AUTOBACKUP FORMAT FOR DEVICE TYPE DISK TO '%F'; # default
CONFIGURE DEVICE TYPE DISK PARALLELISM 1 BACKUP TYPE TO BACKUPSET; # default
CONFIGURE DATAFILE BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE ARCHIVELOG BACKUP COPIES FOR DEVICE TYPE DISK TO 1; # default
CONFIGURE MAXSETSIZE TO UNLIMITED; # default
CONFIGURE ENCRYPTION FOR DATABASE OFF; # default
CONFIGURE ENCRYPTION ALGORITHM 'AES128'; # default
CONFIGURE ARCHIVELOG DELETION POLICY TO NONE; # default
CONFIGURE SNAPSHOT CONTROLFILE NAME TO '/u01/app/oracle/product/10.2.0/db_1/dbs/snapcf_glndb1.f'; # default

RMAN> list archivelog all;

using target database control file instead of recovery catalog
specification does not match any archive log in the recovery catalog

RMAN> list backup;


RMAN> report schema;

Report of database schema

List of Permanent Datafiles
===========================
File Size(MB) Tablespace           RB segs Datafile Name
---- -------- -------------------- ------- ------------------------
1    6039     SYSTEM               ***     +ORADATA/glndb/datafile/system.260.726057851
3    1290     SYSAUX               ***     +ORADATA/glndb/datafile/sysaux.262.726057863
4    150      UNDOTBS2             ***     +ORADATA/glndb/datafile/undotbs2.264.726057869
5    2        USERS                ***     +ORADATA/glndb/datafile/users.265.726057871
6    30       UNDOTBS3             ***     +ORADATA/glndb/datafile/undotbs3.268.774870843
169  2        EXAMPLE              ***     +ORADATA/glndb/datafile/example.435.756233417

List of Temporary Files
=======================
File Size(MB) Tablespace           Maxsize(MB) Tempfile Name
---- -------- -------------------- ----------- --------------------
1    10       TEMP                 32767       +ORADATA/glndb/tempfile/temp.263.726057865

RMAN> run {
2> allocate channel c1 device type disk format '/oracle_backup/full_%U' connect sys/oracle@glndb1;
3> allocate channel c2 device type disk format '/oracle_backup/full_%U' connect sys/oracle@glndb2;
4> backup database plus archivelog;
5> release channel c1;
6> release channel c2;
7> }

allocated channel: c1
channel c1: sid=396 instance=glndb1 devtype=DISK

allocated channel: c2
channel c2: sid=399 instance=glndb2 devtype=DISK


Starting backup at 2012/02/16 11:07:39
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=7706 recid=2116 stamp=775393668
channel c1: starting piece 1 at 2012/02/16 11:07:50
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=2 sequence=3273 recid=2115 stamp=775393663
channel c2: starting piece 1 at 2012/02/16 11:07:46
channel c1: finished piece 1 at 2012/02/16 11:07:52
piece handle=/oracle_backup/full_1mn3f4c6_1_1 tag=TAG20120216T110749 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:02
channel c2: finished piece 1 at 2012/02/16 11:07:55
piece handle=/oracle_backup/full_1nn3f4c2_1_1 tag=TAG20120216T110749 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:09
Finished backup at 2012/02/16 11:07:59

Starting backup at 2012/02/16 11:08:00
channel c1: starting full datafile backupset
channel c1: specifying datafile(s) in backupset
input datafile fno=00001 name=+ORADATA/glndb/datafile/system.260.726057851
input datafile fno=00005 name=+ORADATA/glndb/datafile/users.265.726057871
input datafile fno=00169 name=+ORADATA/glndb/datafile/example.435.756233417
channel c1: starting piece 1 at 2012/02/16 11:08:04
channel c2: starting full datafile backupset
channel c2: specifying datafile(s) in backupset
input datafile fno=00003 name=+ORADATA/glndb/datafile/sysaux.262.726057863
input datafile fno=00004 name=+ORADATA/glndb/datafile/undotbs2.264.726057869
input datafile fno=00006 name=+ORADATA/glndb/datafile/undotbs3.268.774870843
channel c2: starting piece 1 at 2012/02/16 11:08:00
channel c2: finished piece 1 at 2012/02/16 11:10:48
piece handle=/oracle_backup/full_1pn3f4cg_1_1 tag=TAG20120216T110803 comment=NONE
channel c2: backup set complete, elapsed time: 00:02:48
channel c2: starting full datafile backupset
channel c2: specifying datafile(s) in backupset
including current control file in backupset
channel c2: starting piece 1 at 2012/02/16 11:10:58
channel c2: finished piece 1 at 2012/02/16 11:11:06
piece handle=/oracle_backup/full_1qn3f4hp_1_1 tag=TAG20120216T110803 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:17
channel c2: starting full datafile backupset
channel c2: specifying datafile(s) in backupset
including current SPFILE in backupset
channel c2: starting piece 1 at 2012/02/16 11:11:07
channel c2: finished piece 1 at 2012/02/16 11:11:08
piece handle=/oracle_backup/full_1rn3f4ib_1_1 tag=TAG20120216T110803 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
channel c1: finished piece 1 at 2012/02/16 11:13:19
piece handle=/oracle_backup/full_1on3f4ck_1_1 tag=TAG20120216T110803 comment=NONE
channel c1: backup set complete, elapsed time: 00:05:15
Finished backup at 2012/02/16 11:13:19

Starting backup at 2012/02/16 11:13:19
current log archived
channel c1: starting archive log backupset
channel c1: specifying archive log(s) in backup set
input archive log thread=1 sequence=7707 recid=2117 stamp=775393999
channel c1: starting piece 1 at 2012/02/16 11:13:23
channel c2: starting archive log backupset
channel c2: specifying archive log(s) in backup set
input archive log thread=2 sequence=3274 recid=2118 stamp=775393996
channel c2: starting piece 1 at 2012/02/16 11:13:19
channel c1: finished piece 1 at 2012/02/16 11:13:24
piece handle=/oracle_backup/full_1sn3f4mj_1_1 tag=TAG20120216T111323 comment=NONE
channel c1: backup set complete, elapsed time: 00:00:01
channel c2: finished piece 1 at 2012/02/16 11:13:20
piece handle=/oracle_backup/full_1tn3f4mf_1_1 tag=TAG20120216T111323 comment=NONE
channel c2: backup set complete, elapsed time: 00:00:01
Finished backup at 2012/02/16 11:13:24

released channel: c1

released channel: c2

RMAN> list backup;


List of Backup Sets
===================

BS Key  Size       Device Type Elapsed Time Completion Time    
------- ---------- ----------- ------------ -------------------
48      26.34M     DISK        00:00:01     2012/02/16 11:07:51
        BP Key: 48   Status: AVAILABLE  Compressed: NO  Tag: TAG20120216T110749
        Piece Name: /oracle_backup/full_1mn3f4c6_1_1

  List of Archived Logs in backup set 48
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    7706    445956133  2012/02/16 01:33:55 446024208  2012/02/16 11:07:43

BS Key  Size       Device Type Elapsed Time Completion Time    
------- ---------- ----------- ------------ -------------------
49      10.56M     DISK        00:00:07     2012/02/16 11:07:53
        BP Key: 49   Status: AVAILABLE  Compressed: NO  Tag: TAG20120216T110749
        Piece Name: /oracle_backup/full_1nn3f4c2_1_1

  List of Archived Logs in backup set 49
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  2    3273    445956150  2012/02/16 01:33:53 446024205  2012/02/16 11:07:37

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
50      Full    1.08G      DISK        00:02:45     2012/02/16 11:10:45
        BP Key: 50   Status: AVAILABLE  Compressed: NO  Tag: TAG20120216T110803
        Piece Name: /oracle_backup/full_1pn3f4cg_1_1
  List of Datafiles in backup set 50
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  3       Full 446024239  2012/02/16 11:08:00 +ORADATA/glndb/datafile/sysaux.262.726057863
  4       Full 446024239  2012/02/16 11:08:00 +ORADATA/glndb/datafile/undotbs2.264.726057869
  6       Full 446024239  2012/02/16 11:08:00 +ORADATA/glndb/datafile/undotbs3.268.774870843

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
51      Full    15.30M     DISK        00:00:17     2012/02/16 11:11:06
        BP Key: 51   Status: AVAILABLE  Compressed: NO  Tag: TAG20120216T110803
        Piece Name: /oracle_backup/full_1qn3f4hp_1_1
  Control File Included: Ckp SCN: 446024474    Ckp time: 2012/02/16 11:10:49

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
52      Full    80.00K     DISK        00:00:01     2012/02/16 11:11:08
        BP Key: 52   Status: AVAILABLE  Compressed: NO  Tag: TAG20120216T110803
        Piece Name: /oracle_backup/full_1rn3f4ib_1_1
  SPFILE Included: Modification time: 2012/02/16 10:47:30

BS Key  Type LV Size       Device Type Elapsed Time Completion Time    
------- ---- -- ---------- ----------- ------------ -------------------
53      Full    5.81G      DISK        00:05:09     2012/02/16 11:13:13
        BP Key: 53   Status: AVAILABLE  Compressed: NO  Tag: TAG20120216T110803
        Piece Name: /oracle_backup/full_1on3f4ck_1_1
  List of Datafiles in backup set 53
  File LV Type Ckp SCN    Ckp Time            Name
  ---- -- ---- ---------- ------------------- ----
  1       Full 446024221  2012/02/16 11:08:04 +ORADATA/glndb/datafile/system.260.726057851
  5       Full 446024221  2012/02/16 11:08:04 +ORADATA/glndb/datafile/users.265.726057871
  169     Full 446024221  2012/02/16 11:08:04 +ORADATA/glndb/datafile/example.435.756233417

BS Key  Size       Device Type Elapsed Time Completion Time    
------- ---------- ----------- ------------ -------------------
54      46.50K     DISK        00:00:00     2012/02/16 11:13:19
        BP Key: 54   Status: AVAILABLE  Compressed: NO  Tag: TAG20120216T111323
        Piece Name: /oracle_backup/full_1tn3f4mf_1_1

  List of Archived Logs in backup set 54
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  2    3274    446024205  2012/02/16 11:07:37 446024635  2012/02/16 11:13:16

BS Key  Size       Device Type Elapsed Time Completion Time    
------- ---------- ----------- ------------ -------------------
55      80.00K     DISK        00:00:00     2012/02/16 11:13:23
        BP Key: 55   Status: AVAILABLE  Compressed: NO  Tag: TAG20120216T111323
        Piece Name: /oracle_backup/full_1sn3f4mj_1_1

  List of Archived Logs in backup set 55
  Thrd Seq     Low SCN    Low Time            Next SCN   Next Time
  ---- ------- ---------- ------------------- ---------- ---------
  1    7707    446024208  2012/02/16 11:07:43 446024632  2012/02/16 11:13:19

RMAN>

到各个节点的/oracle_backup路径下确认备份文件信息:

节点1:

[oracle@oracle-rac1 ~]$ cd /oracle_backup/ && ls -lh
total 5.9G
-rw-r----- 1 oracle oinstall  27M Feb 16 11:07 full_1mn3f4c6_1_1
-rw-r----- 1 oracle oinstall 5.9G Feb 16 11:13 full_1on3f4ck_1_1
-rw-r----- 1 oracle oinstall  81K Feb 16 11:13 full_1sn3f4mj_1_1
[oracle@oracle-rac1 oracle_backup]$

节点2:

[oracle@oracle-rac2 oracle_backup]$ ll -h
total 1.2G
-rw-r----- 1 oracle oinstall  11M Feb 16 11:07 full_1nn3f4c2_1_1
-rw-r----- 1 oracle oinstall 1.1G Feb 16 11:10 full_1pn3f4cg_1_1
-rw-r----- 1 oracle oinstall  16M Feb 16 11:11 full_1qn3f4hp_1_1
-rw-r----- 1 oracle oinstall  96K Feb 16 11:11 full_1rn3f4ib_1_1
-rw-r----- 1 oracle oinstall  47K Feb 16 11:13 full_1tn3f4mf_1_1
[oracle@oracle-rac2 oracle_backup]$

 

3  节点1上生成物理备库控制文件:

RMAN> backup device type disk format '/oracle_backup/standby_ctl_%U' current controlfile for standby;

Starting backup at 2012/02/16 11:21:22
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=411 instance=glndb1 devtype=DISK
channel ORA_DISK_1: starting full datafile backupset
channel ORA_DISK_1: specifying datafile(s) in backupset
including standby control file in backupset
channel ORA_DISK_1: starting piece 1 at 2012/02/16 11:21:26
channel ORA_DISK_1: finished piece 1 at 2012/02/16 11:21:33
piece handle=/oracle_backup/standby_ctl_1un3f55k_1_1 tag=TAG20120216T112123 comment=NONE
channel ORA_DISK_1: backup set complete, elapsed time: 00:00:09
Finished backup at 2012/02/16 11:21:33

RMAN>

确认物理备库控制文件信息:

[oracle@oracle-rac1 ~]$ cd /oracle_backup/ && ll
total 6140020
-rw-r----- 1 oracle oinstall   27619328 Feb 16 11:07 full_1mn3f4c6_1_1
-rw-r----- 1 oracle oinstall 6237437952 Feb 16 11:13 full_1on3f4ck_1_1
-rw-r----- 1 oracle oinstall      82432 Feb 16 11:13 full_1sn3f4mj_1_1
-rw-r----- 1 oracle oinstall   16056320 Feb 16 11:21 standby_ctl_1un3f55k_1_1
[oracle@oracle-rac1 oracle_backup]$

4  在主库创建物理备库的初始化参数文件:

[oracle@oracle-rac1 ~]$ sqlplus

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Feb 16 11:23:53 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn / as sysdba;
Connected.
SQL> show parameter instance_name;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
instance_name                        string      glndb1
SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +ORADATA/glndb/spfileglndb.ora
SQL> create pfile='/oracle_backup/initpridb.ora' from spfile;

File created.

SQL> !
[oracle@oracle-rac1 ~]$ cd /oracle_backup/ && ll -h
total 5.9G
-rw-r----- 1 oracle oinstall  27M Feb 16 11:07 full_1mn3f4c6_1_1
-rw-r----- 1 oracle oinstall 5.9G Feb 16 11:13 full_1on3f4ck_1_1
-rw-r----- 1 oracle oinstall  81K Feb 16 11:13 full_1sn3f4mj_1_1
-rw-r--r-- 1 oracle oinstall 2.3K Feb 16 11:25 initpridb.ora
-rw-r----- 1 oracle oinstall  16M Feb 16 11:21 standby_ctl_1un3f55k_1_1
[oracle@oracle-rac1 oracle_backup]$

5  分别FTP两个节点上/oracle_backup下的所有文件到备库机器172.16.0.202上的/oracle_backup路径下,备库机器的/oracle_backup路径在系列2中创建磁盘的那一节里已经提到过,现在就派上了用场!

节点1上:

[oracle@oracle-rac1 oracle_backup]$ pwd
/oracle_backup
[oracle@oracle-rac1 oracle_backup]$ ll
total 6140028
-rw-r----- 1 oracle oinstall   27619328 Feb 16 11:07 full_1mn3f4c6_1_1
-rw-r----- 1 oracle oinstall 6237437952 Feb 16 11:13 full_1on3f4ck_1_1
-rw-r----- 1 oracle oinstall      82432 Feb 16 11:13 full_1sn3f4mj_1_1
-rw-r--r-- 1 oracle oinstall       2324 Feb 16 11:25 initpridb.ora
-rw-r----- 1 oracle oinstall   16056320 Feb 16 11:21 standby_ctl_1un3f55k_1_1
[oracle@oracle-rac1 oracle_backup]$ scp * oracle@172.16.0.202:/oracle_backup
The authenticity of host '172.16.0.202 (172.16.0.202)' can't be established.
RSA key fingerprint is 87:6f:ef:3c:d2:e9:6b:c2:11:36:3d:75:22:77:e2:f3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.0.202' (RSA) to the list of known hosts.
oracle@172.16.0.202's password: 
full_1mn3f4c6_1_1                                                                                 100%   26MB   2.6MB/s   00:10    
full_1on3f4ck_1_1                                                                                 100% 5948MB   2.0MB/s   49:29    
full_1sn3f4mj_1_1                                                                                 100%   81KB  80.5KB/s   00:00    
initpridb.ora                                                                                     100% 2324     2.3KB/s   00:00    
standby_ctl_1un3f55k_1_1                                                                          100%   15MB  15.3MB/s   00:01    
[oracle@oracle-rac1 oracle_backup]$

节点2上:

[oracle@oracle-rac2 ~]$ cd /oracle_backup/
[oracle@oracle-rac2 oracle_backup]$ ll
total 1155632
-rw-r----- 1 oracle oinstall   11072000 Feb 16 11:07 full_1nn3f4c2_1_1
-rw-r----- 1 oracle oinstall 1154891776 Feb 16 11:10 full_1pn3f4cg_1_1
-rw-r----- 1 oracle oinstall   16056320 Feb 16 11:11 full_1qn3f4hp_1_1
-rw-r----- 1 oracle oinstall      98304 Feb 16 11:11 full_1rn3f4ib_1_1
-rw-r----- 1 oracle oinstall      48128 Feb 16 11:13 full_1tn3f4mf_1_1
[oracle@oracle-rac2 oracle_backup]$ scp * oracle@172.16.0.202:/oracle_backup
The authenticity of host '172.16.0.202 (172.16.0.202)' can't be established.
RSA key fingerprint is 87:6f:ef:3c:d2:e9:6b:c2:11:36:3d:75:22:77:e2:f3.
Are you sure you want to continue connecting (yes/no)? yes
Warning: Permanently added '172.16.0.202' (RSA) to the list of known hosts.
oracle@172.16.0.202's password: 
full_1nn3f4c2_1_1                                                                                 100%   11MB   5.3MB/s   00:02    
full_1pn3f4cg_1_1                                                                                 100% 1101MB   1.8MB/s   10:15    
full_1qn3f4hp_1_1                                                                                 100%   15MB   7.7MB/s   00:02    
full_1rn3f4ib_1_1                                                                                 100%   96KB  96.0KB/s   00:00    
full_1tn3f4mf_1_1                                                                                 100%   47KB  47.0KB/s   00:00    
[oracle@oracle-rac2 oracle_backup]$

物理备库机器上确认:

[oracle@ora10grac-dg ~]$ cd /oracle_backup/
[oracle@ora10grac-dg oracle_backup]$ ll
total 7295636
-rw-r----- 1 oracle oinstall   27619328 Feb 16 11:32 full_1mn3f4c6_1_1
-rw-r----- 1 oracle oinstall   11072000 Feb 16 11:35 full_1nn3f4c2_1_1
-rw-r----- 1 oracle oinstall 6237437952 Feb 16 12:22 full_1on3f4ck_1_1
-rw-r----- 1 oracle oinstall 1154891776 Feb 16 11:46 full_1pn3f4cg_1_1
-rw-r----- 1 oracle oinstall   16056320 Feb 16 11:46 full_1qn3f4hp_1_1
-rw-r----- 1 oracle oinstall      98304 Feb 16 11:46 full_1rn3f4ib_1_1
-rw-r----- 1 oracle oinstall      82432 Feb 16 12:22 full_1sn3f4mj_1_1
-rw-r----- 1 oracle oinstall      48128 Feb 16 11:46 full_1tn3f4mf_1_1
-rw-r--r-- 1 oracle oinstall       2324 Feb 16 12:22 initpridb.ora
drwx------ 2 oracle oinstall      16384 Feb 15 13:52 lost+found
-rw-r----- 1 oracle oinstall   16056320 Feb 16 12:22 standby_ctl_1un3f55k_1_1
[oracle@ora10grac-dg oracle_backup]$

6  在备库上使用orapwd命令创建口令文件,要确保sys用户或者具有sysdba系统权限用户的口令要同主库两个节点上sys用户的口令一致。为简单起见,也可以在主库两个节点上分别修改sys用户口令为一致,然后,直接拷贝主库任意节点的口令文件到备库$ORACLE_HOME/dbs路径下,并且重命名为orapwSID,其中SID为备库上实例名,这里备库SID为pridb,,所以口令文件名应该为orapwpridb。

这里,在RAC两个节点上分别修改sys用户口令,然后,cp节点1下的口令文件到物理备库172.16.0.202的$ORACLE_HOME/dbs路径下,然后在备库上重命名该文件:

节点1:

[oracle@oracle-rac1 dbs]$ pwd
/u01/app/oracle/product/10.2.0/db_1/dbs
[oracle@oracle-rac1 dbs]$ ll
total 15716
-rw-rw---- 1 oracle oinstall     1544 Feb 14 16:58 hc_glndb1.dat
-rw-r--r-- 1 oracle oinstall    12920 May  3  2001 initdw.ora
-rw-r--r-- 1 oracle oinstall       40 Dec 31 01:28 initglndb1.ora
-rw-r----- 1 oracle oinstall     8385 Sep 11  1998 init.ora
-rw-r----- 1 oracle oinstall     2048 Feb 16 11:05 orapwglndb1
-rw-r----- 1 oracle oinstall 16007168 Feb 16 11:21 snapcf_glndb1.f
[oracle@oracle-rac1 dbs]$ scp orapwglndb1 172.16.0.202:/u01/app/oracle/dbs
oracle@172.16.0.202's password: 
orapwglndb1                                                                                       100% 2048     2.0KB/s   00:00    
[oracle@oracle-rac1 dbs]$

物理备库:

[oracle@ora10grac-dg dbs]$ env | grep ORA
ORACLE_SID=pridb
ORACLE_BASE=/u01/app
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/oracle
[oracle@ora10grac-dg dbs]$ pwd
/u01/app/oracle/dbs
[oracle@ora10grac-dg dbs]$ ll
total 52
-rw-rw---- 1 oracle oinstall   577 Feb 15 16:12 ab_+ASM.dat
-rw-rw---- 1 oracle oinstall  1544 Feb 15 16:12 hc_+ASM.dat
-rw-r--r-- 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-rw---- 1 oracle oinstall    24 Feb 15 16:12 lk+ASM
-rw-r----- 1 oracle oinstall  1536 Feb 15 16:12 orapw+ASM
-rw-r----- 1 oracle oinstall  2048 Feb 16 14:17 orapwglndb1
-rw-r----- 1 oracle oinstall  1536 Feb 15 16:18 spfile+ASM.ora
[oracle@ora10grac-dg dbs]$ mv orapwglndb1 orapwpridb
[oracle@ora10grac-dg dbs]$ ll
total 52
-rw-rw---- 1 oracle oinstall   577 Feb 15 16:12 ab_+ASM.dat
-rw-rw---- 1 oracle oinstall  1544 Feb 15 16:12 hc_+ASM.dat
-rw-r--r-- 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-rw---- 1 oracle oinstall    24 Feb 15 16:12 lk+ASM
-rw-r----- 1 oracle oinstall  1536 Feb 15 16:12 orapw+ASM
-rw-r----- 1 oracle oinstall  2048 Feb 16 14:17 orapwpridb
-rw-r----- 1 oracle oinstall  1536 Feb 15 16:18 spfile+ASM.ora
[oracle@ora10grac-dg dbs]$

7   配置主备库3台机器上的tnsnames.ora文件,使之三个$ORACLE_HOME/network/admin/tnsnames.ora文件内容完全一致!修改后,如下:

[oracle@ora10grac-dg admin]$ pwd
/u01/app/oracle/network/admin
[oracle@ora10grac-dg admin]$ ll
total 16
-rw-r--r-- 1 oracle oinstall  468 Feb 15 09:16 listener.ora
drwxr-x--- 2 oracle oinstall 4096 Feb 14 16:28 samples
-rw-r--r-- 1 oracle oinstall  172 Dec 26  2003 shrept.lst
-rw-r--r-- 1 oracle oinstall 1017 Feb 16 14:31 tnsnames.ora
[oracle@ora10grac-dg admin]$ cat tnsnames.ora 
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.0/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.

GLNDB2 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.36)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = glndb)
      (INSTANCE_NAME = glndb2)
    )
  )

GLNDB1 =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.35)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = glndb)
      (INSTANCE_NAME = glndb1)
    )
  )

GLNDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.35)(PORT = 1521))
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.36)(PORT = 1521))
    (LOAD_BALANCE = yes)
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = glndb)
    )
  )

PRIDB =
  (DESCRIPTION =
    (ADDRESS = (PROTOCOL = TCP)(HOST = 172.16.0.202)(PORT = 1521))
    (CONNECT_DATA =
      (SERVER = DEDICATED)
      (SERVICE_NAME = pridb)
    )
  )
[oracle@ora10grac-dg admin]$

 

8   确保主、备库3台机器上的listener工作正常,并且在备库上利用上述的tnsnames.ora文件来分别访问两个节点:

[oracle@ora10grac-dg admin]$ sqlplus

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Feb 16 15:06:40 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn human/hr@glndb
Connected.
SQL> conn human/hr@glndb1
Connected.
SQL> conn human/hr@glndb2
Connected.
SQL> conn sys/oracle@glndb as sysdba
Connected.
SQL> conn sys/oracle@glndb1 as sysdba
Connected.
SQL> conn sys/oracle@glndb2 as sysdba
Connected.
SQL> 

9  在备库上修改初始化参数文件,去掉所有的RAC参数,修改后如下:

[oracle@ora10grac-dg dbs]$ pwd
/u01/app/oracle/dbs
[oracle@ora10grac-dg dbs]$ ll
total 52
-rw-rw---- 1 oracle oinstall   577 Feb 15 16:12 ab_+ASM.dat
-rw-rw---- 1 oracle oinstall  1544 Feb 15 16:12 hc_+ASM.dat
-rw-r--r-- 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-rw---- 1 oracle oinstall    24 Feb 15 16:12 lk+ASM
-rw-r----- 1 oracle oinstall  1536 Feb 15 16:12 orapw+ASM
-rw-r----- 1 oracle oinstall  2048 Feb 16 14:17 orapwpridb
-rw-r----- 1 oracle oinstall  1536 Feb 15 16:18 spfile+ASM.ora
[oracle@ora10grac-dg dbs]$ cp /oracle_backup/initpridb.ora .
[oracle@ora10grac-dg dbs]$ ll
total 56
-rw-rw---- 1 oracle oinstall   577 Feb 15 16:12 ab_+ASM.dat
-rw-rw---- 1 oracle oinstall  1544 Feb 15 16:12 hc_+ASM.dat
-rw-r--r-- 1 oracle oinstall 12920 May  3  2001 initdw.ora
-rw-r----- 1 oracle oinstall  8385 Sep 11  1998 init.ora
-rw-r--r-- 1 oracle oinstall  2324 Feb 16 15:16 initpridb.ora
-rw-rw---- 1 oracle oinstall    24 Feb 15 16:12 lk+ASM
-rw-r----- 1 oracle oinstall  1536 Feb 15 16:12 orapw+ASM
-rw-r----- 1 oracle oinstall  2048 Feb 16 14:17 orapwpridb
-rw-r----- 1 oracle oinstall  1536 Feb 15 16:18 spfile+ASM.ora
[oracle@ora10grac-dg dbs]$ cat initpridb.ora 
*.audit_file_dest='/u01/app/admin/pridb/adump'
*.background_dump_dest='/u01/app/admin/pridb/bdump'
*.cluster_database=false
*.compatible='10.2.0.5.0'
*.control_files='+ORADATA/pridb/controlfile'
*.core_dump_dest='/u01/app/admin/pridb/cdump'
*.db_block_size=8192
*.db_create_file_dest='+ORADATA'
*.db_domain=''
*.db_file_multiblock_read_count=16
*.db_files=300
*.db_name='glndb'
*.db_unique_name='pridb'
*.disk_asynch_io=TRUE
*.dispatchers='(PROTOCOL=TCP) (SERVICE=glndbXDB)'
*.event='10298 trace name context forever, level 32'
*.global_names=FALSE
*.job_queue_processes=10
*.log_archive_config='dg_config=(glndb,pridb)'
*.log_archive_dest_2='location=/home/oracle/arch2 valid_for=(all_logfiles,all_roles) db_unique_name=pridb'
*.log_archive_dest_1='service=glndb1 lgwr sync valid_for=(online_logfiles,primary_roles) db_unique_name=glndb'
*.log_archive_dest_state_1='enable'
*.log_archive_dest_state_2='enable'
*.log_archive_format='ARC_%t_%S_%r.arc'
*.nls_length_semantics='CHAR'
*.open_cursors=300
*.pga_aggregate_target=1034944512
*.processes=400
*.remote_login_passwordfile='exclusive'
*.sessions=445
*.sga_target=1610612736
*.thread=1
*.undo_management='AUTO'
*.undo_tablespace='UNDOTBS3'
*.user_dump_dest='/u01/app/admin/pridb/udump'
*.db_file_name_convert='+ORADATA/glndb/','+ORADATA/pridb/'
*.log_file_name_convert='+ORADATA/glndb/','+ORADATA/pridb/'
*.standby_file_management='auto'
*.fal_server='glndb1','glndb2'
*.fal_client='pridb'
*.service_names='pridb'
[oracle@ora10grac-dg dbs]$

依据上述的参数文件配置,在物理备库上建立相应的路径:

[oracle@ora10grac-dg ~]$ cd /u01/app/admin/
[oracle@ora10grac-dg admin]$ pwd
/u01/app/admin
[oracle@ora10grac-dg admin]$ ll
total 4
drwxr-x--- 6 oracle oinstall 4096 Feb 15 16:12 +ASM
[oracle@ora10grac-dg admin]$ mkdir -p pridb/{a,b,c,u}dump
[oracle@ora10grac-dg admin]$ ll
total 8
drwxr-x--- 6 oracle oinstall 4096 Feb 15 16:12 +ASM
drwxr-xr-x 6 oracle oinstall 4096 Feb 16 15:52 pridb
[oracle@ora10grac-dg admin]$ cd pridb/
[oracle@ora10grac-dg glndb]$ ll
total 16
drwxr-xr-x 2 oracle oinstall 4096 Feb 16 15:52 adump
drwxr-xr-x 2 oracle oinstall 4096 Feb 16 15:52 bdump
drwxr-xr-x 2 oracle oinstall 4096 Feb 16 15:52 cdump
drwxr-xr-x 2 oracle oinstall 4096 Feb 16 15:52 udump 
[oracle@ora10grac-dg glndb~]$ mkdir -p /home/oracle/arch2
[oracle@ora10grac-dg glndb~]$

同时, 依据上述的参数文件配置,在物理备库的ASM实例中上建立相应的路径:

[root@ora10grac-dg ~]# su - oracle
[oracle@ora10grac-dg ~]$ export ORACLE_SID=+ASM
[oracle@ora10grac-dg ~]$ sqlplus

SQL*Plus: Release 10.2.0.5.0 - Production on Thu Feb 16 16:25:00 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn / as sysdba
Connected.
SQL> select name from v$asm_diskgroup;

NAME
--------------------------------------------------------------------------------
ORADATA

SQL> alter diskgroup oradata add directory '+ORADATA/PRIDB';

Diskgroup altered.

SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ora10grac-dg ~]$ asmcmd
ASMCMD> ls
ORADATA/
ASMCMD> cd oradata
ASMCMD> ls
PRIDB/
ASMCMD> exit
[oracle@ora10grac-dg ~]$

10  启动备库至nomount状态:

 [root@ora10grac-dg ~]# su - oracle
[oracle@ora10grac-dg ~]$ env | grep ORA
ORACLE_SID=pridb
ORACLE_BASE=/u01/app
ORACLE_TERM=xterm
ORACLE_HOME=/u01/app/oracle
[oracle@ora10grac-dg ~]$ ps -ef | grep asm_
oracle    4074     1  0 Feb16 ?        00:00:05 asm_pmon_+ASM
oracle    4076     1  0 Feb16 ?        00:00:01 asm_psp0_+ASM
oracle    4078     1  0 Feb16 ?        00:00:01 asm_mman_+ASM
oracle    4080     1  0 Feb16 ?        00:00:01 asm_dbw0_+ASM
oracle    4082     1  0 Feb16 ?        00:00:01 asm_lgwr_+ASM
oracle    4084     1  0 Feb16 ?        00:00:01 asm_ckpt_+ASM
oracle    4086     1  0 Feb16 ?        00:00:01 asm_smon_+ASM
oracle    4088     1  0 Feb16 ?        00:00:01 asm_rbal_+ASM
oracle    4090     1  0 Feb16 ?        00:00:04 asm_gmon_+ASM
oracle    7431  7400  0 09:45 pts/2    00:00:00 grep asm_
[oracle@ora10grac-dg ~]$ ps -ef | grep ora_
oracle    7435  7400  0 09:45 pts/2    00:00:00 grep ora_
[oracle@ora10grac-dg ~]$ sqlplus

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 17 09:45:50 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn / as sysdba
Connected to an idle instance.
SQL> startup nomount;
ORACLE instance started.

Total System Global Area 1610612736 bytes
Fixed Size                  2096632 bytes
Variable Size             385876488 bytes
Database Buffers         1207959552 bytes
Redo Buffers               14680064 bytes
SQL> !
[oracle@ora10grac-dg ~]$ ps -ef | grep ora_
oracle    7440     1  0 09:45 ?        00:00:00 ora_pmon_pridb
oracle    7442     1  0 09:45 ?        00:00:00 ora_psp0_pridb
oracle    7444     1  4 09:45 ?        00:00:01 ora_mman_pridb
oracle    7446     1  0 09:45 ?        00:00:00 ora_dbw0_pridb
oracle    7448     1  0 09:45 ?        00:00:00 ora_lgwr_pridb
oracle    7450     1  0 09:45 ?        00:00:00 ora_ckpt_pridb
oracle    7452     1  0 09:45 ?        00:00:00 ora_smon_pridb
oracle    7454     1  0 09:45 ?        00:00:00 ora_reco_pridb
oracle    7456     1  0 09:45 ?        00:00:00 ora_cjq0_pridb
oracle    7458     1  0 09:45 ?        00:00:00 ora_mmon_pridb
oracle    7460     1  0 09:45 ?        00:00:00 ora_mmnl_pridb
oracle    7462     1  0 09:45 ?        00:00:00 ora_d000_pridb
oracle    7464     1  0 09:45 ?        00:00:00 ora_s000_pridb
oracle    7491  7466  0 09:46 pts/4    00:00:00 grep ora_
[oracle@ora10grac-dg ~]$ 

11 备库恢复:

首先,RMAN连接物理备库,恢复备库控制文件:

[oracle@ora10grac-dg ~]$ rlwrap rman target /

Recovery Manager: Release 10.2.0.5.0 - Production on Fri Feb 17 10:03:25 2012

Copyright (c) 1982, 2007, Oracle.  All rights reserved.

connected to target database: glndb (not mounted)

RMAN> restore standby controlfile from '/oracle_backup/standby_ctl_1un3f55k_1_1';

Starting restore at 2012/02/17 10:03:35
using target database control file instead of recovery catalog
allocated channel: ORA_DISK_1
channel ORA_DISK_1: sid=431 devtype=DISK

channel ORA_DISK_1: restoring control file
channel ORA_DISK_1: restore complete, elapsed time: 00:00:07
output filename=+ORADATA/pridb/control.ctl
Finished restore at 2012/02/17 10:03:44

RMAN> host;

[oracle@ora10grac-dg ~]$ export ORACLE_SID=+ASM
[oracle@ora10grac-dg ~]$ asmcmd
ASMCMD> ls
ORADATA/
ASMCMD> cd oradata
ASMCMD> ls
PRIDB/
ASMCMD> cd pridb
ASMCMD> ls
CONTROLFILE/
control.ctl
ASMCMD> cd controlfile
ASMCMD> ls
current.256.775476221
ASMCMD> exit
[oracle@ora10grac-dg ~]$ export ORACLE_SID=pridb
[oracle@ora10grac-dg ~]$ rlwrap sqlplus / as sysdba

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 17 10:06:01 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, OLAP, Data Mining and Real Application Testing options

SQL> set line 160
SQL> show parameter control

NAME                                 TYPE                                         VALUE
------------------------------------ -------------------------------------------- ------------------------------
control_file_record_keep_time        integer                                      7
control_files                        string                                       +ORADATA/pridb/control.ctl
SQL> exit
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bit Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
[oracle@ora10grac-dg ~]$ exit
exit
host command complete

RMAN>

然后,在确认物理备库控制文件恢复成功后,将物理备库置于MOUNT状态,接下来restore物理备库:

RMAN> alter database mount;

database mounted
released channel: ORA_DISK_1

RMAN> run {
2> allocate channel c1 type disk;
3> allocate channel c2 type disk;
4> restore database;
5> release channel c1;
6> release channel c2;
7> }

allocated channel: c1
channel c1: sid=431 devtype=DISK

allocated channel: c2
channel c2: sid=430 devtype=DISK

Starting restore at 2012/02/17 10:14:18

channel c1: starting datafile backupset restore
channel c1: specifying datafile(s) to restore from backup set
restoring datafile 00003 to +ORADATA/pridb/datafile/sysaux.262.726057863
restoring datafile 00004 to +ORADATA/pridb/datafile/undotbs2.264.726057869
restoring datafile 00006 to +ORADATA/pridb/datafile/undotbs3.268.774870843
channel c1: reading from backup piece /oracle_backup/full_1pn3f4cg_1_1
channel c2: starting datafile backupset restore
channel c2: specifying datafile(s) to restore from backup set
restoring datafile 00001 to +ORADATA/pridb/datafile/system.260.726057851
restoring datafile 00005 to +ORADATA/pridb/datafile/users.265.726057871
restoring datafile 00169 to +ORADATA/pridb/datafile/example.435.756233417
channel c2: reading from backup piece /oracle_backup/full_1on3f4ck_1_1
channel c1: restored backup piece 1
piece handle=/oracle_backup/full_1pn3f4cg_1_1 tag=TAG20120216T110803
channel c1: restore complete, elapsed time: 00:19:47
channel c2: restored backup piece 1
piece handle=/oracle_backup/full_1on3f4ck_1_1 tag=TAG20120216T110803
channel c2: restore complete, elapsed time: 00:23:23
Finished restore at 2012/02/17 10:37:50

released channel: c1

released channel: c2

RMAN> exit


Recovery Manager complete.
[oracle@ora10grac-dg ~]$

其次,SQL*PLUS连接物理备库,确认状态:

[oracle@ora10grac-dg ~]$ sqlplus

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 17 10:39:58 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn / as sysdba
Connected.
SQL> select name from v$datafile
  2  union
  3  select name from v$controlfile
  4  union
  5  select member from v$logfile
  6  ;

NAME
--------------------------------------------------------------------------------
+ORADATA/pridb/control.ctl
+ORADATA/pridb/datafile/example.261.775476929
+ORADATA/pridb/datafile/sysaux.257.775476887
+ORADATA/pridb/datafile/system.258.775476897
+ORADATA/pridb/datafile/undotbs2.259.775476909
+ORADATA/pridb/datafile/undotbs3.262.775476939
+ORADATA/pridb/datafile/users.260.775476921
+ORADATA/pridb/onlinelog/group_1.257.726057849
+ORADATA/pridb/onlinelog/group_2.258.726057849
+ORADATA/pridb/onlinelog/group_4.266.726058757
+ORADATA/pridb/onlinelog/group_5.267.726058757

11 rows selected.
SQL> set line 160
SQL> select dbid,name,switchover_status,db_unique_name,database_role,open_mode,current_scn from v$database;

      DBID NAME      SWITCHOVER DB_UNIQUE_ DATABASE_ROLE        OPEN_MODE  CURRENT_SCN
---------- --------- ---------- ---------- -------------------- ---------- -----------
3995745524 GLNDB     TO PRIMARY pridb      PHYSICAL STANDBY     MOUNTED      446025625

SQL>

最后,至此,物理备库已经成功恢复!

12     在备库上创建standby logfile:

创建之前:

SQL> col status for a10
SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARCHIVED     STATUS     FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- ------------ ---------- ------------- -------------------
         1          1       7708   52428800          1 NO           CURRENT        446024632 2012/02/16 11:13:19
         2          1       7707   52428800          1 YES          INACTIVE       446024208 2012/02/16 11:07:43
         4          2       3275   52428800          1 NO           CURRENT        446024635 2012/02/16 11:13:16
         5          2       3274   52428800          1 YES          INACTIVE       446024205 2012/02/16 11:07:37

SQL> col member for a50
SQL> select * from v$logfile;

    GROUP# STATUS     TYPE                         MEMBER                                             IS_RECOVERY_
---------- ---------- ---------------------------- -------------------------------------------------- ------------
         1            ONLINE                       +ORADATA/pridb/onlinelog/group_1.257.726057849     NO
         2            ONLINE                       +ORADATA/pridb/onlinelog/group_2.258.726057849     NO
         4            ONLINE                       +ORADATA/pridb/onlinelog/group_4.266.726058757     NO
         5            ONLINE                       +ORADATA/pridb/onlinelog/group_5.267.726058757     NO

SQL> select * from v$standby_log;

no rows selected

SQL>

开始创建:

SQL> alter database add standby logfile thread 1 group 3 size 50m,group 6 size 50m,group 7 size 50m;

Database altered.

SQL> alter database add standby logfile thread 2 group 8 size 50m,group 9 size 50m,group 10 size 50m;

Database altered.

SQL>

创建之后:

SQL> select * from v$standby_log;

    GROUP# DBID          THREAD#  SEQUENCE#      BYTES       USED ARCHIVED     STATUS     FIRST_CHANGE# FIRST_TIME          LAST_CHANGE# LAST_TIME
---------- ---------- ---------- ---------- ---------- ---------- ------------ ---------- ------------- ------------------- ------------ -------------------
         3 UNASSIGNED          1          0   52428800        512 YES          UNASSIGNED             0                                0
         6 UNASSIGNED          1          0   52428800        512 YES          UNASSIGNED             0                                0
         7 UNASSIGNED          1          0   52428800        512 YES          UNASSIGNED             0                                0
         8 UNASSIGNED          2          0   52428800        512 YES          UNASSIGNED             0                                0
         9 UNASSIGNED          2          0   52428800        512 YES          UNASSIGNED             0                                0
        10 UNASSIGNED          2          0   52428800        512 YES          UNASSIGNED             0                                0

6 rows selected.

SQL> select * from v$logfile;

    GROUP# STATUS     TYPE                         MEMBER                                             IS_RECOVERY_
---------- ---------- ---------------------------- -------------------------------------------------- ------------
         1            ONLINE                       +ORADATA/pridb/onlinelog/group_1.257.726057849     NO
         2            ONLINE                       +ORADATA/pridb/onlinelog/group_2.258.726057849     NO
         3            STANDBY                      +ORADATA/pridb/onlinelog/group_3.263.775479203     NO
         4            ONLINE                       +ORADATA/pridb/onlinelog/group_4.266.726058757     NO
         5            ONLINE                       +ORADATA/pridb/onlinelog/group_5.267.726058757     NO
         6            STANDBY                      +ORADATA/pridb/onlinelog/group_6.264.775479205     NO
         7            STANDBY                      +ORADATA/pridb/onlinelog/group_7.265.775479205     NO
         8            STANDBY                      +ORADATA/pridb/onlinelog/group_8.266.775479229     NO
         9            STANDBY                      +ORADATA/pridb/onlinelog/group_9.267.775479229     NO
        10            STANDBY                      +ORADATA/pridb/onlinelog/group_10.268.775479231    NO

10 rows selected.

SQL>

13    备库启动redo apply:

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

Database altered.

SQL> select sequence#,name,first_time,next_time,applied from v$archived_log;

no rows selected

SQL> col switchover_status for a16
SQL> select dbid,name,switchover_status,db_unique_name,database_role,open_mode,current_scn from v$database;

      DBID NAME      SWITCHOVER_STATU DB_UNIQUE_ DATABASE_ROLE        OPEN_MODE  CURRENT_SCN
---------- --------- ---------------- ---------- -------------------- ---------- -----------
3995745524 GLNDB     SESSIONS ACTIVE  pridb      PHYSICAL STANDBY     MOUNTED      446025625

SQL> select sequence#,name,first_time,next_time,applied from v$archived_log;

no rows selected

SQL>

发现,这时候,备库根本没有应用归档日志,且从alert日志里可以看到下述信息:

alter database add standby logfile thread 1 group 3 size 50m,group 6 size 50m,group 7 size 50m
Fri Feb 17 10:53:26 CST 2012
Completed: alter database add standby logfile thread 1 group 3 size 50m,group 6 size 50m,group 7 size 50m
Fri Feb 17 10:53:49 CST 2012
alter database add standby logfile thread 2 group 8 size 50m,group 9 size 50m,group 10 size 50m
Fri Feb 17 10:53:51 CST 2012
Completed: alter database add standby logfile thread 2 group 8 size 50m,group 9 size 50m,group 10 size 50m
Fri Feb 17 11:02:26 CST 2012
alter database recover managed standby database using current logfile disconnect from session
Fri Feb 17 11:02:26 CST 2012
Attempt to start background Managed Standby Recovery process (pridb)
MRP0 started with pid=16, OS id=7915
Fri Feb 17 11:02:26 CST 2012
MRP0: Background Managed Standby Recovery process started (pridb)
Managed Standby Recovery starting Real Time Apply
 parallel recovery started with 3 processes
Fri Feb 17 11:02:33 CST 2012
Waiting for all non-current ORLs to be archived...
Fri Feb 17 11:02:33 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '+ORADATA/pridb/onlinelog/group_1.257.726057849'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_1.257.726057849
ORA-15012: ASM file '+ORADATA/pridb/onlinelog/group_1.257.726057849' does not exist
Fri Feb 17 11:02:33 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '+ORADATA/pridb/onlinelog/group_1.257.726057849'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_1.257.726057849
ORA-15012: ASM file '+ORADATA/pridb/onlinelog/group_1.257.726057849' does not exist
Clearing online redo logfile 1 +ORADATA/pridb/onlinelog/group_1.257.726057849
Clearing online log 1 of thread 1 sequence number 7708
Fri Feb 17 11:02:33 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 1 of thread 1
ORA-00312: online log 1 thread 1: '+ORADATA/pridb/onlinelog/group_1.257.726057849'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_1.257.726057849
ORA-15173: entry 'group_1.257.726057849' does not exist in directory 'onlinelog'
Deleted Oracle managed file +ORADATA/pridb/onlinelog/group_1.257.726057849
Fri Feb 17 11:02:33 CST 2012
Completed: alter database recover managed standby database using current logfile disconnect from session
Fri Feb 17 11:02:35 CST 2012
Clearing online redo logfile 1 complete
Fri Feb 17 11:02:35 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '+ORADATA/pridb/onlinelog/group_2.258.726057849'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_2.258.726057849
ORA-15012: ASM file '+ORADATA/pridb/onlinelog/group_2.258.726057849' does not exist
Fri Feb 17 11:02:35 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '+ORADATA/pridb/onlinelog/group_2.258.726057849'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_2.258.726057849
ORA-15012: ASM file '+ORADATA/pridb/onlinelog/group_2.258.726057849' does not exist
Clearing online redo logfile 2 +ORADATA/pridb/onlinelog/group_2.258.726057849
Clearing online log 2 of thread 1 sequence number 7707
Fri Feb 17 11:02:35 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 2 of thread 1
ORA-00312: online log 2 thread 1: '+ORADATA/pridb/onlinelog/group_2.258.726057849'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_2.258.726057849
ORA-15173: entry 'group_2.258.726057849' does not exist in directory 'onlinelog'
Deleted Oracle managed file +ORADATA/pridb/onlinelog/group_2.258.726057849
Clearing online redo logfile 2 complete
Fri Feb 17 11:02:35 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 4 of thread 2
ORA-00312: online log 4 thread 2: '+ORADATA/pridb/onlinelog/group_4.266.726058757'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_4.266.726058757
ORA-15012: ASM file '+ORADATA/pridb/onlinelog/group_4.266.726058757' does not exist
Fri Feb 17 11:02:35 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 4 of thread 2
ORA-00312: online log 4 thread 2: '+ORADATA/pridb/onlinelog/group_4.266.726058757'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_4.266.726058757
ORA-15012: ASM file '+ORADATA/pridb/onlinelog/group_4.266.726058757' does not exist
Clearing online redo logfile 4 +ORADATA/pridb/onlinelog/group_4.266.726058757
Clearing online log 4 of thread 2 sequence number 3275
Fri Feb 17 11:02:35 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 4 of thread 2
ORA-00312: online log 4 thread 2: '+ORADATA/pridb/onlinelog/group_4.266.726058757'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_4.266.726058757
ORA-15173: entry 'group_4.266.726058757' does not exist in directory 'onlinelog'
Deleted Oracle managed file +ORADATA/pridb/onlinelog/group_4.266.726058757
Clearing online redo logfile 4 complete
Fri Feb 17 11:02:36 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 5 of thread 2
ORA-00312: online log 5 thread 2: '+ORADATA/pridb/onlinelog/group_5.267.726058757'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_5.267.726058757
ORA-15012: ASM file '+ORADATA/pridb/onlinelog/group_5.267.726058757' does not exist
Fri Feb 17 11:02:36 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 5 of thread 2
ORA-00312: online log 5 thread 2: '+ORADATA/pridb/onlinelog/group_5.267.726058757'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_5.267.726058757
ORA-15012: ASM file '+ORADATA/pridb/onlinelog/group_5.267.726058757' does not exist
Clearing online redo logfile 5 +ORADATA/pridb/onlinelog/group_5.267.726058757
Clearing online log 5 of thread 2 sequence number 3274
Fri Feb 17 11:02:36 CST 2012
Errors in file /u01/app/admin/pridb/bdump/pridb_mrp0_7915.trc:
ORA-00313: open failed for members of log group 5 of thread 2
ORA-00312: online log 5 thread 2: '+ORADATA/pridb/onlinelog/group_5.267.726058757'
ORA-17503: ksfdopn:2 Failed to open file +ORADATA/pridb/onlinelog/group_5.267.726058757
ORA-15173: entry 'group_5.267.726058757' does not exist in directory 'onlinelog'
Deleted Oracle managed file +ORADATA/pridb/onlinelog/group_5.267.726058757
Clearing online redo logfile 5 complete
Media Recovery Waiting for thread 1 sequence 7707

 

从上述的错误信息,可以看到备库整等待主库第一个节点上的日志号为7707的日志。其它的错误信息提示是指备库第一次置于recover状态时,备库将生成对应的online redo log,这是正常的,可不必理会。

14 调整主库参数,使主库上的归档日志可以顺利传递到备库上去,其中也包括在主库备份完成到备库置于recover状态之间主库产生的归档日志,及archive log gap。

[oracle@oracle-rac1 ~]$ env | grep ORA
ORACLE_SID=glndb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
[oracle@oracle-rac1 ~]$ sqlplus

SQL*Plus: Release 10.2.0.5.0 - Production on Fri Feb 17 11:14:17 2012

Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.

SQL> conn / as sysdba;
Connected.
SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1       7710   52428800          1 YES INACTIVE             446188257 17-FEB-12
         2          1       7711   52428800          1 NO  CURRENT              446237897 17-FEB-12
         4          2       3277   52428800          1 YES INACTIVE             446178255 17-FEB-12
         5          2       3278   52428800          1 NO  CURRENT              446238085 17-FEB-12

SQL> show parameter log_archive

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string
log_archive_dest                     string
log_archive_dest_1                   string
log_archive_dest_10                  string
log_archive_dest_2                   string      location=/home/oracle/arch1 va
                                                 lid_for=(all_logfiles,all_role
                                                 s) db_unique_name=glndb
log_archive_dest_3                   string
log_archive_dest_4                   string
log_archive_dest_5                   string
log_archive_dest_6                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_7                   string
log_archive_dest_8                   string
log_archive_dest_9                   string
log_archive_dest_state_1             string      defer
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable
log_archive_duplex_dest              string
log_archive_format                   string      ARC_%t_%S_%r.arc
log_archive_local_first              boolean     TRUE
log_archive_max_processes            integer     2
log_archive_min_succeed_dest         integer     1
log_archive_start                    boolean     FALSE
log_archive_trace                    integer     0
SQL> alter system set log_archive_dest_1='service=pridb lgwr sync valid_for=(online_logfiles,primary_role) db_unique_name=pridb' sid='*';

System altered.

SQL> alter system set log_archive_dest_state_1='enable';

System altered.

SQL> alter system set log_archive_config='dg_config=(glndb,pridb)' sid='*';

System altered.

SQL> show parameter log_archive

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_config                   string      dg_config=(glndb,pridb)
log_archive_dest                     string
log_archive_dest_1                   string      service=pridb lgwr sync valid_
                                                 for=(online_logfiles,primary_r
                                                 ole) db_unique_name=pridb
log_archive_dest_10                  string
log_archive_dest_2                   string      location=/home/oracle/arch1 va
                                                 lid_for=(all_logfiles,all_role
                                                 s) db_unique_name=glndb
log_archive_dest_3                   string
log_archive_dest_4                   string

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_5                   string
log_archive_dest_6                   string
log_archive_dest_7                   string
log_archive_dest_8                   string
log_archive_dest_9                   string
log_archive_dest_state_1             string      enable
log_archive_dest_state_10            string      enable
log_archive_dest_state_2             string      enable
log_archive_dest_state_3             string      enable
log_archive_dest_state_4             string      enable
log_archive_dest_state_5             string      enable

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
log_archive_dest_state_6             string      enable
log_archive_dest_state_7             string      enable
log_archive_dest_state_8             string      enable
log_archive_dest_state_9             string      enable
log_archive_duplex_dest              string
log_archive_format                   string      ARC_%t_%S_%r.arc
log_archive_local_first              boolean     TRUE
log_archive_max_processes            integer     2
log_archive_min_succeed_dest         integer     1
log_archive_start                    boolean     FALSE
log_archive_trace                    integer     0
SQL> show parameter fal

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
fal_client                           string
fal_server                           string
SQL> alter system set fal_server='pridb' sid='*';

System altered.

SQL> alter system set fal_client='glndb1' sid='*';

System altered.

SQL> alter system set fal_client='glndb1' sid='glndb1';

System altered.

SQL> alter system set fal_client='glndb2' sid='glndb2';

System altered.

SQL>

配置完主库的归档参数之后,在主库节点1上尝试切换日志,到备库上查看是否可以正常接收主库传递过来的归档日志?

 

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1       7710   52428800          1 YES INACTIVE             446188257 17-FEB-12
         2          1       7711   52428800          1 NO  CURRENT              446237897 17-FEB-12
         4          2       3277   52428800          1 YES INACTIVE             446178255 17-FEB-12
         5          2       3278   52428800          1 NO  CURRENT              446238085 17-FEB-12

SQL> alter system switch logfile;

System altered.

SQL> select * from v$log;

    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIM
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- ---------
         1          1       7712   52428800          1 NO  CURRENT              446238670 17-FEB-12
         2          1       7711   52428800          1 YES ACTIVE               446237897 17-FEB-12
         4          2       3277   52428800          1 YES INACTIVE             446178255 17-FEB-12
         5          2       3278   52428800          1 NO  CURRENT              446238085 17-FEB-12

SQL> !
[oracle@oracle-rac1 ~]$ cd /home/oracle/arch1/ && ll -h
total 134M
-rw-rw---- 1 oracle oinstall  27M Feb 16 11:07 ARC_1_0000007706_726057844.arc
-rw-r----- 1 oracle oinstall  79K Feb 16 11:13 ARC_1_0000007707_726057844.arc
-rw-rw---- 1 oracle oinstall  44M Feb 16 22:06 ARC_1_0000007708_726057844.arc
-rw-rw---- 1 oracle oinstall  44M Feb 17 04:17 ARC_1_0000007709_726057844.arc
-rw-rw---- 1 oracle oinstall  21M Feb 17 11:23 ARC_1_0000007710_726057844.arc
-rw-rw---- 1 oracle oinstall 228K Feb 17 11:30 ARC_1_0000007711_726057844.arc
[oracle@oracle-rac1 arch1]$

可以看到,主库节点1已经产生7711归档的本地日志,而备库上却没有接收到任何归档日志:

[oracle@ora10grac-dg arch2]$ pwd
/home/oracle/arch2
[oracle@ora10grac-dg arch2]$ ll
total 0
[oracle@ora10grac-dg arch2]$

并且物理备库的告警日志暂时也没有任何提示信息!!在这一步,尝试了N久,才发现备库的监听没有启动,导致主库无法连接物理备库,自然,主库的归档也就无法传递到物理备库。具体,可见下面的记录信息,首先在节点1上,在SQL*PLUS里尝试用pridb网络服务名连接物理备库时报错,没有监听,然后到物理备库启动监听,在物理备库上重新执行应用归档,最后问题的以解决!

主库尝试连接备库报错:

SQL> conn sys/oracle@pridb as sysdba
ERROR:
ORA-12541: TNS:no listener


Warning: You are no longer connected to ORACLE.
SQL>

备库监听未启,然后启动:

[oracle@ora10grac-dg arch2]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 17-FEB-2012 11:41:59

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora10grac-dg)(PORT=1521)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC0)))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
[oracle@ora10grac-dg arch2]$ lsnrctl start 

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 17-FEB-2012 11:42:04

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Starting /u01/app/oracle/bin/tnslsnr: please wait...

TNSLSNR for Linux: Version 10.2.0.5.0 - Production
System parameter file is /u01/app/oracle/network/admin/listener.ora
Log messages written to /u01/app/oracle/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora10grac-dg)(PORT=1521)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora10grac-dg)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date                17-FEB-2012 11:42:06
Uptime                    0 days 0 hr. 0 min. 0 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/network/admin/listener.ora
Listener Log File         /u01/app/oracle/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora10grac-dg)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
The command completed successfully
[oracle@ora10grac-dg arch2]$ lsnrctl status

LSNRCTL for Linux: Version 10.2.0.5.0 - Production on 17-FEB-2012 11:42:27

Copyright (c) 1991, 2010, Oracle.  All rights reserved.

Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=ora10grac-dg)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR for Linux: Version 10.2.0.5.0 - Production
Start Date                17-FEB-2012 11:42:06
Uptime                    0 days 0 hr. 0 min. 20 sec
Trace Level               off
Security                  ON: Local OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/network/admin/listener.ora
Listener Log File         /u01/app/oracle/network/log/listener.log
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=ora10grac-dg)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
  Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "pridb" has 1 instance(s).
  Instance "pridb", status READY, has 1 handler(s) for this service...
Service "pridb_XPT" has 1 instance(s).
  Instance "pridb", status READY, has 1 handler(s) for this service...
The command completed successfully
[oracle@ora10grac-dg arch2]$

备库重启启动redo apply:

SQL> alter database recover managed standby database cancel;

Database altered.

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

Database altered.

SQL>

过一段时间后,看到下述信息:

SQL> select sequence#,name,first_time,next_time,applied from v$archived_log;

 SEQUENCE# NAME                                               FIRST_TIME          NEXT_TIME           APPLIED
---------- -------------------------------------------------- ------------------- ------------------- ------------
      7708 /home/oracle/arch2/ARC_1_0000007708_726057844.arc  2012/02/16 11:13:19 2012/02/16 22:05:46 YES
      7709 /home/oracle/arch2/ARC_1_0000007709_726057844.arc  2012/02/16 22:05:46 2012/02/17 04:17:07 YES
      7710 /home/oracle/arch2/ARC_1_0000007710_726057844.arc  2012/02/17 04:17:07 2012/02/17 11:23:14 YES
      7711 /home/oracle/arch2/ARC_1_0000007711_726057844.arc  2012/02/17 11:23:14 2012/02/17 11:30:44 YES
      7707 /home/oracle/arch2/ARC_1_0000007707_726057844.arc  2012/02/16 11:07:43 2012/02/16 11:13:19 YES
      3274 /home/oracle/arch2/ARC_2_0000003274_726057844.arc  2012/02/16 11:07:37 2012/02/16 11:13:16 YES
      3275 /home/oracle/arch2/ARC_2_0000003275_726057844.arc  2012/02/16 11:13:16 2012/02/16 23:03:02 YES
      3276 /home/oracle/arch2/ARC_2_0000003276_726057844.arc  2012/02/16 23:03:02 2012/02/17 03:00:36 YES
      3277 /home/oracle/arch2/ARC_2_0000003277_726057844.arc  2012/02/17 03:00:36 2012/02/17 11:25:24 YES
      3278 /home/oracle/arch2/ARC_2_0000003278_726057844.arc  2012/02/17 11:25:24 2012/02/17 11:41:04 NO

10 rows selected.

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

PROCESS                              STATUS          CLIENT_PROCESS                   GROUP    THREAD#  SEQUENCE#
------------------------------------ --------------- -------------------------------- ----- ---------- ----------
ARCH                                 CONNECTED       ARCH                             N/A            0          0
ARCH                                 CONNECTED       ARCH                             N/A            0          0
MRP0                                 WAIT_FOR_LOG    N/A                              N/A            1       7712
RFS                                  IDLE            UNKNOWN                          N/A            0          0
RFS                                  IDLE            UNKNOWN                          N/A            0          0

SQL> !
[oracle@ora10grac-dg ~]$ cd /home/oracle/arch2/ && ll
total 210424
-rw-r----- 1 oracle oinstall    80896 Feb 17 11:46 ARC_1_0000007707_726057844.arc
-rw-r----- 1 oracle oinstall 45309952 Feb 17 11:45 ARC_1_0000007708_726057844.arc
-rw-r----- 1 oracle oinstall 45311488 Feb 17 11:46 ARC_1_0000007709_726057844.arc
-rw-r----- 1 oracle oinstall 21249024 Feb 17 11:46 ARC_1_0000007710_726057844.arc
-rw-r----- 1 oracle oinstall   233472 Feb 17 11:46 ARC_1_0000007711_726057844.arc
-rw-r----- 1 oracle oinstall    46592 Feb 17 11:47 ARC_2_0000003274_726057844.arc
-rw-r----- 1 oracle oinstall 47448576 Feb 17 11:47 ARC_2_0000003275_726057844.arc
-rw-r----- 1 oracle oinstall 45309952 Feb 17 11:48 ARC_2_0000003276_726057844.arc
-rw-r----- 1 oracle oinstall  9995776 Feb 17 11:48 ARC_2_0000003277_726057844.arc
-rw-r----- 1 oracle oinstall   214528 Feb 17 11:49 ARC_2_0000003278_726057844.arc
[oracle@ora10grac-dg arch2]$

此时,备库alert日志文件里也看到成功应用归档的信息如下:

Completed: alter database recover managed standby database using current logfile disconnect from session
Fri Feb 17 11:44:24 CST 2012
Using STANDBY_ARCHIVE_DEST parameter default value as /home/oracle/arch2
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[1]: Assigned to RFS process 8107
RFS[1]: Identified database type as 'physical standby'
Fri Feb 17 11:44:24 CST 2012
RFS LogMiner: Client disabled from further notification
Fri Feb 17 11:44:26 CST 2012
Fetching gap sequence in thread 1, gap sequence 7707-7707
Fri Feb 17 11:44:59 CST 2012
Redo Shipping Client Connected as PUBLIC
-- Connected User is Valid
RFS[2]: Assigned to RFS process 8112
RFS[2]: Identified database type as 'physical standby'
Fri Feb 17 11:45:21 CST 2012
RFS[1]: Archived Log: '/home/oracle/arch2/ARC_1_0000007708_726057844.arc'
Fri Feb 17 11:46:04 CST 2012
RFS[1]: Archived Log: '/home/oracle/arch2/ARC_1_0000007709_726057844.arc'
RFS[1]: Archived Log: '/home/oracle/arch2/ARC_1_0000007710_726057844.arc'
RFS[1]: Archived Log: '/home/oracle/arch2/ARC_1_0000007711_726057844.arc'
RFS[1]: Archived Log: '/home/oracle/arch2/ARC_1_0000007707_726057844.arc'
Fri Feb 17 11:46:29 CST 2012
Media Recovery Log /home/oracle/arch2/ARC_1_0000007707_726057844.arc
Media Recovery Waiting for thread 2 sequence 3274
Fetching gap sequence in thread 2, gap sequence 3274-3274
Fri Feb 17 11:47:02 CST 2012
RFS[2]: Archived Log: '/home/oracle/arch2/ARC_2_0000003274_726057844.arc'
Fri Feb 17 11:47:30 CST 2012
Media Recovery Log /home/oracle/arch2/ARC_2_0000003274_726057844.arc
Media Recovery Log /home/oracle/arch2/ARC_1_0000007708_726057844.arc
Fri Feb 17 11:47:40 CST 2012
Media Recovery Waiting for thread 2 sequence 3275 (in transit)
Fri Feb 17 11:47:51 CST 2012
RFS[2]: Archived Log: '/home/oracle/arch2/ARC_2_0000003275_726057844.arc'
Fri Feb 17 11:47:55 CST 2012
Media Recovery Log /home/oracle/arch2/ARC_2_0000003275_726057844.arc
Fri Feb 17 11:48:49 CST 2012
RFS[2]: Archived Log: '/home/oracle/arch2/ARC_2_0000003276_726057844.arc'
Fri Feb 17 11:48:59 CST 2012
RFS[2]: Archived Log: '/home/oracle/arch2/ARC_2_0000003277_726057844.arc'
RFS[2]: Archived Log: '/home/oracle/arch2/ARC_2_0000003278_726057844.arc'
Fri Feb 17 11:49:12 CST 2012
Media Recovery Log /home/oracle/arch2/ARC_1_0000007709_726057844.arc
Fri Feb 17 11:49:38 CST 2012
Media Recovery Log /home/oracle/arch2/ARC_2_0000003276_726057844.arc
Fri Feb 17 11:50:01 CST 2012
Media Recovery Log /home/oracle/arch2/ARC_2_0000003277_726057844.arc
Media Recovery Log /home/oracle/arch2/ARC_1_0000007710_726057844.arc
Media Recovery Log /home/oracle/arch2/ARC_1_0000007711_726057844.arc
Media Recovery Log /home/oracle/arch2/ARC_2_0000003278_726057844.arc
Media Recovery Waiting for thread 1 sequence 7712

看到这些信息后,才说明主库所有节点的归档日志已经全部传递到物理备库,且物理备库也成功应用了这些归档!

15 主库创建standby logfile。在主库上创建standby logfile的目的和作用是,将来在做switchover时,RAC主库变成新standby备库,而原来的物理备库变成新主库时,新standby备库可以顺利接受并应用新主库的归档日志。当然,也别忘记了要修改主库的standby_file_management、db_file_name_convert、log_file_name_convert这三个重要的参数!

SQL> select * from v$logfile;

    GROUP# STATUS  TYPE    MEMBER                                             IS_
---------- ------- ------- -------------------------------------------------- ---
         1         ONLINE  +ORADATA/glndb/onlinelog/group_1.257.726057849     NO
         2         ONLINE  +ORADATA/glndb/onlinelog/group_2.258.726057849     NO
         4         ONLINE  +ORADATA/glndb/onlinelog/group_4.266.726058757     NO
         5         ONLINE  +ORADATA/glndb/onlinelog/group_5.267.726058757     NO

SQL> select * from v$standby_log;

no rows selected

SQL> alter database add standby logfile thread 1 group 3 size 50m,group 6 size 50m,group 7 size 50m;

Database altered.

SQL> alter database add standby logfile thread 2 group 8 size 50m,group 9 size 50m,group 10 size 50m;

Database altered.

SQL> select * from v$standby_log;

    GROUP# DBID                                        THREAD#  SEQUENCE#      BYTES       USED ARC STATUS     FIRST_CHANGE# FIRST_TIM LAST_CHANGE# LAST_TIME
---------- ---------------------------------------- ---------- ---------- ---------- ---------- --- ---------- ------------- --------- ------------ ---------
         3 UNASSIGNED                                        1          0   52428800        512 YES UNASSIGNED             0  0
         6 UNASSIGNED                                        1          0   52428800        512 YES UNASSIGNED             0  0
         7 UNASSIGNED                                        1          0   52428800        512 YES UNASSIGNED             0  0
         8 UNASSIGNED                                        2          0   52428800        512 YES UNASSIGNED             0  0
         9 UNASSIGNED                                        2          0   52428800        512 YES UNASSIGNED             0  0
        10 UNASSIGNED                                        2          0   52428800        512 YES UNASSIGNED             0  0

6 rows selected.

SQL> select * from v$logfile;

    GROUP# STATUS  TYPE    MEMBER                                             IS_
---------- ------- ------- -------------------------------------------------- ---
         1         ONLINE  +ORADATA/glndb/onlinelog/group_1.257.726057849     NO
         2         ONLINE  +ORADATA/glndb/onlinelog/group_2.258.726057849     NO
         3         STANDBY +ORADATA/glndb/onlinelog/group_3.261.775490705     NO
         4         ONLINE  +ORADATA/glndb/onlinelog/group_4.266.726058757     NO
         5         ONLINE  +ORADATA/glndb/onlinelog/group_5.267.726058757     NO
         6         STANDBY +ORADATA/glndb/onlinelog/group_6.430.775490705     NO
         7         STANDBY +ORADATA/glndb/onlinelog/group_7.444.775490707     NO
         8         STANDBY +ORADATA/glndb/onlinelog/group_8.431.775491149     NO
         9         STANDBY +ORADATA/glndb/onlinelog/group_9.445.775491149     NO
        10         STANDBY +ORADATA/glndb/onlinelog/group_10.446.775491151    NO

10 rows selected.

SQL> 
SQL> show parameter convert

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
db_file_name_convert                 string
log_file_name_convert                string
SQL> show parameter standby_file

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
standby_file_management              string      MANUAL
SQL> show parameter spfile;

NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +ORADATA/glndb/spfileglndb.ora
SQL> alter system set standby_file_management='auto' sid='*';

System altered.
SQL> alter system set db_file_name_convert='+ORADATA/pridb/','+ORADATA/glndb/'  sid='*' scope=spfile;
alter system set db_file_name_convert='+ORADATA/pridb/','+ORADATA/glndb/'  sid='*' scope=spfile
                 *
ERROR at line 1:
ORA-02096: specified initialization parameter is not modifiable with this option


SQL> alter system set log_file_name_convert='+ORADATA/pridb/','+ORADATA/glndb/' sid='*' scope=spfile;
alter system set log_file_name_convert='+ORADATA/pridb/','+ORADATA/glndb/' sid='*' scope=spfile
                 *
ERROR at line 1:
ORA-02095: specified initialization parameter cannot be modified


SQL> 

发现,最后两个参数不能修改!百思不得其解,不得已,只好通过创建PFILE,在PFILE里修改这两个参数,然后再利用该PFILE来创建SPFILE的方式来修改之!

终于,终于,经过漫长的配置,我们的dataguard成功创建!关于dataguard的功能测试,将在下一篇文章里介绍!依然敬请期待!

Oracle 10g RAC 配置物理dataguard系列1:RAC主库信息概览、备库准备工作

最近在学习Oracle dataguard相关知识。本系列就Oracle Enterprise Linux 5.5 X86_64位环境下Oracle 10g 10.2.0.5.0双节点RAC数据库配置一套物理dataguard做一记录,一来给自己的学习做一简单记录,二来,同样希望可以给广大网友及Oracle数据库技术爱好者提供思路。

在实施之前,简单介绍下背景、最终目标及配置步骤:

  •          背景介绍:主库是一套运行在Oracle Enterprise Linux 5.5 X86_64位环境下Oracle 10g 10.2.0.5.0双节点RAC数据库,主库用的是ASM存储,ASM磁盘利用raw来实现;
  •          最终目标:需要给该主库搭建一套同样是运行在Oracle Enterprise Linux 5.5 X86_64位环境下的物理备库,并且能够switchover,确保高可用
  •          配置步骤:    1 了解现有主库的配置信息;

                               2  搭建一台干净的新机器,用于创建物理备库使用;

                               3  在物理备机上安装oracle数据库软件,并且升级到同主库软件版本一致,即10.2.0.5.0;

                               4  在物理备机上创建ASM实例,ASM磁盘同样选择裸设备来实现;

                               5  配置物理备库;

                               6 确认switchover成功,双节点RAC+physical standby既可提供实例级别容灾(RAC功能)又可以提供存储级别容灾(Dataguard功能),做到真正的高可用!

     本篇是整个实施过程的系列1:本篇的内容主要是查看主库基本配置信息,及创建一台干净的Linux服务器,用作备库。

一  首先了解下现有双节点RAC数据库配置信息:

1 节点1系统基本信息:

[root@oracle-rac1 ~]# hostname 
oracle-rac1.gillion.com.cn
[root@oracle-rac1 ~]# uname -rm
2.6.18-194.0.0.0.3.el5 x86_64
[root@oracle-rac1 ~]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
              ext3     20G   12G  6.8G  64% /
/dev/sda1     ext3     99M   19M   75M  21% /boot
tmpfs        tmpfs    3.9G     0  3.9G   0% /dev/shm
[root@oracle-rac1 ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:0C:29:3A:B8:31  
          inet addr:172.16.0.33  Bcast:172.16.15.255  Mask:255.255.240.0
          inet6 addr: fe80::20c:29ff:fe3a:b831/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:836563 errors:0 dropped:0 overruns:0 frame:0
          TX packets:10459 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:73068451 (69.6 MiB)  TX bytes:2856621 (2.7 MiB)
eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:3A:B8:31  
          inet addr:172.16.0.35  Bcast:172.16.15.255  Mask:255.255.240.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
eth1      Link encap:Ethernet  HWaddr 00:0C:29:3A:B8:3B  
          inet addr:192.168.139.13  Bcast:192.168.139.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fe3a:b83b/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1484344 errors:0 dropped:0 overruns:0 frame:0
          TX packets:707841 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:327352385 (312.1 MiB)  TX bytes:353601291 (337.2 MiB)
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:265726 errors:0 dropped:0 overruns:0 frame:0
          TX packets:265726 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:61035429 (58.2 MiB)  TX bytes:61035429 (58.2 MiB)
[root@oracle-rac1 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost
172.16.0.33             oracle-rac1.gillion.com.cn oracle-rac1
172.16.0.35             oracle-rac1-vip oracle-rac1-vip.gillion.com.cn
192.168.139.13          oracle-rac1-priv
172.16.0.34             oracle-rac2.gillion.com.cn oracle-rac2
172.16.0.36             oracle-rac2-vip oracle-rac2-vip.gillion.com.cn
192.168.139.14          oracle-rac2-priv
[root@oracle-rac1 ~]# su - oracle
[oracle@oracle-rac1 ~]$ . oraenv
ORACLE_SID = [oracle] ? glndb
[oracle@oracle-rac1 ~]$ export ORACLE_SID=glndb1
[oracle@oracle-rac1 ~]$ env | grep ORA
ORACLE_SID=glndb1
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
[oracle@oracle-rac1 ~]$

2 节点1数据库基本信息:

[oracle@oracle-rac1 ~]$ sqlplus
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Feb 14 09:11:00 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
SQL> conn / as sysdba;
Connected.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE    10.2.0.5.0      Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
SQL> alter session set nls_date_format='yyyy/mm/dd hh24:mi:ss';
Session altered.
SQL> select dbid,name,created,log_mode,db_unique_name from gv$database;
      DBID NAME      CREATED             LOG_MODE     DB_UNIQUE_NAME
---------- --------- ------------------- ------------ ---------
3995745524 GLNDB     2010/08/03 10:44:04 ARCHIVELOG   glndb
3995745524 GLNDB     2010/08/03 10:44:04 ARCHIVELOG   glndb
SQL> show parameter db_name;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ---------
db_name                              string      glndb
SQL> show parameter db_unique;
NAME                                 TYPE        VALUE
------------------------------------ ----------- ---------
db_unique_name                       string      glndb
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/oracle/arch1
Oldest online log sequence     7699
Next log sequence to archive   7700
Current log sequence           7700
SQL> show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +ORADATA/glndb/spfileglndb.ora
SQL>

3 节点2基本信息:

[root@oracle-rac2 ~]# hostname 
oracle-rac2.gillion.com.cn
[root@oracle-rac2 ~]# uname -rm
2.6.18-194.0.0.0.3.el5 x86_64
[root@oracle-rac2 ~]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/mapper/VolGroup00-LogVol00
              ext3     20G   12G  6.9G  63% /
/dev/sda1     ext3     99M   19M   75M  21% /boot
tmpfs        tmpfs    3.9G     0  3.9G   0% /dev/shm
[root@oracle-rac2 ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:0C:29:D1:B5:4C  
          inet addr:172.16.0.34  Bcast:172.16.15.255  Mask:255.255.240.0
          inet6 addr: fe80::20c:29ff:fed1:b54c/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:833250 errors:0 dropped:0 overruns:0 frame:0
          TX packets:8442 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:72725394 (69.3 MiB)  TX bytes:2440410 (2.3 MiB)
eth0:1    Link encap:Ethernet  HWaddr 00:0C:29:D1:B5:4C  
          inet addr:172.16.0.36  Bcast:172.16.15.255  Mask:255.255.240.0
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
eth1      Link encap:Ethernet  HWaddr 00:0C:29:D1:B5:56  
          inet addr:192.168.139.14  Bcast:192.168.139.255  Mask:255.255.255.0
          inet6 addr: fe80::20c:29ff:fed1:b556/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:1534148 errors:0 dropped:0 overruns:0 frame:0
          TX packets:655976 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:424024468 (404.3 MiB)  TX bytes:256611983 (244.7 MiB)
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:274642 errors:0 dropped:0 overruns:0 frame:0
          TX packets:274642 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:61783289 (58.9 MiB)  TX bytes:61783289 (58.9 MiB)
[root@oracle-rac2 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1               localhost
172.16.0.33             oracle-rac1.gillion.com.cn oracle-rac1
172.16.0.35             oracle-rac1-vip oracle-rac1-vip.gillion.com.cn
192.168.139.13          oracle-rac1-priv
172.16.0.34             oracle-rac2.gillion.com.cn oracle-rac2
172.16.0.36             oracle-rac2-vip oracle-rac2-vip.gillion.com.cn
192.168.139.14          oracle-rac2-priv
[root@oracle-rac2 ~]# su - oracle
[oracle@oracle-rac2 ~]$ . oraenv
ORACLE_SID = [oracle] ? glndb
[oracle@oracle-rac2 ~]$ export ORACLE_SID=glndb2
[oracle@oracle-rac2 ~]$ env |grep ORA
ORACLE_SID=glndb2
ORACLE_BASE=/u01/app/oracle
ORACLE_HOME=/u01/app/oracle/product/10.2.0/db_1
[oracle@oracle-rac2 ~]$

4 点2数据库基本信息:

[oracle@oracle-rac2 ~]$ sqlplus
SQL*Plus: Release 10.2.0.5.0 - Production on Tue Feb 14 09:25:47 2012
Copyright (c) 1982, 2010, Oracle.  All Rights Reserved.
SQL> conn / as sysdba;
Connected.
SQL> select * from v$version;
BANNER
----------------------------------------------------------------
Oracle Database 10g Enterprise Edition Release 10.2.0.5.0 - 64bi
PL/SQL Release 10.2.0.5.0 - Production
CORE    10.2.0.5.0      Production
TNS for Linux: Version 10.2.0.5.0 - Production
NLSRTL Version 10.2.0.5.0 - Production
SQL> alter session set nls_date_format='yyyy/mm/dd hh24:mi:ss';
Session altered.
SQL> set line 160
SQL> select dbid,name,created,log_mode,db_unique_name from gv$database;
      DBID NAME      CREATED             LOG_MODE     DB_UNIQUE_NAME
---------- --------- ------------------- ------------ ---------
3995745524 GLNDB     2010/08/03 10:44:04 ARCHIVELOG   glndb
3995745524 GLNDB     2010/08/03 10:44:04 ARCHIVELOG   glndb
SQL> show parameter db_name
NAME                                 TYPE        VALUE
------------------------------------ ----------- --------------
db_name                              string      glndb
SQL> show parameter db_unique
NAME                                 TYPE        VALUE
------------------------------------ ----------- --------------
db_unique_name                       string      glndb
SQL> archive log list;
Database log mode              Archive Mode
Automatic archival             Enabled
Archive destination            /home/oracle/arch2
Oldest online log sequence     3270
Next log sequence to archive   3271
Current log sequence           3271
SQL> show parameter spfile
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
spfile                               string      +ORADATA/glndb/spfileglndb.ora
SQL>

5 数据文件、 控制文件基本信息:

SQL> select name,bytes/1024/1024 M from v$datafile
  2  union
  3  select name,0 from v$controlfile
  4  order by 2
  5  ;
NAME                                                        M
-------------------------------------------------- ----------
+ORADATA/glndb/controlfile/current.256.726057849            0
+ORADATA/glndb/datafile/example.435.756233417               2
+ORADATA/glndb/datafile/users.265.726057871                 2
+ORADATA/glndb/datafile/undotbs3.268.774870843            200
+ORADATA/glndb/datafile/undotbs2.264.726057869            261
+ORADATA/glndb/datafile/sysaux.262.726057863             1290
+ORADATA/glndb/datafile/system.260.726057851             6039
7 rows selected.
SQL>

6 联机日志文件信息:

SQL> select * from v$log;
    GROUP#    THREAD#  SEQUENCE#      BYTES    MEMBERS ARC STATUS           FIRST_CHANGE# FIRST_TIME
---------- ---------- ---------- ---------- ---------- --- ---------------- ------------- -------------------
         1          1       7700   52428800          1 NO  CURRENT              445626703 2012/02/13 23:06:00
         2          1       7699   52428800          1 YES INACTIVE             445622543 2012/02/13 23:05:29
         4          2       3271   52428800          1 NO  CURRENT              445627780 2012/02/13 23:05:58
         5          2       3270   52428800          1 YES INACTIVE             445332258 2012/02/13 09:05:39
SQL>

7 资源状态信息:

[oracle@oracle-rac2 ~]$ /u01/app/oracle/product/10.2.0/crs/bin/crs_stat -t
Name           Type           Target    State     Host        
------------------------------------------------------------
ora.glndb.db   application    ONLINE    ONLINE    oracle-rac2 
ora...._svc.cs application    ONLINE    ONLINE    oracle-rac1 
ora....db1.srv application    ONLINE    ONLINE    oracle-rac1 
ora....b1.inst application    ONLINE    ONLINE    oracle-rac1 
ora....b2.inst application    ONLINE    ONLINE    oracle-rac2 
ora....svc2.cs application    ONLINE    ONLINE    oracle-rac2 
ora....db2.srv application    ONLINE    ONLINE    oracle-rac2 
ora....SM1.asm application    ONLINE    ONLINE    oracle-rac1 
ora....C1.lsnr application    ONLINE    ONLINE    oracle-rac1 
ora....ac1.gsd application    ONLINE    ONLINE    oracle-rac1 
ora....ac1.ons application    ONLINE    ONLINE    oracle-rac1 
ora....ac1.vip application    ONLINE    ONLINE    oracle-rac1 
ora....SM2.asm application    ONLINE    ONLINE    oracle-rac2 
ora....C2.lsnr application    ONLINE    ONLINE    oracle-rac2 
ora....ac2.gsd application    ONLINE    ONLINE    oracle-rac2 
ora....ac2.ons application    ONLINE    ONLINE    oracle-rac2 
ora....ac2.vip application    ONLINE    ONLINE    oracle-rac2 
[oracle@oracle-rac2 ~]$

二      在获取了RAC主库的基本信息之后,接下来搭建一套新的机器做物理dataguard用

本文采用的是在一套虚拟机上搭建另外的备库机器,该虚拟机软件是VMware ESX 4.0,该软件其实可以认为是一个操作系统,是直接装在物理机器上的,有别于Vmware公司的VMware Server、VMware Workstation软件,后两者是先需要有操作系统,然后在操作系统上安装该虚拟机软件。而且,VMware ESX 4.0虚拟机软件相对来说也要比后两者稳定。

  1.     用Vmware vSphere Client工具登录虚拟机控制台:

登录控制台后,虚拟机信息概览:

2       选择File–New–Virtual Machine,新建虚拟机命名为10gRAC-Dataguard:

3      接下来一步一步走,同在VMware Server、VMware Workstation里创建新虚拟机一样,在此不再赘述。配置后的虚拟机概览如下:

4        给10gRAC-Dataguard加电,开始安装操作系统,虚拟机磁盘分区如下:

5        虚拟机网络配置信息如下:

IPv4:172.16.0.202

Netmask:255.255.240.0

Gateway:172.16.15.254

DNS:Null

Hostname:ora10grac-dg

6     软件包安装时,选择客户化,其中,下述是选择要安装的软件包:

 Desktop Environments:GNOME Desktop Environment

 Applications:  

           Editors

           Graphics

 Development:

           Development Libraries

           Development Tools

           GNOME Software Development

           Legacy Software Development

           X software Development

 Base System: 

           Administration Tools

           Base

           Legacy Software Support

           System Tools (其中,选择oracleasm软件包。注:默认情况下并没有oracleasmlib-2.0.4-1.el5软件包,如果采用asmlib来管理和创建asm磁盘的话,仍需要后续手工安装该RPM包,否则将来配置ASM存储时会找不到ASM磁盘!!!)

         暂时,先安装这些软件包,稍后在安装oracle软件时,如有缺失软件包的话,再续安装,至于其它的Server,虚拟化,集群软件包一概不装!

       7        接下来,进行格式化文件系统,进入系统安装。稍后,还有一些后续的配置工作,记得不要开启SELinux并且关闭防火墙!最后,一台新的虚拟机配置成功,登录界面如下:

        8          新虚拟机基本信息如下:

[root@ora10grac-dg ~]# hostname 
ora10grac-dg
[root@ora10grac-dg ~]# uptime 
 11:17:18 up 2 min,  2 users,  load average: 1.98, 1.23, 0.47
[root@ora10grac-dg ~]# df -Th
Filesystem    Type    Size  Used Avail Use% Mounted on
/dev/sda1     ext3    7.8G  2.8G  4.7G  37% /
tmpfs        tmpfs    1.1G     0  1.1G   0% /dev/shm
[root@ora10grac-dg ~]# ifconfig 
eth0      Link encap:Ethernet  HWaddr 00:0C:29:2E:60:24  
          inet addr:172.16.0.202  Bcast:172.16.15.255  Mask:255.255.240.0
          inet6 addr: fe80::20c:29ff:fe2e:6024/64 Scope:Link
          UP BROADCAST RUNNING MULTICAST  MTU:1500  Metric:1
          RX packets:3356 errors:0 dropped:0 overruns:0 frame:0
          TX packets:196 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:1000 
          RX bytes:333071 (325.2 KiB)  TX bytes:21084 (20.5 KiB)
lo        Link encap:Local Loopback  
          inet addr:127.0.0.1  Mask:255.0.0.0
          inet6 addr: ::1/128 Scope:Host
          UP LOOPBACK RUNNING  MTU:16436  Metric:1
          RX packets:1056 errors:0 dropped:0 overruns:0 frame:0
          TX packets:1056 errors:0 dropped:0 overruns:0 carrier:0
          collisions:0 txqueuelen:0 
          RX bytes:1753796 (1.6 MiB)  TX bytes:1753796 (1.6 MiB)
[root@ora10grac-dg ~]# uname -rm
2.6.18-194.el5 x86_64
[root@ora10grac-dg ~]#

这样,一台新的物理备库机器配置成功!接下来需要在该机器上安装oracle软件,配置ASM,升级oracle软件到10.2.0.5.0版本下篇继续