[oracle@rac1 ~]$ srvctl config nodeapps -n rac1 -a
VIP exists.: /rac1-vip.localdomain/10.182.15.101/255.255.255.0/eth0
[oracle@rac1 ~]$ srvctl config nodeapps -n rac2 -a
VIP exists.: /rac2-vip.localdomain/10.182.15.102/255.255.255.0/eth0
[oracle@rac1 ~]$ srvctl stop database -d rac
srvctl stop instance -d rac -i rac1
[oracle@rac1 ~]$ srvctl stop asm -n rac1
[oracle@rac1 ~]$ srvctl stop asm -n rac2
[oracle@rac1 ~]$ srvctl stop nodeapps -n rac1
[oracle@rac1 ~]$ srvctl stop nodeapps -n rac2
[root@rac2 ~]# cat /etc/hosts
# Do not remove the following line, or various programs
# that require network functionality will fail.
127.0.0.1 localhost.localdomain localhost
10.182.15.77 rac1.localdomain rac1
10.182.15.99 rac2.localdomain rac2
10.182.15.78 rac1-priv.localdomain rac1-priv
10.182.15.76 rac2-priv.localdomain rac2-priv
10.182.15.91 rac1-vip.localdomain rac1-vip
10.182.15.92 rac2-vip.localdomain rac2-vip
[root@rac1 bin]# ./srvctl modify nodeapps -n rac1 -A 10.182.15.91/255.255.255.0/eth0
[root@rac1 bin]# ./srvctl modify nodeapps -n rac2 -A 10.182.15.92/255.255.255.0/eth0
[oracle@rac1 bin]$ srvctl start asm -n rac1
[oracle@rac1 bin]$ srvctl start asm -n rac2
[oracle@rac1 admin]$ srvctl start nodeapps -n rac1
[oracle@rac1 admin]$ srvctl start nodeapps -n rac2
[oracle@rac1 bin]$ srvctl start instance -d rac -i rac1
[oracle@rac1 bin]$ srvctl start instance -d rac -i rac2
SQL> alter system set local_listener='(ADDRESS=(PROTOCOL=TCP)(HOST=10.182.15.91)(PORT=1521))';
SQL> alter system set local_listener='(ADDRESS = (PROTOCOL = TCP)(HOST=10.182.15.92)(PORT=1521))';
How to change VIP and VIP/Hostname in a 10g RAC/CRS environment.
To illustrate the changing of a Virtual IP Address (VIP) in an Oracle10g RAC/CRS environment.
Oracle 10g use VIP (Virtual IP) for clients to connect to the database. VIP solves all time-outs entering the TCP/IP stack resulting higher application availability. This VIP is a static IP with a hostname defined and resolved thru DNS. During the installation of CRS users where prompted to enter a Virtual IP and Virtual Hostname for each of the node in the cluster. These are stored in
OCR and different components within 10g HA framework depends on these VIPs. If for reason customer wants to change either the VIP or the VIP/Hostname use the following procedure.
Changing the VIP involves modification of the nodeapps, which includes the Virtual IP address, the GSD, the Listener, and Oracle Notification Services (ONS). The VIP can be modified while the nodeapps are running, however changes will not take effect until the VIP, and hence the nodeapps, are restarted. Other resources on a node, such as database instances and ASM instances, are dependent on the VIP, so stopping the nodeapps will only take the VIP offline if these other resources are stopped.
How to change the VIP address only. This example assumes that the host name associated with the VIP will not change - just the IP address itself.
1. Stop all resources that are dependent on the VIP on a given node. This includes all RAC database instances on that node, as well as the ASM instance on that node, if it exists and is being used:
1a). Stop database instances:
$ srvctl stop instance -d grid -i grid1
Where the database name is specified via the '-d' option, and the instance on the appropriate node is specified with the '-i' option.
Alternatively, to stop the entire database, on all nodes, you can issue
the stop database command:
$ srvctl stop database -d grid
1b). To stop the ASM instance on the node, issue the following command:
$ srvctl stop asm -n rmsclnxclu1
Note: It is not necessary to use srvctl to stop the database and ASM instance these resources can be stopped via SQL*Plus and/or, on the Windows platform. by stopping the associated services.
2. Confirm the current IP address for the VIP by running the command 'ifconfig -a' This should show you the current VIP, bound to one of the network interfaces. In the example below, it shows as 'eth0:1'
eth0:1 Link encap:Ethernet HWaddr 00:01:03:2C:69:BB
inet addr:192.168.1.125 Bcast:192.168.1.255 Mask:255.255.255.0
UP BROADCAST RUNNING MULTICAST MTU:1500 Metric:1
Note: On the Windows platform, run the command 'ipconfig /all'. This will list all IP addresses bound to a given adapter, including the VIP.
3. Stop the nodeapps using srvctl commands:
$ srvctl stop nodeapps -n rmsclnxclu1
Note: This will stop the VIP, GSD, Listener, and ONS daemon currently running on the nodes specified
4. Verify that the VIP is no longer running by executing the 'ifconfig -a' command again, and confirm that the interface (in our example it was 'eth0:1' is no longer listed in the output. (Again, on Windows, run the command 'ipconfig /all')
If the interface still shows as online, this is an indication that a resource which is dependent on the VIP is still running. The crs_stat command can help to show resources that are still online.
5. Make any changes necessary to all nodes' /etc/hosts files (on Unix), or the \WINNT\System32\drivers\etc\hosts file (on Windows) and/or make the necessary DNS changes, to associate the new IP address with the old host name.
6. Modify the nodeapps and provide the new virtual IP address. Use the srvctl modify nodeapps command with the following syntax:
srvctl modify nodeapps -n [-o ] [-A ]
-n Node name.
-o Oracle home for the cluster database.
-A The node level VIP address (/netmask[/if1[|if2|...]]).
An example of the 'modify nodeapps' command is as follows:
$ srvctl modify nodeapps -n rmsclnxclu1 -A 192.168.2.125/255.255.255.0/eth0
Note: This command should be run as root. Attempting to run this command
as the 'oracle' user or software owner will result in the following error:
PRKO-2117 : This command should be executed as the system privilege user.
7. Start node-level applications.
Use the srvctl start nodeapps command with the following syntax:
srvctl start nodeapps -n
$ srvctl start nodeapps -n rmsclnxclu1
Repeat the same steps for all the nodes in the cluster.
Since SRVCTL is a cluster wide management tool, you can accomplish these tasks for
any specific nodes from one node, without the need to login to each of the cluster nodes.
Note: If only the IP address is changed, it is not necessary to make changes to the LISTENER.ORA and TNSNAMES.ORA, provided they are using the vip hostnames for
the 'HOST=' entries.
If changing both the hostname and the VIP for a node, it will be necessary to modify the LISTENER.ORA and change the 'HOST=' entries to the new VIP hostname. This can be dopne manually, or by using the NETCA to remove the old listener and create a new listener. In addition, changes will need to be made to the TNSNAMES.ORA of any clients connecting to the old HOSTNAME.
来自 “ ITPUB博客 ” ，链接：http://blog.itpub.net/7419833/viewspace-592088/，如需转载，请注明出处，否则将追究法律责任。