歡迎來到oracle世界。
這裡,將結合linux as4 下的oracle 10gr2.0.1 舉乙個具體的例子
1、在 $oracle_home/network/admin/listener.ora 檔案中加入乙個靜態註冊的節點
[oracle@prudent oracle]$ cd $oracle_home/network/admin
[oracle@prudent admin]$ vi listener.ora
# generated by oracle configuration tools.
sid_list_listener =
(sid_list =
(sid_desc =
(sid_name = pl***tproc)
(program = extproc)
)(sid_desc =
(sid_name = orcl)
(global_dbname=woo.com)
))listener =
(description_list =
(description =
(address = (protocol = ipc)(key = extproc1))
(address = (protocol = tcp)(host = prudent)(port = 1521))
))
注意
這裡的global_dbname=woo.com
sid_name=orcl
這個sid_name 應與你對外提供服務的 $oracle_sid 一致
[oracle@prudent admin]$ echo $oracle_sid
orcl
2、配置對應的tnsnames.ora 中的節點
[oracle@prudent admin]$ vi tnsnames.ora
# generated by oracle configuration tools.
orcl=
(description =
(address = (protocol = tcp)(host = prudent)(port = 1521))
(connect_data =
(server = dedicated)
(service_name = orcl)
))wooorcl=
(description =
(address = (protocol = tcp)(host = prudent)(port = 1521))
(connect_data =
(server = dedicated)
(service_name = woo.com)
))
[oracle@prudent admin]$ vi tnsnames.ora
# generated by oracle configuration tools.
orcl=
(description =
(address = (protocol = tcp)(host = prudent)(port = 1521))
(connect_data =
(server = dedicated)
(service_name = orcl)
))wooorcl=
(description =
(address = (protocol = tcp)(host = prudent)(port = 1521))
(connect_data =
(server = dedicated)
(service_name = woo.com)
))
tnsname wooorcl 中的 service_name=woo.com
這裡的服務名為 woo.com 而不是通常的 orcl,因為在 listener.ora 中已經註冊了 woo.com,lsnrctl 啟動時會監聽 woo.com ,並對應到 sid_name=orcl 上。
3、啟動監聽和服務
[oracle@prudent oracle]$ cat dbstart
lsnrctl start
sqlplus /nolog sql> ora-32004: obsolete and/or deprecated parameter(s) specified
oracle instance started.
total system global area 461373440 bytes
fixed size 1220000 bytes
variable size 75498080 bytes
database buffers 381681664 bytes
redo buffers 2973696 bytes
database mounted.
database opened.
sql> disconnected from oracle database 10g enterprise edition release 11.2.0.1.0 - production
with the partitioning, olap and data mining options
可以看到
service "woo.com" has 1 instance(s).
instance "orcl", status unknown, has 1 handler(s) for this service...
正在被監聽。
4、驗證該服務可以到達
[oracle@prudent oracle]$ tnsping wooorcl
tns ping utility for linux: version 11.2.0.1.0 - production on 13-feb-2011 20:14:59
used parameter files:
used tnsnames adapter to resolve the alias
attempting to contact (description = (address = (protocol = tcp)(host = prudent)(port = 1521)) (connect_data = (server = dedicated) (service_name = woo.com)))
ok (10 msec)
5、利用靜態註冊的服務登入oracle
[oracle@prudent oracle]$ sqlplus system/oracle@wooorcl
sql*plus: release 11.2.0.1.0 - production on sun feb 13 20:17:27 2011
connected to:
oracle database 10g enterprise edition release 11.2.0.1.0 - production
with the partitioning, olap and data mining options
sql> select count(*) from date_log;
count(*)
----------
sql>
至此:已驗證該靜態註冊可以成功的被解析,監聽,連線。
oracle監聽的靜態註冊
監聽的靜態註冊指的是指定監聽需要服務某個特定例項的客戶端連線。即在listener.ora檔案的sid list listener模組中明確寫明監聽需要處理的例項名字,但監聽並不需要關心資料庫伺服器上是否有真正的例項在執行。在靜態註冊環境下,在listener.ora檔案中主要配置以下內容 sid ...
oracle監聽動態註冊與靜態註冊
client端如果想要連線到遠端的資料庫伺服器,首先資料庫伺服器必須啟動 oracle 的配置在 oracle home network admin listener.ora,開啟這個檔案,我們看到配置如下 listener description list description address ...
Oracle中靜態註冊監聽的問題
問題描述 用asp.net基於oracle寫的bs web應用程式,出現乙個困擾很久的問題,就是過一段時間就會莫名其妙地出現無法連線資料庫的問題。可是直接通過sqlplus本地連線又是可以的。只能是重啟oracle開頭的所有服務,連線成功。查詢原因 剛開始以為是程式的問題,資料庫開了沒關,查詢了很久...