设计为 oracle service 自动注册到1522号端口上,静态注册到1521号端口上
1>在主机端修改tnsname.ora
添加一行 cat tnsnames.ora
LISTENER =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = yysf)(PORT = 1522))
)
2>netca 建立新的监听,名字为 csyh,端口为1522
[oracle@~]$netca
Oracle Net Services Configuration:
Configuring Listener:csyh
Listener configuration complete.
Oracle Net Listener Startup:
Running Listener Control:
/oracle/product/10.2.0/db_1/bin/lsnrctl start CSYH
Listener Control complete.
Listener started successfully.
Oracle Net Services configuration successful. The exit code is 0
3>进入想注册的数据库上,加入相应的信息
SQL> alter system set local_listener=listener;
系统已更改。
4>修改老的Listener,改为静态注册模式:
[oracle@/oracle/product/10.2.0/db_1/network/admin]$cat listener.ora
# listener.ora Network Configuration File: /oracle/product/10.2.0/db_1/network/admin/listener.ora
# Generated by Oracle configuration tools.
CSYH =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = yysf)(PORT = 1522))
)
)
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(PROGRAM = extproc)
)
(SID_DESC =
(ORACLE_HOME = /oracle/product/10.2.0/db_1)
(SID_NAME = orcl)
)
)
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = yysf)(PORT = 1521))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
6、此时两个监听都是好的,同时从客户端用两个监听都可以连接
C:/Documents and Settings/Administrator>tnsping listener2
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 06-8月
2010 21:42:42
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的参数文件:
D:/oracle/product/10.2.0/client_1/network/admin/sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP
(HOST = 192.168.229.2)(PORT = 1522))) (CONNECT_DATA = (SERVICE_NAME = orcl)))
OK (0 毫秒)
C:/Documents and Settings/Administrator>sqlplus cx/cx@listener2
SQL*Plus: Release 10.2.0.1.0 - Production on 星期五 8月 6 21:55:44 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> quit
||||||||||
C:/Documents and Settings/Administrator>sqlplus cx/cx@192.168.229.2
SQL*Plus: Release 10.2.0.1.0 - Production on 星期五 8月 6 21:56:14 2010
Copyright (c) 1982, 2005, Oracle. All rights reserved.
连接到:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
SQL> select count(*) from tabs;
COUNT(*)
----------
1
SQL> exit
C:/Documents and Settings/Administrator>tnsping 192.168.229.2
TNS Ping Utility for 32-bit Windows: Version 10.2.0.1.0 - Production on 06-8月 -
2010 22:02:48
Copyright (c) 1997, 2005, Oracle. All rights reserved.
已使用的参数文件:
D:/oracle/product/10.2.0/client_1/network/admin/sqlnet.ora
已使用 TNSNAMES 适配器来解析别名
Attempting to contact (DESCRIPTION = (ADDRESS_LIST = (ADDRESS = (PROTOCOL = TCP)
(HOST = 192.168.229.2)(PORT = 1521))) (CONNECT_DATA = (SERVICE_NAME = orcl)))
OK (0 毫秒)