==================================================================================================
當改變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