How to Modify SCAN Setting or SCAN Listener Port after Installation 如何修改SCAN的设置和SCAN监听的端口

Oracle Grid Infrastructure SCAN设置与监听端口调整指南
本文提供了一套更新Oracle Grid Infrastructure SCAN设置或监听端口的方法,适用于11g R2版本及之后的Oracle数据库企业版。包括通过DNS或主机文件配置SCAN名,调整端口设置,以及在不同网络间的迁移。详细步骤确保了数据库集群的正常运行与高效管理。

How to Modify SCAN Setting or SCAN Listener Port after Installation (文档 ID 972500.1)

Applies to:
Oracle Database - Enterprise Edition - Version 11.2.0.1 and later
Information in this document applies to any platform.

Goal
This note provides steps to update 11gR2 Grid Infrastructure (CRS) Single Client Access Name (SCAN) setting or SCAN listener port setting if it's not setup properly or if it's changed after setup.

Note:

1. This procedure does not apply when GNS is being used
2. Even though clustername and SCAN name is set to the same during 'typical' installation, changing SCAN name will not affect clustername as change of clustername requires deconfigure and reconfigure of the entire cluster.

 

Solution
 

A. To update SCAN setting
1. As per documentation "Oracle Grid Infrastructure Installation Guide", Oracle strongly recommend to configure SCAN name in either DNS or GNS as /etc/hosts file can only resolve to one IP address.

SCAN IP must be in same subnet as public and VIP. If the new SCAN IP will be in different subnet, refer to note 276434.1 to change nodeapps/network resource first.

1a. If you intend to use /etc/hosts for SCAN name resolution, the same and only entry for SCAN name must exist on all nodes.

1b. If you intend to use DNS for SCAN name resolution, remove entries for SCAN name from /etc/hosts on all nodes, and make sure nslookup returns good result on all nodes, for example:

 

$ nslookup pay-scan.us.oracle.com
..
Name:   pay-scan.us.oracle.com
Address: 10.4.0.201
Name:   pay-scan.us.oracle.com
Address: 10.4.0.202
Name:   pay-scan.us.oracle.com
Address: 10.4.0.203

2. Once #1a or #1b is configured properly, execute the following to modify:

If name resolution for SCAN is being switched from local hosts file to DNS, be sure to remove SCAN name in local hosts file on all nodes prior to execute below commands.

2.1. To modify SCAN name or SCAN VIP addresses:

2.1.1. As grid user stop resources:

$ $GRID_HOME/bin/srvctl stop scan_listener
$ $GRID_HOME/bin/srvctl stop scan

2.1.2. As root user modify SCAN:

# $GRID_HOME/bin/srvctl modify scan -n pay-scan.us.oracle.com 

### For 11.2.0.1 only, if you intend to change SCAN name, due to bug 9603829, execute the following:

# $GRID_HOME/bin/crsctl modify type ora.scan_vip.type -attr "ATTRIBUTE=SCAN_NAME,DEFAULT_VALUE=<new SCAN name>"

### Example:
# $GRID_HOME/bin/crsctl modify type ora.scan_vip.type -attr "ATTRIBUTE=SCAN_NAME,DEFAULT_VALUE=pay-scan.us.oracle.com"

Once SCAN name is changed, update database init.ora/spfile parameter remote_listener to the new one.

2.1.3. As grid user modify and start resources:

$ $GRID_HOME/bin/srvctl modify scan_listener -u
$ $GRID_HOME/bin/srvctl start scan_listener

2.1.4. To confirm the change

$ $GRID_HOME/bin/srvctl config scan
SCAN name: pay-scan.us.oracle.com, Network: 1/10.4.0.0/255.255.255.0/eth1
SCAN VIP name: scan1, IP: /10.4.0.201/120.0.0.201
SCAN VIP name: scan2, IP: /10.4.0.202/120.0.0.202
SCAN VIP name: scan3, IP: /10.4.0.203/120.0.0.203

$ $GRID_HOME/bin/srvctl config scan_listener
SCAN Listener LISTENER_SCAN1 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN2 exists. Port: TCP:1521
SCAN Listener LISTENER_SCAN3 exists. Port: TCP:1521


2.2. To change SCAN to be on second network:

By default, SCAN will be configured on first public network (ora.net1.network), however in multiple public network environment, SCAN can run on second or other network.

There's no option to modify SCAN to use non-first network, to change to second or other network, scan_listener and scan resources need to be removed and added back.

In this example, we'll move SCAN from net1 to net2

 

$ $GRID_HOME/bin/srvctl config network
Network exists: 1/10.1.0.0/255.255.255.128/eth3, type static
Network exists: 2/10.1.1.0/255.255.255.128/eth4, type static

2.2.1. As grid user stop resources and remove scan_listener:

$ $GRID_HOME/bin/srvctl stop scan_listener$ $GRID_HOME/bin/srvctl stop scan
$ $GRID_HOME/bin/srvctl remove scan_listener -f

2.2.2. As root user remove and add SCAN:

# $GRID_HOME/bin/srvctl remove scan -f
#$GRID_HOME/bin/srvctl add scan -n <scan-name> -k 2

Once SCAN name is changed, update database init.ora/spfile parameter remote_listener to the new one.

2.2.3. As grid user add scan_listener and start resources:

$ $GRID_HOME/bin/srvctl add scan_listener-p <port>
$ $GRID_HOME/bin/srvctl start scan_listener

 


B. To modify SCAN listener port
As grid user:

1. Modify SCAN listener port:

 

$GRID_HOME/bin/srvctl modify scan_listener -p <new-SCAN-port>
Update 11gR2 database init.ora parameter: alter system set remote_listener='<SCAN-name>:<new-port-number>' scope=both;

 

2. Restart SCAN listener so the new port will be effective:

$GRID_HOME/bin/srvctl stop scan_listener
$GRID_HOME/bin/srvctl start scan_listener


3. Confirm the change:

 

$GRID_HOME/bin/srvctl config scan_listener

 

### 修改 Oracle RAC 中的 SCAN 监听器配置 在 Oracle RAC 环境中,SCAN(Single Client Access Name)监听器是用于客户端访问集群数据库的关键组件。为了更新 SCAN 监听器的配置,可以使用 `srvctl modify scan_listener` 命令。以下是关于如何使用该命令的具体说明注意事项。 #### 使用 srvctl modify scan_listener 命令 `srvctl modify scan_listener` 命令允许管理员更改与 SCAN 监听器相关的配置参数。例如,可以通过此命令修改监听器的端口号或用户权限等设置。以下是该命令的基本语法[^4]: ```bash srvctl modify scan_listener -u <oracle_user> ``` - `-u` 参数指定运行监听器的用户账户。 - 如果需要修改其他参数,例如端口号,则可以结合 `-p` 参数一起使用。 #### 示例:修改 SCAN 监听器的用户 以下是一个示例,展示如何将 SCAN 监听器的运行用户更改为 `grid` 用户: ```bash srvctl modify scan_listener -u grid ``` #### 示例:修改 SCAN 监听器的端口 如果需要更改 SCAN 监听器的端口号,可以使用以下命令: ```bash srvctl modify scan_listener -p "TCP:1522" ``` 上述命令将 SCAN 监听器的端口号从默认值(通常是 1521)更改为 1522。 #### 注意事项 1. 在执行 `srvctl modify scan_listener` 命令之前,请确保已停止 SCAN SCAN 监听器服务。可以使用以下命令停止这些服务: ```bash srvctl stop scan_listener srvctl stop scan ``` 2. 修改完成后,需要重新启动 SCAN SCAN 监听器以使更改生效: ```bash srvctl start scan srvctl start scan_listener ``` 3. 验证 SCAN 监听器的状态是否正常: ```bash srvctl status scan_listener ``` #### 更新 /etc/hosts 文件 如果新增了 SCAN IP 地址,还需要更新 `/etc/hosts` 文件以包含新的 SCAN 名称 IP 映射。例如: ```plaintext 192.168.20.234 ht01-scan 192.168.20.235 ht01-scan 192.168.20.236 ht01-scan ``` 此操作通常需要以 `root` 用户身份完成[^2]。 #### 修改 REMOTE_LISTENER 参数 在某些情况下,可能还需要更新数据库实例中的 `REMOTE_LISTENER` 参数以指向新的 SCAN 名称端口。可以使用以下 SQL 命令完成此操作: ```sql ALTER SYSTEM SET remote_listener='ht01-scan:1521' SCOPE=BOTH SID='*'; ``` 此命令确保所有数据库实例都能正确识别新的 SCAN 监听器配置[^3]。 ### 总结 通过 `srvctl modify scan_listener` 命令可以方便地更新 Oracle RAC 中的 SCAN 监听器配置。操作过程中需要注意服务的启停顺序,并确保相关文件(如 `/etc/hosts`)数据库参数(如 `REMOTE_LISTENER`)同步更新。
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值