Oracle 11g RAC环境下单实例非缺省监听及端口配置
如果在Oracle 11g RAC环境下使用dbca创建单实例数据库后,Oracle会自动将其注册到缺省的1521端口及易做图。大多数情况下我们使用的为非缺省易做图以及非缺省的监听端口。而且在Oracle 11g RAC环境中,对于集群易做图的配置由grid用户来接管了。基于这种情形的单实例非缺省监听及端口该如何配置呢?本文给出了解决方案,并且使用了静态及动态两种注册方法。
关于单实例下非缺省监听及端口的配置可以参考下面的文章。实际上参照下列文章依旧可以完成RAC 环境下单实例非缺省监听及端口的配置,但
RAC环境下较之前的单实例环境有些不同,所以记录下了这些个细小的差异。
配置非默认端口的动态服务注册
配置sqlnet.ora限制IP访问Oracle
Oracle 易做图日志配置与管理
设置 Oracle 易做图密码(LISTENER)
配置ORACLE 客户端连接到数据库
1、dbca创建单实例数据库后易做图的情形
[sql]
--环境
[grid@linux1 ~]$ cat /etc/issue
Enterprise Linux Enterprise Linux Server release 5.5 (Carthage)
Kernel \r on an \m
[grid@linux1 ~]$ crsctl query crs activeversion
Oracle Clusterware active version on the cluster is [11.2.0.1.0]
--实例cnbo为RAC环境下使用dbca创建,当前处于offline状态
[oracle@linux1 ~]$ crsstat | grep cnbo
ora.cnbo.db database C OFFLINE OFFLINE (linux1) 0 Instance Shutdown
--缺省的listener处于offline状态
[oracle@linux1 ~]$ crsstat | grep Listener | grep OFFLINE
ora.LISTENER.lsnr Listener L OFFLINE OFFLINE (linux1) 0
--启动实例及监听
[oracle@linux1 ~]$ srvctl start database -d cnbo
[oracle@linux1 ~]$ srvctl start listener -l LISTENER
PRCC-1014 : LISTENER was already running
[oracle@linux1 ~]$ export ORACLE_SID=cnbo
[oracle@linux1 ~]$ sqlplus / as sysdba
SQL> set linesize 190
SQL> show parameter cluster_d --->此实例为RAC环境下的单实例
NAME TYPE VALUE
------------------------------------ --------------------------------- ------------------------------
cluster_database boolean FALSE
cluster_database_instances integer 1
--下面的lsnrctl status可以看到实例被注册到1521的默认端口,dbca创建完实例cnbo后并没有为其配置监听
--而实例确确实实的被注册到了缺省的易做图,应该来说这个是dbca是自动添加的
--注:从Oracle 11g RAC开始,集群易做图的配置由grid用户来接管,因此可以在$ORA_CRS_HOME/network/admin/目录下找到对应的listener.ora文件
[grid@linux1 ~]$ lsnrctl status
LSNRCTL for Linux: Version 11.2.0.1.0 - Production on 16-AUG-2013 12:35:43
.............
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=LISTENER)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.21)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=192.168.7.31)(PORT=1521)))
Services Summary...
Service "+ASM" has 1 instance(s).
Instance "+ASM1", status READY, has 1 handler(s) for this service...
Service "cnbo.orasrv.com" has 1 instance(s). --->该服务即是单实例cnbo提供的
Instance "cnbo", status READY, has 1 handler(s) for this service...
Service "cnboXDB.orasrv.com" has 1 instance(s).
Instance "cnbo", status READY, has 1 handler(s) for this service...
The command completed successfully
2、配置非缺省的易做图并实现动态注册
[sql]
--切换到Oracle用户下,并清空其下的listener.ora与tnsnames.ora
[oracle@linux1 ~]$ cat /dev/null>$ORACLE_HOME/network/admin/listener.ora
[oracle@linux1 ~]$ cat /dev/null>$ORACLE_HOME/network/admin/tnsnames.ora
--下面通过netca来为其配置易做图及tnsnames.ora
[oracle@linux1 ~]$ export DISPLAY=192.168.7.133:0.0
[oracle@linux1 ~]$ netca
-- Author : Robinson Cheng
-- Blog : http://blog.csdn.net/robinson_0612
-->下面是使用netca配置后的结果,包括listener.ora以及tnsnames.ora
[oracle@linux1 ~]$ more $ORACLE_HOME/network/admin/listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
ADR_BASE_LISTENER_CNBO = /u01/app/oracle
LISTENER_CNBO = #--易做图的名字为LISTENER_CNBO,端口为1522
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.21)(PORT = 1522))
)
)
[oracle@linux1 ~]$ more $ORACLE_HOME/network/admin/tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/db_1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
CNBO =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.7.21)(PORT = 1522))
)
(CONNECT_DATA =
(SERVICE_NAME = cnbo.orasrv.com)
)
)
--提示没有找到易做图,无法ping通,因为我们配置的易做图并没有启动
--尽管服务在缺省的易做图注册,但无法ping,即此路不通
[oracle@linux1 ~]$ tnsping cnbo
TNS Ping Utility for Linux: Version 11.2.0.1.0