==================================================================================================
当改变Listener的默认端口1521的时候,需要在tnsnames.ora里面进行修改,并且指定Oracle的local_listener
参数,才能实现监听的动态注册
P.S 注册过程是通过后台进程PMON实现的
==================================================================================================
Last login: Wed Dec 27 15:14:39 2006 from 192.168.10.100
[oracle@vmrhel4 admin]$ cat listener.ora
# listener.ora Network Configuration File: /u01/app/oracle/product/10.2.1/network/admin/listener.ora
# Generated by Oracle configuration tools.
SID_LIST_LISTENER =
(SID_LIST =
(SID_DESC =
(SID_NAME = PLSExtProc)
(ORACLE_HOME = /u01/app/oracle/product/10.2.1)
(PROGRAM = extproc)
)
)
--这里改变了默认的1521为1520
LISTENER =
(DESCRIPTION_LIST =
(DESCRIPTION =
(ADDRESS = (PROTOCOL = TCP)(HOST = vmrhel4.localdomain)(PORT = 1520))
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
)
--还没有更新tnsnames.ora
[oracle@vmrhel4 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
[oracle@vmrhel4 admin]$ lsnrctl start
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 27-DEC-2006 15:22:51
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Starting /u01/app/oracle/product/10.2.1/bin/tnslsnr: please wait...
TNSLSNR for Linux: Version 10.2.0.1.0 - Production
System parameter file is /u01/app/oracle/product/10.2.1/network/admin/listener.ora
Log messages written to /u01/app/oracle/product/10.2.1/network/log/listener.log
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vmrhel4.localdomain)(PORT=1520)))
Listening on: (DESCRIPTION=(ADDRESS=(PROTOCOL=ipc)(KEY=EXTPROC0)))
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vmrhel4.localdomain)(PORT=1520)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 27-DEC-2006 15:22:51
Uptime 0 days 0 hr. 0 min. 0 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vmrhel4.localdomain)(PORT=1520)))
(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...
The command completed successfully
--启动数据库
[oracle@vmrhel4 admin]$ sqlplus '/ as sysdba'
[uniread] Loaded history (38 lines)
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 27 15:23:23 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to an idle instance.
idle> startup
ORACLE instance started.
Total System Global Area 205520896 bytes
Fixed Size 1218532 bytes
Variable Size 67110940 bytes
Database Buffers 134217728 bytes
Redo Buffers 2973696 bytes
Database mounted.
Database opened.
idle> show parameter local_lis
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
idle> exit
--没有设置local_listener参数
--这时候通过OracleNet登录,返回ORA-12560错误
=============进行相应的修改
Disconnected from Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
[uniread] Saved history (41 lines)
[oracle@vmrhel4 admin]$ cat tnsnames.ora
# tnsnames.ora Network Configuration File: /u01/app/oracle/product/10.2.1/network/admin/tnsnames.ora
# Generated by Oracle configuration tools.
EXTPROC_CONNECTION_DATA =
(DESCRIPTION =
(ADDRESS_LIST =
(ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
)
(CONNECT_DATA =
(SID = PLSExtProc)
(PRESENTATION = RO)
)
)
--增加这句
LISTENER_NEW=(ADDRESS=(PROTOCOL=TCP)(HOST=192.168.10.150)(PORT=1520))
[oracle@vmrhel4 admin]$ sqlplus '/ as sysdba'
[uniread] Loaded history (41 lines)
SQL*Plus: Release 10.2.0.1.0 - Production on Wed Dec 27 15:25:27 2006
Copyright (c) 1982, 2005, Oracle. All rights reserved.
Connected to:
Oracle Database 10g Enterprise Edition Release 10.2.0.1.0 - Production
With the Partitioning, OLAP and Data Mining options
sys@TESTDB> show parameter local_lis
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string
sys@TESTDB> alter system set local_listener='listener_new';
System altered.
sys@TESTDB> show parameter local_lis
NAME TYPE VALUE
------------------------------------ ----------- ------------------------------
local_listener string listener_new
--可以看到动态注册
sys@TESTDB> !lsnrctl status
LSNRCTL for Linux: Version 10.2.0.1.0 - Production on 27-DEC-2006 15:25:56
Copyright (c) 1991, 2005, Oracle. All rights reserved.
Connecting to (DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=vmrhel4.localdomain)(PORT=1520)))
STATUS of the LISTENER
------------------------
Alias LISTENER
Version TNSLSNR for Linux: Version 10.2.0.1.0 - Production
Start Date 27-DEC-2006 15:22:51
Uptime 0 days 0 hr. 3 min. 5 sec
Trace Level off
Security ON: Local OS Authentication
SNMP OFF
Listener Parameter File /u01/app/oracle/product/10.2.1/network/admin/listener.ora
Listener Log File /u01/app/oracle/product/10.2.1/network/log/listener.log
Listening Endpoints Summary...
(DESCRIPTION=(ADDRESS=(PROTOCOL=tcp)(HOST=vmrhel4.localdomain)(PORT=1520)))
(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 "TESTDB.VMRHEL4" has 1 instance(s).
Instance "TESTDB", status READY, has 1 handler(s) for this service...
Service "TESTDBXDB.VMRHEL4" has 1 instance(s).
Instance "TESTDB", status READY, has 1 handler(s) for this service...
Service "TESTDB_XPT.VMRHEL4" has 1 instance(s).
Instance "TESTDB", status READY, has 1 handler(s) for this service...
The command completed successfully
转载于:https://www.cnblogs.com/wait4friend/archive/2012/01/13/2334567.html