最初由 huaweihz 发布
[B]谢谢两位!现在我的疑问是不同的数据库在上面两个文件中端口配置是否要不一样?上面配的都是1522, listener.ora 文件如何指定监听这两个不同的数据库服务呢? [/B]
我这边10g用的是默认监听 Listener.ora并没有怎么配置,但是tnsnames.ora用一个端口配置几个服务名是没有问题的。。
看下面:
[oracle@localhost oracle]$ lsnrctl
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 07-NOV-2006 20:52:51
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Welcome to LSNRCTL, type "help" for information.
LSNRCTL> status
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=IPC)(KEY=EXTPROC1)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 12-OCT-2006 14:42:51
Uptime 26 days 6 hr. 10 min. 2 sec
Trace Level off
Security ON: Local OS Authentication
SNMP ON
Listener Parameter File /home/oracle/oracle/product/10.2.0/db_2/network/admin/listener.ora
Listener Log File /home/oracle/oracle/product/10.2.0/db_2/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC1)))
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=localhost.localdomain)(PORT=1521)))
Services Summary...
Service "AAABOSS" has 1 instance(s).
Instance "AAABOSS", status READY, has 1 handler(s) for this service...
Service "AAABOSSXDB" has 1 instance(s).
Instance "AAABOSS", status READY, has 1 handler(s) for this service...
Service "AAABOSS_XPT" has 1 instance(s).
Instance "AAABOSS", status READY, has 1 handler(s) for this service...
Service "BOSS" has 1 instance(s).
Instance "BOSS", status READY, has 1 handler(s) for this service...
Service "BOSSXDB" has 1 instance(s).
Instance "BOSS", status READY, has 1 handler(s) for this service...
Service "BOSS_XPT" has 1 instance(s).
Instance "BOSS", status READY, has 1 handler(s) for this service...
Service "PLSExtProc" has 1 instance(s).
Instance "PLSExtProc", status UNKNOWN, has 1 handler(s) for this service...
Service "PP" has 1 instance(s).
Instance "PP", status READY, has 1 handler(s) for this service...
Service "PPXDB" has 1 instance(s).
Instance "PP", status READY, has 1 handler(s) for this service...
Service "PP_XPT" has 1 instance(s).
Instance "PP", status READY, has 1 handler(s) for this service...
The command completed successfully
LSNRCTL> exit
[oracle@localhost oracle]$ tnsping aaaboss
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 07-NOV-2006 20:53:01
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
/home/oracle/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 = localhost.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = AAABOSS)))
OK (0 msec)
[oracle@localhost oracle]$ tnsping boss
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 07-NOV-2006 20:53:08
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
/home/oracle/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 = localhost.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = BOSS)))
OK (0 msec)
[oracle@localhost oracle]$ tnsping pp
TNS Ping Utility for Linux: Version 10.2.0.1.0 - Production on 07-NOV-2006 20:53:16
Copyright (c) 1997, 2005, Oracle. All rights reserved.
Used parameter files:
/home/oracle/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 = localhost.localdomain)(PORT = 1521)) (CONNECT_DATA = (SERVER = DEDICATED) (SERVICE_NAME = PP)))
OK (0 msec)
[oracle@localhost oracle]$ cd $ORACLE_HOME
[oracle@localhost db_2]$ ls
admin css install ldap mgw oracore racg sqlplus
assistants ctx install.platform lib network oraInst.loc rdbms srvm
bin dbs inventory localhost.localdomain_AAABOSS nls ord relnotes sysman
cdata demo javavm localhost.localdomain_BOSS oc4j oui root.sh uix
cfgtoollogs diagnostics jdbc localhost.localdomain_PP odbc owm root.sh.old wwg
clone flash_recovery_area jdk log olap perl slax xdk
config has jlib md OPatch plsql sqlj
crs hs jre mesg opmn precomp sqlnet.log
[oracle@localhost db_2]$ cd network/admin/
[oracle@localhost admin]$ ls
listener.ora samples shrept.lst sqlnet.log sqlnet.ora tnsnames.ora
[oracle@localhost admin]$ vi tnsnames.ora
(SERVER = DEDICATED)
(SERVICE_NAME = AAABOSS)
# tnsnames.ora Network Configuration File: /home/oracle/oracle/product/10.2.0/db_2/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
BOSS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = BOSS)
)
)
RCTBOSS =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = BOSS)
)
)
rct1229 =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 10.0.1.30 )(PORT = 1522))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = rct1229)
)
)
UD =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = AAABOSS)
)
)
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
PPE =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.12.51)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = ppe)
)
)
PP =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = PP)
)
)
aaaboss =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
(CONNECT_DATA =
(SERVER = DEDICATED)
(SERVICE_NAME = AAABOSS)
)
)
[oracle@localhost admin]$
[oracle@localhost admin]$ vi listener.ora
# listener.ora Network Configuration File: /home/oracle/oracle/product/10.2.0/db_2/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /home/oracle/oracle/product/10.2.0/db_2)
(PROGRAM = extproc)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC1))
(ADDRESS = (PROTOCOL = TCP)(HOST = localhost.localdomain)(PORT = 1521))
)
)
~
~