Oracle change port 1521 TCPs

这篇具有很好参考价值的文章主要介绍了Oracle change port 1521 TCPs。希望对大家有所帮助。如果存在错误或未考虑完全的地方,请大家不吝赐教,您也可以点击"举报违法"按钮提交疑问。

col name for a20
col value for a200
select name ,value from gv$parameter a where a.NAME like '%listener%';

(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.6)(PORT=1521)),(ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.6)(PORT=1522))

 prod1-scan:1521

(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.7)(PORT=1521)),(ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.7)(PORT=1522))

 prod1-scan:1521

(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.5)(PORT=1521)),(ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.5)(PORT=1522))

 prod1-scan:1521

 (ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.6)(PORT=1623)), (ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.6)(PORT=1522)), (ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.6)(PORT=1622))

 nonprod2-scan:1623

 (ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.7)(PORT=1623)), (ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.7)(PORT=1522)), (ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.7)(PORT=1622))

 nonprod2-scan:1623

----

However, if you are changing the default listener port number, the database instances will not be able to register themselves with this new listener as the database will contact the listener(s) on the default port 1521.

lsnrctl status

LSNRCTL for Linux: Version 19.0.0.0.0 - Production on 01-AUG-2023 18:08:42

Copyright (c) 1991, 2023, Oracle.  All rights reserved.

Connecting to (ADDRESS=(PROTOCOL=tcp)(HOST=)(PORT=1521))
TNS-12541: TNS:no listener
 TNS-12560: TNS:protocol adapter error
  TNS-00511: No listener
   Linux Error: 111: Connection refused
 

netstat -ntpu|grep 1521
(Not all processes could be identified, non-owned process info
 will not be shown, you would have to be root to see it all.)
 

How do you change the default port 1521 to another port for a RAC configuration?
 

SOLUTION

To get the current settings of your listener on RAC issue the following command:

> srvctl config listener

The output should be similar to the following

Name: LISTENER
Network: 1, Owner: oracle
Home: <CRS home>
End points: TCP:1521

Points to bear in mind: 

+ The ILOM server is independent of the listener and will require no changes. (Exadata)

+ Cell Servers do not have Oracle Listeners on them and will also require no changes (Exadata)

+ At some point you have to restart the listener on each node. Depending on how your services are set up you may 'drive' traffic to one node if there are many connections. For this reason these changes should be done during a quiet time. 

Steps to achieve the changes

(1) Amend the ports used with a command similar to the following

> srvctl modify listener -l LISTENER -p "TCP:<new-listener-port>"

srvctl modify scan_listener -p "TCP:1623/TCPS:1522/TCPS:1622"

This changes the entry in OCR, so that a listener restart will pick up the new values. Existing connections will remain connected.

(2) Modify the scan listener if applicable with

> srvctl modify scan_listener -p <new-scan-port>

(3) LOCAL_LISTENER should be changed manually

An example would be

SQL> alter system set local_listener='(DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=<Host-name>)(PORT=<new-port-number>))))' scope=both sid='[<your-chosen-instance> | * ] '

(4) Make similar changes to the REMOTE_LISTENER

(5) endpoints_listener.ora and local_listener.ora for each SID are only changed after the listener is stopped and restarted.

Per Internal Bug 27486484
 The listener agent should not longer create/maintain endpoints_listener.ora from 19.1,
 also 19.1 GI does not support database earlier than 11.2.

(6) Check the configuration afterwards with "srvctl config Listener".

How do we change the default listener (TCP) port number ?
 

SOLUTION

By default, after installing Oracle Database Server, the Listener service will wait for and accept connections on TCP port 1521. However, it is possible to reconfigure the listener to use a different port. The procedure comprises two steps: reconfiguring the listener and reconfiguring the database instance(s) to register to the listener on the new, non-default port.

You may not use ports numbered lower than 1024 as these require special user privileges. The maximum value is around 65500.   Oracle does not recommend using a port in the ephemeral range for the listener.  Please see your specific OS documentation for information regarding the ephemeral port range.  Please consult Oracle's Installation Guide for your OS and RDBMS version as well.  
 

There are two ways to achieve this: through the configuration tools or by manually adjusting the appropriate configuration files. The preferred way is to use the configuration tools.

A. Using Configuration Tools  

Before changing the listener configuration you should stop it  run the following command: "lsnrctl stop".

Launch Oracle Net Manager (execute "netmgr" at the command line) and follow these steps:

  • Select Local / Listeners / LISTENER in the left pane
  • Select Listening Locations in the right pane upper selection button
  • Browse through the AddressX tabs and choose the one with Protocol TCP/IP
  • Change the value in the Port: field to your desired port number.
  • In the left pane select Local / Service Naming
  • Create a new Net Service Name:
    • Click the green plus ("+") icon on the leftmost toolbar; dialog will appear
    • Type a name for the new Service Name (e.g. MYLISTENER); press Next
    • Select TCP/IP (Internet Protocol); press Next
    • Type your hostname in Hostname: field and the same port number you chose in the previous steps in the Port Number: field; press Next
    • Type the name of an existent database (e.g. ORCL); press Next
    • Optionally you may Test the new connection
    • Press Finish
  • Select from menus File / Save Network Configuration and close the Net Manager

Restart the listener by running the following commands at the command prompt: "lsnrctl start".

However, after you changed the default listener port number, the database instances will not be able to register themselves with this new listener as the database will contact the listener(s) on the default port 1521. To fix this problem you need to add/change the "local_listener" initialization parameter for each database.

Use Oracle Enterprise Manager to change the "local_listener" initialization parameter to have the value "MYLISTENER" for the database(s) you work with or create in the future. Make sure you make this change permanent by storing it in the SPFile, in which case you need to restart the database instance to take effect.

B. Using Configuration Files

Before changing the listener configuration you should stop it by running the following command: "lsnrctl stop".

The Oracle Listener is configured through the LISTENER.ORA file, which, by default is located in ORACLE_HOME under the NETWORK / ADMIN subdirectory. Edit this file with you preferred text editor and change the (PORT=1521) from under the default LISTENER profile to your desired value. If you do not have this file then you may use the following sample:

LISTENER =
    (ADDRESS_LIST =
        (ADDRESS = (PROTOCOL = IPC)(KEY = EXTPROC0))
        (ADDRESS = (PROTOCOL = TCP)(HOST = myhostname)(PORT = myport))
    )


Please replace "myhostname" with your system hostname and "myport" with your desired port number. After changing the LISTENER.ORA file you need to restart the listener. To do that run the following commands at the command prompt: "lsnrctl start".

However, if you are changing the default listener port number, the database instances will not be able to register themselves with this new listener as the database will contact the listener(s) on the default port 1521.

To fix this problem you need to add/change the "local_listener" initialization parameter for each database. This can be achieved in two steps: creating a alias name for the new listener and adjusting the LOCAL_LISTENER initialization parameter.

In the TNSNAMES.ORA file (in the same location as LISTENER.ORA) add the following entry:

MYLISTENER =
    (DESCRIPTION =
        (ADDRESS = (PROTOCOL = TCP)(HOST = myserver )(PORT = myport))
)


Please replace the "myhostname" and "myport" with the values used for listener configuration in LISTENER.ORA.

Now adjust the LOCAL_LISTENER parameter — use the following SQL statement as SYSDBA:

ALTER SYSTEM SET LOCAL_LISTENER='MYLISTENER' SCOPE=BOTH  

--可以直接写(ADDRESS=(PROTOCOL=TCP)(HOST=x.x.x.7)(PORT=1623)), (ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.7)(PORT=1522)), (ADDRESS=(PROTOCOL=TCPS)(HOST=x.x.x.7)(PORT=1622)) 不用修改tnsnames.ora 防止文件被删了

Please take into consideration the effect of the SCOPE argument (as shown above it will also save the change in the spfile); also you may want to restrict the change to a certain instance with the help of the SID='<db_sid>' argument, if you employ a common spfile for many instances.

Please note that you may need to run this command for each Oracle database you have or which you will create on the server.


For the reference documentation see Oracle Database Net Services Administrator's Guide, Chapter "Configuring and Administering the Listener".
For RAC and/or SCAN please see:
Changing Listener Ports On RAC/EXADATA (Doc ID 1473035.1)文章来源地址https://www.toymoban.com/news/detail-622814.html

到了这里,关于Oracle change port 1521 TCPs的文章就介绍完了。如果您还想了解更多内容,请在右上角搜索TOY模板网以前的文章或继续浏览下面的相关文章,希望大家以后多多支持TOY模板网!

本文来自互联网用户投稿,该文观点仅代表作者本人,不代表本站立场。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如若转载,请注明出处: 如若内容造成侵权/违法违规/事实不符,请点击违法举报进行投诉反馈,一经查实,立即删除!

领支付宝红包 赞助服务器费用

相关文章

  • 【Oracle】收集Oracle数据库内存相关的信息

    【声明】文章仅供学习交流,观点代表个人,与任何公司无关。 编辑|SQL和数据库技术(ID:SQLplusDB) Oracle数据库包含多个内存区域,每个区域都包含多个子组件。 Oracle Database Memory Structures 根据具体问题的需要,可以通过如下命令收集Oracle数据库内存相关的信息。 例: 注:SET

    2024年01月21日
    浏览(67)
  • 【Oracle】使用 SQL Developer 连接 Oracle 数据库

    SQL Developer 是 Oracle 官方推出的一款免费的数据库开发工具,它提供了丰富的数据库开发功能,其中包括连接 Oracle 数据库的功能。 在本文中,我们将从多个方面详细阐述如何使用 SQL Developer 连接 Oracle 数据库。 在连接 Oracle 数据库前,需要需要做一些准备工作,包括安装 SQ

    2024年02月06日
    浏览(67)
  • Oracle 开发篇+Java通过HiKariCP访问Oracle数据库

    标签:HikariCP、数据库连接池、JDBC连接池、 释义:HikariCP 是一个高性能的 JDBC 连接池组件,号称性能最好的后起之秀,是一个基于BoneCP做了不少的改进和优化的高性能JDBC连接池。 ★ Java代码 ※ 如果您觉得文章写的还不错, 别忘了在文末给作者点个赞哦 ~

    2024年02月13日
    浏览(54)
  • <Oracle>《Linux 下安装Oracle数据库 - Oracle 19C By CentOS 8 》(第三部分)

    2.5.1 修改centos主机名 类型 英文 解释 静态 Static hostname 内核主机名,是系统在启动时从/etc/hostname自动初始化的主机名。 瞬态 Tansient hostname 系统运行时临时分配的主机名,例如,通过DHCP或mDNS服务器分配。 灵活 Pretty hostname 有人叫做“别名”主机名,允许使用自由形式(包括

    2024年02月11日
    浏览(61)
  • Oracle数据库从入门到精通系列之十八:Oracle进程

    Oracle中的每个进程都要执行一个特定的任务(或一组任务),每个进程都会为自己分配内存(PGA)来完成它的任务。 一个Oracle实例主要有以下3类进程: 服务器进程(server process)。 后台进程(background process)。 从属进程(slave process)。 这些进程根据客户端的请求来完成工作。 专用服务

    2024年02月09日
    浏览(56)
  • Oracle数据库

    ①层次型数据库 ②网状型数据库 ③关系型数据库(主要介绍) E-R图:属性(椭圆形),实体(矩形),联系(菱形-一对一、一对多、多对多) 注:有的联系也有属性 关系型数据库的设计范式: 第一范式(1NF):属性不可再分,字段保证原子性 第二范式(2NF):在满足1

    2024年02月08日
    浏览(57)
  • 基于RHEL9,ORACLE LINUX 9安装Oracle 19c 数据库

    要基于RHEL9,ORACLE LINUX 9 或RHEL分支,安装ORACLE 19C 数据库,在一年前,没有人会告诉你能够成功,都会告诉你说19C只支持 RHEL7/8,在RHEL9上不支持, 如果你非要安装,在安装到11%时,就会报以下错误: Error in invoking target \\\' libasmclntsh19.ohso libasmperl19.ohso client_sharedlib \\\' of makefile \\\'/u

    2024年02月03日
    浏览(58)
  • Oracle 数据库恢复删除的数据

    需求描述: 同事让删除脏数据,结果删错了,需要恢复数据 思路: 利用闪回恢复数据只能恢复15分钟之内的,后面undo空间会被重写,就恢复不了,所以删除数据后,要谨慎再三确认,若发现不对,则利用闪回恢复 先查询删除时的时间节点的快照 查到时间戳之后 闪回恢复数

    2024年01月24日
    浏览(68)
  • 电脑上不安装Oracle,但是虚拟机装了Oracle,怎么连接到虚拟机里的Oracle数据库呢?

    注:如果知道数据库的版本信息,这个步骤可以跳过。 比较简单的方法,直接看数据库的安装位置,也就是数字(但是这个方法确定就是,不好确定是多少位的数据库) 另外一种是登录Oracle,查看版本信息(sqlplus 用户名/用户密码) 后面的配置需要 select userenv(‘language’

    2024年01月16日
    浏览(43)
  • Oracle数据库概念简介

    一般意义上的数据库包含两个部分 库:就是一个存储一堆文件的文件目录 数据库管理系统:管理库的系统 数据库管理系统(Database Management System),是一种操纵和管理数据库的大型软件,用于建立、使用和维护数据库,简称 DBMS ; 它对数据库进行统一的管理和控制,以保证数

    2024年02月09日
    浏览(49)

觉得文章有用就打赏一下文章作者

支付宝扫一扫打赏

博客赞助

微信扫一扫打赏

请作者喝杯咖啡吧~博客赞助

支付宝扫一扫领取红包,优惠每天领

二维码1

领取红包

二维码2

领红包