Differences
This shows you the differences between two versions of the page.
Both sides previous revision Previous revision Next revision | Previous revision | ||
oracle_rac_application_continuity [2020/10/22 12:03] – andonovj | oracle_rac_application_continuity [2020/10/22 12:13] (current) – andonovj | ||
---|---|---|---|
Line 10: | Line 10: | ||
- | ====Service Creation==== | + | ======Service Creation====== |
< | < | ||
[oracle@enode01 labs]$ srvctl add service -db eastdb \ | [oracle@enode01 labs]$ srvctl add service -db eastdb \ | ||
Line 26: | Line 26: | ||
-notification TRUE | -notification TRUE | ||
</ | </ | ||
- | ====Status & Startup==== | ||
+ | =====Status & Startup===== | ||
+ | We can check the configuration of the service as follows. Remember to put the database name. | ||
< | < | ||
Line 69: | Line 70: | ||
Now that we have the service, let's run the simple application. The application itself is one, but we will run it with different connection settings: | Now that we have the service, let's run the simple application. The application itself is one, but we will run it with different connection settings: | ||
- | ====Application | + | =====Application |
- | The application should be changed also be using the UPC = Universal Connection Pooling | + | |
Below you can see the source which I have used: | Below you can see the source which I have used: | ||
< | < | ||
- | |||
package act; | package act; | ||
- | |||
import java.sql.Connection; | import java.sql.Connection; | ||
import java.sql.SQLException; | import java.sql.SQLException; | ||
Line 177: | Line 174: | ||
Now that we have the code, we can run it one in a two ways: | Now that we have the code, we can run it one in a two ways: | ||
- | ====Noreplay Mode==== | + | =====Noreplay Mode===== |
We can run that application standard without any application continuity as follows: | We can run that application standard without any application continuity as follows: | ||
Line 241: | Line 238: | ||
</ | </ | ||
- | < | + | =====Replay Mode===== |
- | C: | + | In order to make the application aware of the feature, we have to start it with the Universal Connection pooling using the replay option. To do that, we can use THE SAME application but with different |
- | | + | |
- | ng2 | + | |
- | connection factory set | + | |
- | Using URL | + | |
- | jdbc: | + | |
- | FAILOVER=ON) (ADDRESS | + | |
- | 21)) (CONNECT_DATA | + | |
- | pool configured, trying | + | |
- | C:\Users\Julien> | + | <Code:bash|Connection Properties> |
- | </sxh> | + | [oracle@enode01 labs]$ cat actest_replay.properties |
+ | username=scott | ||
+ | password=tiger | ||
+ | autoCommit=false | ||
+ | # Use new 12.1 replay datasource | ||
+ | datasource=oracle.jdbc.replay.OracleDataSourceImpl | ||
+ | url=jdbc: | ||
+ | cluster01- | ||
+ | scan)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=actest. | ||
+ | example.com))) | ||
+ | # UCP setting: | ||
+ | ucp_pool_size=2 | ||
+ | ucp_validate_connection_on_borrow=true | ||
+ | ucp_connection_wait_timeout=60 | ||
+ | # Think Time taken to process the results from the database. | ||
+ | Time in milliseconds. | ||
+ | # -1 means no sleep. | ||
+ | thread_think_time=20 | ||
+ | # Number of concurrent threads running in the application | ||
+ | # UCP is tuned to have MAX and MIN limit set to this | ||
+ | number_of_threads=6 | ||
+ | verbose=true | ||
+ | </ | ||
+ | |||
+ | The properties are 99.9% the same, with the only difference of the: " | ||
+ | |||
+ | < | ||
+ | [oracle@enode01 labs]$ diff actest_noreplay.properties | ||
+ | actest_replay.properties | ||
+ | 5,6c5,6 | ||
+ | < # Use standard 12.1 datasource no replay | ||
+ | < datasource=oracle.jdbc.pool.OracleDataSource | ||
+ | --- | ||
+ | > # Use new 12.1 replay datasource | ||
+ | > datasource=oracle.jdbc.replay.OracleDataSourceImpl | ||
+ | </ | ||
+ | |||
+ | That way, the application will be able to reconnect after interrupted connection: | ||
+ | |||
+ | < | ||
+ | [oracle@enode01 labs]$ ./ | ||
+ | ###################################################### | ||
+ | Connecting to | ||
+ | jdbc: | ||
+ | ter01- | ||
+ | scan)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=actest. | ||
+ | example.com))) | ||
+ | # of Threads : 6 | ||
+ | UCP pool size : 2 | ||
+ | Thread think time : 20 ms | ||
+ | ###################################################### | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | ... (Interupted connection) | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | 2 active connections, | ||
+ | [oracle@enode01 labs]$ | ||
+ | |||
+ | </Code> |