正確理解tnsnames.ora中的service_name
正確理解tnsnames.ora中的service_name
正解:tnsnames.ora中的service_name 其實應該是監聽程式監聽到
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "test.test.doudou.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "testXDB.test.doudou.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test_XPT.test.doudou.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully
場景回憶
檢視service_names,db_domain
SQL> show parameter service_names
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
service_names string test
SQL> show parameter db_domain
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
db_domain string test.doudou.com
tnsping 通,可以ping通
[ora@dg-ss dbs]$ tnsping test
TNS Ping Utility for Linux: Version 10.2.0.4.0 - Production on 08-AUG-2008 17:23:19
Copyright (c) 1997, 2007, Oracle. All rights reserved.
Used parameter files:
/opt/oracle/product/10.2.0/db_2/network/admin/sqlnet.ora
Used TNSNAMES adapter to resolve the alias
Attempting to contact (DESCRIPTION = (ADDRESS = (PROTOCOL = TCP)(HOST = dg-ss)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = test)))
OK (0 msec)
使用者登入確報錯 ORA-12514
[ora@dg-ss dbs]$ sqlplus doudou/123@test
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Aug 8 17:23:23 2008
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
ERROR:
ORA-12514: TNS:listener does not currently know of service requested in connect
descriptor
檢視監聽程式狀態
[ora@dg-ss dbs]$ lsnrctl status
LSNRCTL for Linux: Version 10.2.0.4.0 - Production on 08-AUG-2008 17:22:00
Copyright (c) 1991, 2007, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dg-ss)(PORT=1521)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.4.0 - Production
Start Date 08-AUG-2008 17:21:35
Uptime 0 days 0 hr. 0 min. 24 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /opt/oracle/product/10.2.0/db_2/network/admin/listener.ora
Listener Log File /opt/oracle/product/10.2.0/db_2/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=dg-ss)(PORT=1521)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Services Summary...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "test.test.doudou.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "testXDB.test.doudou.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
Service "test_XPT.test.doudou.com" has 1 instance(s).
Instance "test", status READY, has 1 handler(s) for this service...
The command completed successfully
檢視tnsnames.ora檔案
[ora@dg-ss admin]$ cat tnsnames.ora
TEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dg-ss)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test)
)
)
解決方法
TEST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = dg-ss)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = test.test.doudou.com)
)
)
使用者可以正常登入
[ora@dg-ss admin]$ sqlplus doudou/123@test
SQL*Plus: Release 10.2.0.4.0 - Production on Fri Aug 8 17:24:14 2008
Copyright (c) 1982, 2007, Oracle. All Rights Reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.4.0 - Production
With the Partitioning, OLAP, Data Mining and Real Application Testing options
SQL>
總結:
通過這次簡單的錯誤,讓我意識到研究oracle不能人云亦云,必須通過實驗才能研究的更深,更明瞭。
最後提醒自己一次tnsnames.ora中的service_name是監聽程式監聽到的service_name也可以認為是servcie_name=db_name.db_domain
來自 “ ITPUB部落格 ” ,連結:http://blog.itpub.net/26442936/viewspace-758902/,如需轉載,請註明出處,否則將追究法律責任。
相關文章
- LongTree的正確分析理解
- 正確理解和使用JAVA中的字串常量池Java字串
- 正確理解ThreadLocalthread
- 正確理解 PHP 的過載PHP
- 網友問題--service_names與tnsnames.ora中的service_name關係
- 正確理解CAP理論
- background-position的正確理解方式
- 正確理解memcached,才能更好的使用
- clojure中符號symbols 和變數vars的正確理解符號Symbol變數
- 如何正確理解棧和堆?
- 怎樣正確理解volatile?
- 正確理解Hibernate Inverse (轉)
- 正確理解BI(商業智慧)
- 專案實施中如何正確理解“ERP”(轉)
- 談如何正確理解 IP 資料的覆蓋率,兼談正確率~
- 如何理解並正確使用 MySQL 索引MySql索引
- 正確理解 PHP 錯誤資訊(轉)PHP
- 如何正確理解「指標」和「標籤」指標
- 理解並正確使用synchronized和volatilesynchronized
- Android中Handler的正確使用Android
- C#中dynamic的正確用法C#
- 編寫高質量的js之正確理解正規表示式回溯JS
- 正確理解PHP程式編譯時的錯誤資訊PHP編譯
- 正確理解手機智慧作業系統作業系統
- 正確理解專案交付成果(Deliverable)(轉)
- Retrofit中如何正確的使用https?HTTP
- 如何正確的從UI圖中取色UI
- 【轉】C#中dynamic的正確用法C#
- Python 中 Unicode 的正確用法PythonUnicode
- 正確使用Windows Azure 中的VM RoleWindows
- 我理解的關於Vue.nextTick()的正確使用Vue
- 如何正確理解Python培訓?有必要嗎?Python
- Recoil 中預設值的正確處理
- 如何正確實現 Java 中的 HashCodeJava
- 如何正確讀取RTI中enum
- 理解玩家的正確姿勢:遊戲到底意味著什麼?遊戲
- 正確理解預算管理與績效管理的關係(轉)
- RoR的正確定位