Oracle RAC
Full name: Oracle Real Application Clusters, that is, Oracle Real-Time ApplicationProgramCluster, so that different applications can access multiple Oracle instances as if accessing one Oracle instance (of course, the performance is horizontally Scalable), and nodes communicate through private network; all operations are recorded through log files and stored on shared devices. They can be read, written, and synchronized by all cluster nodes at the same time.
Before Oracle9i, RAC is named OPS (Oracle Parallel Server ). A large area between RAC and OPS is that RAC uses the cache fusion technology. In Ops, data requests between nodes need to write data to the disk before the requested node can read the data. When cache fusion is used, the data buffer of each node of RAC transmits data blocks through a high-speed, low-latency private network.
Main features of RAC
- Multi-node load balance.
- High Availability: supports failover & switchover to minimize the impact of exceptions. Failover-operations automatically performed by the system when an exception occurs; switchover switches manually.
- Supports horizontal expansion of primary & standby to improve the reliability of online transaction.
- It can save the software development cost of horizontal scaling and has no limited requirements on devices and quantity.
- Use cache fusion (high-speed cache merge) technology.
Java example of connecting a RAC to a database
Public static void main (string Arg []) {try {class. forname ("oracle. JDBC. driver. oracledriver "); string url =" JDBC: oracle: thin: @ (description = (address = (Protocol = TCP) (host = host1) (Port = 1521 )) (address = (Protocol = TCP) (host = host2) (Port = 1521) (load_balance = yes) (Failover = on) (CONNECT_DATA = (Server = dedicated) (SERVICE_NAME = dB. domain) (failover_mode = (type = select) (method = Basic) (retires = 20) (delay = 15) "; connection c = drivermanager. getconnection (URL, "Demo", "Demo"); Statement S = C. createstatement (); resultset r = s.exe cutequery ("select current_date from dual"); While (R. next () {system. out. println (R. getstring (1) ;}} catch (exception e) {system. out. println (E. tostring ());}}
Common RAC configurations
- listener. ora-each RAC server on the network must contain a listener. ora file, which lists the names, addresses, and supported instances of all listening processes in the cluster. The listening process receives connections from the Oracle RAC network client. Parameter description:
- listener: Listener name. Multiple listeners can be configured. Multiple listeners must be separated by port numbers.
- global_dbname: Global Database Name. It is obtained through the select * From global_name; query.
- ORACLE_HOME: root directory of Oracle software.
- sid_name: Sid of the server (Local Machine.
- Protocol: Listener protocol. TCP is generally used.
- HOST: the IP address of the local machine.
- port: the listening port number. Use netstat -- An to check whether the port is occupied.
- tnsnames. ora
- localname: name of the local server machine.
- address: the address of the server.
- Protocol: the protocol used. TCP is generally used.
- port: the listening port number of the server.
- SERVICE_NAME: name of the Database Service on the server.