11.2数据库监听的改变

11.2由于RAC中GRID的分离以及实现了SCAN功能,使得监听的优先级发生了改变。
一个11.2环境的单实例数据库,配置了ASM,随后在同一个服务器上又新建了一个数据库,同样使用这个ASM,但是发现连接这个新的数据库时出现了错误。

[oracle@dbserver1 ~]$ export ORACLE_SID=al32utf8
[oracle@dbserver1 ~]$ sqlplus / AS sysdba
SQL*Plus: Release 11.2.0.2.0 Production ON Mon Sep 5 14:04:57 2011
Copyright (c) 1982, 2010, Oracle.  ALL rights reserved.
Connected TO:
Oracle DATABASE 11g Enterprise Edition Release 11.2.0.2.0 - 64bit Production
WITH the Partitioning, Automatic Storage Management, OLAP, DATA Mining
AND REAL Application Testing options
SQL> SET pages 100 LINES 120
SQL> SHOW parameter service_names
NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
service_names                        string      al32utf8
SQL> conn thams/thams@192.168.20.101/al32utf8
ERROR:
ORA-12514: TNS:listener does NOT currently know OF service requested IN CONNECT descriptor
Warning: You are no longer connected TO ORACLE.

用这种简易连接的方式连接这个服务器上第一个创建的数据库实例,没有任何问题。检查监听的状态:

[oracle@dbserver1 ~]$ lsnrctl STATUS 
LSNRCTL FOR Linux: Version 11.2.0.2.0 - Production ON 05-SEP-2011 17:50:09
Copyright (c) 1991, 2010, Oracle.  ALL rights reserved.
Connecting TO (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dbserver1)(PORT=1521)))
STATUS OF the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR FOR Linux: Version 11.2.0.2.0 - Production
START DATE                31-AUG-2011 17:26:15
Uptime                    5 days 0 hr. 23 MIN. 53 sec
Trace Level               off
Security                  ON: LOCAL OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/oracle/product/11.2.0/dbhome_1/network/admin/listener.ora
Listener Log File         /u01/app/oracle/diag/tnslsnr/dbserver1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver1)(PORT=1521)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1521)))
Services Summary...
Service "fhacdb1" has 1 instance(s).
  Instance "fhacdb1", STATUS READY, has 1 handler(s) FOR this service...
Service "fhacdbXDB" has 1 instance(s).
  Instance "fhacdb1", STATUS READY, has 1 handler(s) FOR this service...
The command completed successfully

可以看到,数据库的监听并没有包含新建的al32utf8的服务,尝试在数据库中进行手工注册操作,错误依旧。
这时想起数据库配置了GRID,切换到grid用户,果然发现了问题所在:

[oracle@dbserver1 ~]$ su - grid
Password: 
[grid@dbserver1 ~]$ lsnrctl STATUS
LSNRCTL FOR Linux: Version 11.2.0.2.0 - Production ON 05-SEP-2011 17:50:59
Copyright (c) 1991, 2010, Oracle.  ALL rights reserved.
Connecting TO (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1522)))
STATUS OF the LISTENER
------------------------
Alias                     LISTENER
Version                   TNSLSNR FOR Linux: Version 11.2.0.2.0 - Production
START DATE                04-AUG-2011 16:14:28
Uptime                    32 days 1 hr. 36 MIN. 33 sec
Trace Level               off
Security                  ON: LOCAL OS Authentication
SNMP                      OFF
Listener Parameter File   /u01/app/grid/product/11.2.0/gridhome_1/network/admin/listener.ora
Listener Log File         /u01/app/grid/diag/tnslsnr/dbserver1/listener/alert/log.xml
Listening Endpoints Summary...
  (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1522)))
  (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dbserver1)(PORT=1522)))
Services Summary...
Service "+ASM" has 1 instance(s).
  Instance "+ASM", STATUS READY, has 1 handler(s) FOR this service...
Service "al32utf8" has 1 instance(s).
  Instance "al32utf8", STATUS READY, has 1 handler(s) FOR this service...
Service "al32utf8XDB" has 1 instance(s).
  Instance "al32utf8", STATUS READY, has 1 handler(s) FOR this service...
The command completed successfully
[grid@dbserver1 ~]$ exit
logout
[oracle@dbserver1 ~]$ sqlplus /nolog
SQL*Plus: Release 11.2.0.2.0 Production ON Mon Sep 5 17:51:20 2011
Copyright (c) 1982, 2010, Oracle.  ALL rights reserved.
SQL> conn thams/thams@192.168.20.101:1522/al32utf8
Connected.
SQL> SELECT name FROM v$database;
NAME
---------
AL32UTF8
SQL> SELECT instance_name FROM v$instance;
INSTANCE_NAME
----------------
al32utf8

原来新建的数据库实例注册到grid用户下的监听上了。之所以和另外一个数据库不同,是因为那个数据库是在grid安装之前,因此数据库使用ORACLE_HOME本身的监听。而一旦配置了grid,则grid用户下的监听启动,而Oracle的优先级显然是先找grid下的监听,然后再去考虑ORACLE_HOME下的监听。
当然,对于没有使用grid的情况下,11.2的监听和之前的版本没有什么区别。

This entry was posted in ORACLE and tagged , , , . Bookmark the permalink.

Leave a Reply

Your email address will not be published. Required fields are marked *