首頁技術(shù)文章正文

關(guān)于listener的一些理解

更新時間:2018-07-06 來源:黑馬程序員JavaEE培訓(xùn)學(xué)院 瀏覽量:

在單機環(huán)境下,只啟動數(shù)據(jù)庫不會拉起listener。

一般先啟動listener(lsnrctl start),再啟動數(shù)據(jù)庫(startup)數(shù)據(jù)庫會自動將服務(wù)注冊到監(jiān)聽

若現(xiàn)啟動數(shù)據(jù)庫,再啟動監(jiān)聽,lsnrctl status 時可能沒有服務(wù),過幾分鐘等pmon自己注冊監(jiān)聽或者 手動alter system register都可以

   若是等待數(shù)據(jù)庫自己注冊,但過幾分鐘,監(jiān)聽還是沒有服務(wù),就要看看端口號是不是1521,oracle默認(rèn)注冊 1521端口。此時手動注冊即可

       如果想讓數(shù)據(jù)庫注冊非1521端口,需要修改parameter 中l(wèi)ocal_listener的值

       alter system set local_listener = '(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.56.xxx)(PORT = 1522))' sid='orcl';

      說到local_listener,與之下相關(guān)的是remote_listener.官方文檔對remote_listener這樣解釋

      REMOTE_LISTENER specifies a network name that resolves to an address or address list of Oracle Net remote listeners (that is, listeners that are not running on the same machine as this instance). The address or address list is specified in the TNSNAMES.ORA file or other address repository as configured for your system.

    實際上就是說,采用remote_listener參數(shù)可以實現(xiàn)數(shù)據(jù)庫和listener的分離。不過我不知道這種分離有什么用,出于安全還是負(fù)載均衡。

    單機環(huán)境的remote_listener 一般為空。

rac環(huán)境下,listener是跟隨集群crs啟動的。而且數(shù)據(jù)庫 rdbms的啟動要依賴asm實例的資源,所以不存在啟動數(shù)據(jù)庫后,listener沒啟動,當(dāng)然出現(xiàn)故障除外。

    rac下也有l(wèi)ocal_listener和remote_listener.

        local_listener是該節(jié)點的listener信息

        remote_listener一般是如下的信息

SQL> show parameter remote_listener


NAME                                 TYPE        VALUE
------------------------------------ ----------- ------------------------------
remote_listener                      string      scan:1521
在這里remote_listener應(yīng)該是作為負(fù)載均衡來使用的。


本文版權(quán)歸黑馬程序員JavaEE學(xué)院所有,歡迎轉(zhuǎn)載,轉(zhuǎn)載請注明作者出處。謝謝!

作者:黑馬程序員JavaEE培訓(xùn)學(xué)院

首發(fā):http://java.itheima.com/

分享到:
在線咨詢 我要報名
和我們在線交談!