Oracle RAC全称是Oracle real Application Cluster。
RAC是一个软件可以使你通过运行多个依赖相同Database的Instances,使用Cluster硬件,数据库文件被存放在物理或是逻辑上连接每个节点的磁盘上。以便于每个活动的Instance都可以对files进行读写操作。
jdbc连接oracle的连接串如下:
1.String url="jdbc:oracle:thin:@(DESCRIPTION =
2.(ADDRESS = (PROTOCOL = TCP)(HOST = host2)(PORT = 1521))
3.(ADDRESS = (PROTOCOL = TCP)(HOST = host1)(PORT = 1521))
4.(LOAD_BALANCE = yes)(FAILOVER = ON)
5.(CONNECT_DATA =(SERVER = DEDICATED)
6.(SERVICE_NAME = db.domain)
7.(FAILOVER_MODE=(TYPE = SELECT)(METHOD = BASIC)(RETIRES = 20)(DELAY = 15))))";
假设有以下Oracle RAC配置
2. Sid = slrac
3.SLRAC =
4.
5. (DESCRIPTION =
6. (ADDRESS_LIST =
7. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.231)(PORT = 1521))
8. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.230)(PORT = 1521))
9. (LOAD_BALANCE = yes)
10. )
11.
12. (CONNECT_DATA =
13. (SERVER = DEDICATED)
14. (SERVICE_NAME = slrac.beta.com)
15. (FAILOVER_MODE =
16. (TYPE = SELECT)
17. (METHOD = BASIC)
18. )
19. )
20. )
21.
22. SLRAC2 =
23. (DESCRIPTION =
24. (ADDRESS_LIST =
25. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.230)(PORT = 1521))
26. )
27. (CONNECT_DATA =
28. (SERVICE_NAME = slrac.beta.com)
29. (INSTANCE_NAME = slrac2)
30. )
31. ) SLRAC1 =
32. (DESCRIPTION =
33. (ADDRESS_LIST =
34. (ADDRESS = (PROTOCOL = TCP)(HOST = 192.168.1.231)(PORT = 1521))
35. )
36. (CONNECT_DATA =
37. (SERVICE_NAME = slrac.beta.com)
38. (INSTANCE_NAME = slrac1)
39. )
40. )
则JDBC URL的配置如下:
jdbc:oracle:thin:@(description=(address_list= (address=(host=192.168.1.231) (protocol=tcp)(port=1521))(address=(host=192.168.1.230)(protocol=tcp) (port=1521)) (load_balance=yes)(failover=yes))(connect_data=(service_name= slrac.beta.com)))
最后欢迎大家访问我的个人网站:1024s