11.2資料庫監聽的改變

yangtingkun發表於2011-09-06

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/,如需轉載,請註明出處,否則將追究法律責任。

相關文章