技术开发 频道

虚拟RHEL5上安装11g RAC

  TNS配置

  安装完成后,在共享的$ ORACLE_HOME 目录下“$ORACLE_HOME/network/admin/listener.ora”文件中将包含下列项目:

  # listener.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/listener.ora

  # Generated by Oracle configuration tools.

  LISTENER_RAC2 =

  (DESCRIPTION_LIST =

  (DESCRIPTION =

  (ADDRESS_LIST =

  (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521)(IP = FIRST))

  )

  (ADDRESS_LIST =

  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.10.202)(PORT = 1521)(IP = FIRST))

  )

  (ADDRESS_LIST =

  (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))

  )

  )

  )

  LISTENER_RAC1 =

  (DESCRIPTION_LIST =

  (DESCRIPTION =

  (ADDRESS_LIST =

  (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521)(IP = FIRST))

  )

  (ADDRESS_LIST =

  (ADDRESS = (PROTOCOL = TCP)(HOST = 10.1.10.201)(PORT = 1521)(IP = FIRST))

  )

  (ADDRESS_LIST =

  (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC))

  )

  )

  )

  共享的$ORACLE_HOME/network/admin/tnsnames.ora文件将包含下列内容:

  # tnsnames.ora Network Configuration File: /u01/app/oracle/product/11.1.0/db_1/network/admin/tnsnames.ora

  # Generated by Oracle configuration tools.

  RAC =

  (DESCRIPTION =

  (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))

  (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))

  (LOAD_BALANCE = yes)

  (CONNECT_DATA =

  (SERVER = DEDICATED)

  (SERVICE_NAME = RAC.WORLD)

  )

  )

  LISTENERS_RAC =

  (ADDRESS_LIST =

  (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))

  (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))

  )

  RAC2 =

  (DESCRIPTION =

  (ADDRESS = (PROTOCOL = TCP)(HOST = rac2-vip)(PORT = 1521))

  (CONNECT_DATA =

  (SERVER = DEDICATED)

  (SERVICE_NAME = RAC.WORLD)

  (INSTANCE_NAME = RAC2)

  )

  )

  RAC1 =

  (DESCRIPTION =

  (ADDRESS = (PROTOCOL = TCP)(HOST = rac1-vip)(PORT = 1521))

  (CONNECT_DATA =

  (SERVER = DEDICATED)

  (SERVICE_NAME = RAC.WORLD)

  (INSTANCE_NAME = RAC1)

  )

  )

  这种配置可直接连接到具体的实例,或使用负载平衡连接到主服务。

  $ sqlplus / as sysdba

  SQL*Plus: Release 11.1.0.6.0 - Production on Tue Aug 19 16:54:45 2008

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

  Connected to:

  Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production

  With the Partitioning, Real Application Clusters, OLAP, Data Mining

  and Real Application Testing options

  SQL> CONN sys/password@rac1 AS SYSDBA

  Connected.

  SQL> SELECT instance_name, host_name FROM v$instance;

  INSTANCE_NAME HOST_NAME

  ---------------- ----------------------------------------------------

  RAC1 rac1.lynx.co.uk

  SQL> CONN sys/password@rac2 AS SYSDBA

  Connected.

  SQL> SELECT instance_name, host_name FROM v$instance;

  INSTANCE_NAME HOST_NAME

  ---------------- -----------------------------------------------------

  RAC2 rac2.lynx.co.uk

  SQL> CONN sys/password@rac AS SYSDBA

  Connected.

  SQL> SELECT instance_name, host_name FROM v$instance;

  INSTANCE_NAME HOST_NAME

  ---------------- --------------------------------------------

  RAC1 rac1.lynx.co.uk

  SQL>

  检查RAC的状态

  有几种方法来检查RAC的现况。srvctl实用程序显示当前的配置和RAC数据库的状态。

  $ srvctl config database -d RAC

  rac1 RAC1 /u01/app/oracle/product/11.1.0/db_1

  rac2 RAC2 /u01/app/oracle/product/11.1.0/db_1

  $

  $ srvctl status database -d RAC

  Instance RAC1 is running on node rac1

  Instance RAC2 is running on node rac2

  $

  在V$ACTIVE_INSTANCES视图也可以显示实例目前的状况。

  $ sqlplus / as sysdba

  SQL*Plus: Release 11.1.0.6.0 - Production on Tue Aug 19 16:55:31 2008

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

  Connected to:

  Oracle Database 11g Enterprise Edition Release 11.1.0.6.0 - Production

  With the Partitioning, Real Application Clusters, OLAP, Data Mining

  and Real Application Testing options

  SQL> SELECT * FROM v$active_instances;

  INST_NUMBER INST_NAME

  ----------- ------------------------------------------------------------

  1 rac1.lynx.co.uk:RAC1

  2 rac2.lynx.co.uk:RAC2

  SQL>

  最后,GV$视图让您可以显示整个RAC的信息。

  SQL> SELECT inst_id, username, sid, serial# FROM gv$session WHERE username IS NOT NULL;

  INST_ID USERNAME SID SERIAL#

  ---------- ------------------------------ ---------- ----------

  2 SYS 116 841

  2 SYSMAN 118 78

  2 SYS 119 1992

  2 SYSMAN 121 1

  2 SYSMAN 122 29

  2 SYS 123 2

  2 SYSMAN 124 50

  2 DBSNMP 129 1

  2 DBSNMP 130 6

  2 DBSNMP 134 1

  2 SYSMAN 145 53

  INST_ID USERNAME SID SERIAL#

  ---------- ------------------------------ ---------- ----------

  2 SYS 170 14

  1 SYSMAN 117 144

  1 SYSMAN 118 186

  1 SYSMAN 119 31

  1 SYS 121 3

  1 SYSMAN 122 162

  1 SYSMAN 123 99

  1 DBSNMP 124 3

  1 SYS 125 2

  1 SYS 126 19

  1 SYS 127 291

  INST_ID USERNAME SID SERIAL#

  ---------- ------------------------------ ---------- ----------

  1 DBSNMP 131 61

  1 SYS 170 17

  24 rows selected.

  SQL>

  如果您已配置了企业管理器,它可以用来查看配置和数据库的现状,使用类似 “https://rac1.localdomain:1158/em”的网址 。

0
相关文章