在使用oracle的过程中,难免会遇到需要修改VIP的情况,下面就是oracle官方文档给出的步骤,大家在修改的过程中还是需要按照官方文档来实施:
来自:http://docs.oracle.com/cd/E11882_01/rac.112/e16794/admin.htm#BGBGDHFG
---------Changing the Virtual IP Addresses
Perform the following steps to change a VIP address:
通过以下步骤修改VIP:
-
Stop all services running on the node whose VIP address you want to change using the following command syntax, where
database_name
is the name of the database,service_name_list
is a list of the services you want to stop, andmy_node
is the name of the node whose VIP address you want to change:停止服务
srvctl stop service -d database_name -s service_name_list -n my_node
This example specifies the database name (
grid
) using the-d
option and specifies the services (sales,oltp
) on the appropriate node (mynode
).$ srvctl stop service -d grid -s sales,oltp -n mynode
-
Confirm the current IP address for the VIP address by running the
srvctl config vip
command. This command displays the current VIP address bound to one of the network interfaces. The following example displays the configured VIP address:检查当前的VIP设置
$ srvctl config vip -n stbdp03 VIP exists.:stbdp03 VIP exists.: /stbdp03-vip/192.168.2.20/255.255.255.0/eth0
-
Stop the VIP resource using the
srvctl stop vip
command:停止VIP
$ srvctl stop vip -n mynode
-
Verify that the VIP resource is no longer running by running the
ifconfig -a
command on Linux and UNIX systems (or issue theipconfig /all
command on Windows systems), and confirm that the interface (in the example it waseth0:1
) is no longer listed in the output.确认VIP已经停止
-
Make any changes necessary to the
/etc/hosts
files on all nodes on Linux and UNIX systems, or the%windir%\system32\drivers\etc\hosts
file on Windows systems, and make any necessary DNS changes to associate the new IP address with the old host name.根据需要修改,以确认新IP和计算机名可以正确解析
-
To use a different subnet or NIC for the default network before you change any VIP resource, you must use the
srvctl modify network -S
subnet
/
netmask
/
interface
command asroot
to change the network resource, wheresubnet
is the new subnet address,netmask
is the new netmask, andinterface
is the new interface. After you change the subnet, then you must change each node's VIP to an IP address on the new subnet, as described in the next step.使用其他的网卡或者子网作为默认网络
-
Modify the node applications and provide the new VIP address using the following
srvctl modify nodeapps
syntax:修改VIP
$ srvctl modify nodeapps -n node_name -A new_vip_address
The command includes the following flags and values:
-
-n
node_name
is the node name -
-A
new_vip_address
is the node-level VIP address:name
|ip
/
netmask
/
[
if1
[|
if2
|...]]
For example, issue the following command as the
root
user:srvctl modify nodeapps -n mynode -A 192.168.2.125/255.255.255.0/eth0
Attempting to issue this command as the installation owner account may result in an error. For example, if the installation owner is
oracle
, then you may see the errorPRCN-2018: Current user oracle is not a privileged user
.To avoid the error, run the command as theroot
or system administrator account.
-
-
Start the node VIP by running the
srvctl start vip
command:启动VIP
$ srvctl start vip -n node_name
The following command example starts the VIP on the node named
mynode
:$ srvctl start vip -n mynode
-
Repeat the steps for each node in the cluster.
为集群中的每个节点重复执行上面的步骤
Because the SRVCTL utility is a clusterwide management tool, you can accomplish these tasks for any specific node from any node in the cluster, without logging in to each of the cluster nodes.
-
Run the following command to verify node connectivity between all of the nodes for which your cluster is configured. This command discovers all of the network interfaces available on the cluster nodes and verifies the connectivity between all of the nodes by way of the discovered interfaces. This command also lists all of the interfaces available on the nodes which are suitable for use as VIP addresses.
检验节点间的连接
$ cluvfy comp nodecon -n all -verbose