Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Modify Oracle default listening port

2025-02-23 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

As we all know, the default port for Oracle snooping is 1521, but if 1521 on the system is already occupied or the business requires that the default port is not used, you need to modify the default port for listening.

To modify the listening port, you only need to modify the configuration file listiner.ora, and then restart the listening. However, the PMON process of the Oracle instance will still go to the listener process listening on port 1521 to register, so the database configuration needs to be modified at the same time. You only need to modify LOCAL_LISTINER online in the database.

Let's take 11.2.0.4 as an example to test and modify the listening port:

1. Modify the listening port

# check the listening status [oracle@rhel6 ~] $lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0-Production on 07-JAN-2017 20:16:24Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=1521)) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0-ProductionStart Date 07-JAN-2017 20:16:16Uptime 0 days 0 hr. 0 min. 8 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / u02/app/oracle/product/11.2.4/db1/network/admin/listener.oraListener Log File / u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=1521)) (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) Services Summary...Service "orcl" has 1 instance (s). Instance "orcl", status READY, has 1 handler (s) for this service...The command completed successfully# stop listening [oracle@rhel6 ~] $lsnrctl stopLSNRCTL for Linux: Version 11.2.0.4.0-Production on 07-JAN-2017 20:17:39Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=1521)) The command completed successfully# modifies the configuration file listener.ora Change the listening port to 2521LISTENER = (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) # start listening [oracle@rhel6] $lsnrctl startLSNRCTL for Linux: Version 11.2.0.4.0-Production on 07-JAN-2017 20:19:11Copyright (c) 1991, 2013, Oracle. All rights reserved.Starting / u02/app/oracle/product/11.2.4/db1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 11.2.0.4.0-ProductionSystem parameter file is / u02/app/oracle/product/11.2.4/db1/network/admin/listener.oraLog messages written to / u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xmlListening on: (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) ) Listening on: (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0-ProductionStart Date 07-JAN-2017 20: 19:11Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / u02/app/oracle/product/11.2.4/db1/network/admin/listener.oraListener Log File / u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521) (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) The listener supports no servicesThe command completed successfully

At this point, the listening port has been modified, and the Oracle instance cannot be registered with this listener.

2. Modify LOCAL_LISTINER parameters

# modify the parameters sys@ORCL > alter system set local_listener= "(address = (protocol = tcp) (host = rhel6) (port = 2521)"; System altered.# to view the listening status [oracle@rhel6 ~] $lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0-Production on 07-JAN-2017 20:23:10Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0-ProductionStart Date 07-JAN-2017 20:19:11Uptime 0 days 0 hr. 3 min. 59 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / u02/app/oracle/product/11.2.4/db1/network/admin/listener.oraListener Log File / u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) Services Summary...Service "orcl" has 1 instance (s). Instance "orcl", status READY, has 1 handler (s) for this service...The command completed successfully

After the modification, you can see that the database instance is immediately registered with the listener.

3. Test the connection using the new port

[C:\] $sqlplus zx/zx@192.168.56.2:2521/orclSQL*Plus: Release 12.1.0.1.0 Production on Saturday January 7 20:24:17 2017Copyright (c) 1982, 2013, Oracle. All rights reserved. Connect to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL >

Modification of listening port completed.

4. Change the registration port of the Oracle instance back to 1521

Sys@ORCL > alter system set local_listener='';System altered.

Another way to configure LOCAL_LISTINER is also provided in the official documentation:

Add the configuration in tnsnames.ora, and then configure LOCAL_LISTINER to be the name in tnsnames.ora.

# configure tnsnames.ora [oracle@rhel6 admin] $vi tnsnames.ora listener1= (ADDRESS = (PROTOCOL = TCP) (HOST = 192.168.56.2) (PORT = 2521) # modify the LOCAL_LISTINER parameter sys@ORCL > alter system set local_listener=listener1;System altered.# to view the monitoring status [oracle@rhel6 ~] $lsnrctl statusLSNRCTL for Linux: Version 11.2.0.4.0-Production on 07-JAN-2017 20:34:01Copyright (c) 1991, 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0-ProductionStart Date 07-JAN-2017 20:31:28Uptime 0 days 0 hr. 2 min. 33 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / u02/app/oracle/product/11.2.4/db1/network/admin/listener.oraListener Log File / u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) Services Summary...Service "orcl" has 1 instance (s). Instance "orcl", status READY, has 1 handler (s) for this service...The command completed successfully

You can also use static listening to modify the listening port, but the Oracle instance is not "actively" registered with the listener.

Sys@ORCL > show parameter local_listenerNAME TYPE VALUE -local_listener string# modified listening to static listening [oracle@rhel6 admin] $vi listener.oraLISTENER= (DESCRIPTION= (ADDRESS_LIST= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) SID_LIST_LISTENER= (SID_LIST= (SID_DESC= ( GLOBAL_DBNAME=orcl) (ORACLE_HOME=/u02/app/oracle/product/11.2.4/db1) (SID_NAME=orcl) # restart listening [oracle@rhel6 ~] $lsnrctl stopLSNRCTL for Linux: Version 11.2.0.4.0-Production on 07-JAN-2017 20:38:45Copyright (c) 1991 2013, Oracle. All rights reserved.Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) The command completed successfully [oracle@rhel6] $lsnrctl startLSNRCTL for Linux: Version 11.2.0.4.0-Production on 07-JAN-2017 20:38:51Copyright (c) 1991, 2013, Oracle. All rights reserved.Starting / u02/app/oracle/product/11.2.4/db1/bin/tnslsnr: please wait...TNSLSNR for Linux: Version 11.2.0.4.0-ProductionSystem parameter file is / u02/app/oracle/product/11.2.4/db1/network/admin/listener.oraLog messages written to / u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xmlListening on: (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) ) Listening on: (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) Connecting to (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521) STATUS of the LISTENER----Alias LISTENERVersion TNSLSNR for Linux: Version 11.2.0.4.0-ProductionStart Date 07-JAN-2017 20: 38:52Uptime 0 days 0 hr. 0 min. 0 secTrace Level offSecurity ON: Local OS AuthenticationSNMP OFFListener Parameter File / u02/app/oracle/product/11.2.4/db1/network/admin/listener.oraListener Log File / u02/app/oracle/diag/tnslsnr/rhel6/listener/alert/log.xmlListening Endpoints Summary... (DESCRIPTION= (ADDRESS= (PROTOCOL=tcp) (HOST=0.0.0.0) (PORT=2521)) (DESCRIPTION= (ADDRESS= (PROTOCOL=ipc) (KEY=extproc) Services Summary...Service "orcl" has 1 instance (s). Instance "orcl", status UNKNOWN, has 1 handler (s) for this service...The command completed successfully

The status of the static listening instance is UNKNOWN, and the test connection is successful

[C:\] $sqlplus zx/zx@192.168.56.2:2521/orclSQL*Plus: Release 12.1.0.1.0 Production on Saturday January 7 20:40:03 2017Copyright (c) 1982, 2013, Oracle. All rights reserved. Connect to: Oracle Database 11g Enterprise Edition Release 11.2.0.4.0-64bit ProductionWith the Partitioning, OLAP, Data Mining and Real Application Testing optionsSQL >

Official documents:

Http://docs.oracle.com/cd/E11882_01/network.112/e41945/listenercfg.htm#NETAG1154

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report