10 Practice 10 Using Application Continuity
10 Practice 10 Using Application Continuity
Practice 10
Practice Overview
In this practice, you will demonstrate how Application Continuity can be used in an application to
recover from a RAC instance outage.
Practice Assumptions
• The practice assumes that you have the Oracle RAC database up and running in the virtual
machines srv1 and srv2.
• You downloaded the filed "ac_demo.zip" from the downloadable resources of this lecture. This
compressed file has a simple Java program that connects to an Oracle database using the known
database user scott.
Scott user is installed automatically in Oracle databases when you install the Examples schemas
in it.
1. Using Winscp, login to srv1 as oracle and copy the compressed file ac_demo.zip to the directory
/home/oracle/scripts
2. Open a Putty session connected to srv1 as oracle. This Putty session window will be referred to in
this practice as the client window.
3. Unzip the compressed file then change the current directory to the decompressed directory
4. In the extracted directory, you will see two scripts: runnoreplay and runreplay. They both
execute the same application (actest.jar). The only difference between them is that each script
references a different properties file.
/home/oracle/scripts/
unzip ac_demo.zip
cd ac_demo
ls -al
cat runnoreplay
cat runreplay
5. Examine the properties files. Observe that the only difference between the two properties files is
the data source specification. The NoReplay file uses the standard 12.1 data source
(OracleDataSource) and the Replay file uses the replay data source (OracleDataSourceImpl).
In other words, the first file does not take advantage of the application continuity. The second has
the application continuity enabled.
cat actest_noreplay.properties
cat actest_replay.properties
7. Create and start a database service for use in conjunction with application continuity.
srvctl add service -db rac -service acsrv -preferred rac1 -available rac2 -
failovertype TRANSACTION -commit_outcome TRUE -failoverretry 30 -failoverdelay 10
-retention 86400 -replay_init_time 1800 -notification TRUE
sqlplus system/oracle@rac
alter user scott identified by tiger account unlock;
# test:
conn scott/tiger@//srv1:1521/acsrv.localdomain
9. Open another Putty session connected to srv1 and connect to it as oracle. This window will be
referred to in this practice as admin window.
10. Configure the prompt in the admin window as follows. This helps you to distinguish between the
admin and client Putty session windows.
export PS1='[ADMIN $]'
12. In the admin window, verify that the sessions created by the application are connected to rac1.
pkill -9 -f ora_pmon_rac1
15. In the client window, press [Ctrl] + [C] to abort the application.
16. In the admin window, verify that the crashed instance is up again.
srvctl status database -d rac
18. In the client window, run the script where application continuity is enabled (runreplay).
The application executes exactly the same way as the application that has the application
continuity disabled.
./runreplay
19. In the admin window, verify that the sessions created by the application are connected to rac2.
20. In the admin window, connect to srv2 and crash rac2 instance.
ssh srv2
pkill -9 -f ora_pmon_rac2
22. In the admin window, exit from the session connected to srv2.
exit
23. Verify that the sessions created by the application have migrated to rac1.
Summary
Application Continuity enhances the application availability response when a database instance in
a RAC database crashes.