After establishing RAC on a virtual machine a few days ago, I tried to test the two functions of Oracle TAF (transparent application failover) and Server Load balancer.
1. Server Load balancer
First, edit the tnsnames. ora file on the server and add LOAD_BALANCE = yes to the orcl service. The content is as follows:
Then, download the file to the local instantclient installation path and open multiple sessions through sqlplus. It is found that these sessions are randomly allocated to different instances. For details, see:
2. transparent application failover
Run DBCA to enter Service Manager, configure the Failover Service orcltest, and select the two instances as the "preferred instance" (orcl1 is the "preferred instance" and orcl2 is the "available instance ", can also achieve this purpose), TAF policy select "Basic", see:
View the tnsnames. ora file and find that the orcltest service is missing, add the FAILOVER_MODE parameter, edit the local tnsnames. ora file, and add the orcltest service. The content is the same as that of the server. See:
Open two sessions on the client to connect to different nodes at the same time. After the RAC1 database is closed, the session connected to this node has been transferred to RAC2.