ITPub博客

首页 > Linux操作系统 > Linux操作系统 > 11.2数据库监听的改变

11.2数据库监听的改变

原创 Linux操作系统 作者:yangtingkun 时间:2011-09-06 22:35:14 0 删除 编辑

11.2由于RACGRID的分离以及实现了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的监听和之前的版本没有什么区别。

 

 

来自 “ ITPUB博客 ” ,链接:http://blog.itpub.net/4227/viewspace-706783/,如需转载,请注明出处,否则将追究法律责任。

请登录后发表评论 登录
全部评论
暂无介绍

注册时间:2007-12-29

  • 博文量
    1955
  • 访问量
    10526552