ni.com
2ni.com
About National Instruments
Founded: 1976
Corporate Headquarters: Austin, Texas
Industry: Test and Measurement
Our Mission:
We equip engineers and scientists with systems that
accelerate productivity, innovation, and discovery.
Revenue: $1.24 billion in 2014
Global Operations: Approximately 7,100 employees;
operations in almost 50 countries
IT Development Centers:
• Austin, Texas
• Debrecen, Hungary
• Penang, Malaysia
• San José, Costa Rica
• Shanghai, China
3ni.com
About Sean Braymen
Title: Senior Oracle Database Administrator
Education: Kansas State University
Work History:
• National Instruments for 14 Years
• Prior to becoming a DBA:
Manufacturing IT; eCommerce Advisors
• 4 Years as a DBA
Family: Wife and 5 Year Old Daughter
Hobbies: Distance Running; Travel
ni.com
Application Continuity
5ni.com
What is Application Continuity
• Application Continuity is a feature that attempts to mask
database session outages by recovering the in-flight work
for request submitted to the database.
• Application Continuity attempts to replay the transactional
and nontransactional work that makes up a database
request. When replay is successful, the outage appears
to the end user as if the execution was slightly delayed.
6ni.com
Key Concepts for Application Continuity
• Database Request: Unit of work submitted from the
application, typically SQL, PL/SQL, RPC calls
• Recoverable Error: Error that arises due to an external
system failure, independent of the application
• Commit Outcome: Outcome of the last transaction
• Mutable Functions: Functions that change their results
each time they are executed
• Session State Consistency: Describes how the
application changes the nontransactional state during a
database request
7ni.com
What is Transaction Guard?
Transaction Guard is:
• A tool that provides a reliable commit outcome for the last
transaction after errors
• An API available for JDBC Thin, C/C++ (OCI/OCCI), and
ODP.NET
• Used by Application Continuity for at-most-once execution
• Can be used independently of Application Continuity
Without Transaction Guard, retry can cause logical
corruption
8ni.com
How Transaction Guard Works
*LTXID: Logical Transaction ID
9ni.com
Transaction in Action: WithoutApplication Continuity
1. Work Request
2. DB Calls
3. DB Error / Shutdown
4. Application
Errors
10ni.com
What Did the End User See?
• Application received an “ORA-03113: end-of-file
communication channel”
• Application error handling can vary
• Blank screen; generic error page; cryptic error message; etc
• Developing a solution inside the application is difficult and
expensive
• Database outages can cause:
• In-flight work to be lost, leaving users in doubt
• Users to restart applications and re-entering data, leading to
duplication of requests
• Additional failures that result in prolonged outages
11ni.com
Transaction in Action: WithApplication Continuity
1. Work Request
2. DB Calls
3. Error / Shutdown
4. Replay
5. Response
12ni.com
What Did the End User See?
• Application completed it work without any displayed
errors
• Application took slightly longer to accomplish the task
than normal
13ni.com
Processing Phases of Application Continuity
Normal Run Time Reconnect Replay
• Start the database
request
• Builds proxy objects
• Holds the original
calls with validation
• Manages queues
• Ensure that the
request has replay
enabled
• Handles timeouts
• Creates a new
connection
• Validates the target
database
• Uses Transaction
Guard to enforce last
commit
• Replays held calls
• Continues replay, if
user-visible results
match base on
validations
• Continues the request
• Throws the original
exception if replay is
unsuccessful
14ni.com
Requirements for Application Continuity
• Oracle Database 12c
• Oracle Database 12c for SQL*Plus Connections
• Oracle JDBC Driver 12.1.0.2 or later
• Oracle Universal Connection Pool (UCP)
o oracle.jdbc.replay.OracleDataSourceImpl – PooledConnection interface
o Supported by many including: IBM WebSphere, Apache Tomcat
and Red Hat JBoss
• WebLogic Server 12c
• Resource Needs
• Memory: The JDBC replay driver requires more memory because the calls
are retained until the end of the database request
• CPU: The JDBC replay driver uses additional CPU for building proxy
objects, managing queues and garbage collection
o Overhead may be reduced for database platforms with current SPARC chips
15ni.com
ConfiguringApplication Continuity
16ni.com
WebLogic Server 12c
17ni.com
Configuration for Non-WebLogic
• Configure the datasource in the properties file or provider
• replay datasource=oracle.jdbc.replay.OracleDataSourceImpl
• Configure the Datasource Definition
• disableWASConnectionPooling = true
connectionCachingEnabled=true
connectionCacheName=<your_cache_name>
removeExistingOracleConnectionPoolIfExists = true
URL =<JDBC Connect String>
18ni.com
Configuring Database Services forApplication Continuity
Example:
srvctl add service –d <database_name –s <service_name>
-failovertype TRANSACTION
-commit_outcome TRUE
-failoverretry #
-failoverdelay #
-retention_timeout #
-replay_initation_timeout #
Mandatory Settings
Optional Settings
19ni.com
UsingApplication Continuity
• Supported Operations
• SQL, PL/SQL, and JDBC RPC
o SELECT
o ALTER SESSION
o DML
o DDL
o SAVEPOINT / ROLLBACK
• Transaction Models
o Local, Parallel, Remote, Distributed and Embedded PL/SQL
• Mutable Functions
• Required Transaction Guard
• Works with Active Data Guard
20ni.com
Mutable Objects and Application Continuity
• SYSDATE / SYSTIMESTAMP
• GRANT KEEP DATE TIME TO <user>;
• SEQUENCES
• GRANT KEEP SEQUENCES ON <sequence_name> TO <user>
• CREATE SEQUENCE <sequence_name> KEEP;
• ALTER SEQUENCE <sequence_name> KEEP;
21ni.com
Restrictions for Application Continuity
• Unsupported Operations
• Default Database Services
• JDBC Concrete Classes
o Old Java classes: oracle.sql.*
o New interfaces: oracle.jdbc.*
• XA Transactions
• 3rd Party Statement Cache
• Replay is not supported for Active Data Guard with read/write
database links
22ni.com
Restrictions for Application Continuity
• Transaction Types with Risks
• UTL_FILE Operations
• Email or notifications using DBMS_ALERT, UTL_MAIL,
UTL_SMTP
• Web Service calls (UTL_HTTP)
• Autonomous Transactions
• Transactions over database link
23ni.com
Administration
• Stopping a session without replay
• alter system kill session ‘sid, serial#, @inst’ noreplay;
• alter system disconnect session ‘sid, serial#, @inst’ noreplay;
• Stopping a service
• srvctl stop service –d <database_name> -s <service_name> -noreplay
• Stopping an instance
• srvctl stop instance –d <database_name> -i <instance> -noreplay
ni.com
Demo
ni.com

Application Continuity

  • 1.
  • 2.
    2ni.com About National Instruments Founded:1976 Corporate Headquarters: Austin, Texas Industry: Test and Measurement Our Mission: We equip engineers and scientists with systems that accelerate productivity, innovation, and discovery. Revenue: $1.24 billion in 2014 Global Operations: Approximately 7,100 employees; operations in almost 50 countries IT Development Centers: • Austin, Texas • Debrecen, Hungary • Penang, Malaysia • San José, Costa Rica • Shanghai, China
  • 3.
    3ni.com About Sean Braymen Title:Senior Oracle Database Administrator Education: Kansas State University Work History: • National Instruments for 14 Years • Prior to becoming a DBA: Manufacturing IT; eCommerce Advisors • 4 Years as a DBA Family: Wife and 5 Year Old Daughter Hobbies: Distance Running; Travel
  • 4.
  • 5.
    5ni.com What is ApplicationContinuity • Application Continuity is a feature that attempts to mask database session outages by recovering the in-flight work for request submitted to the database. • Application Continuity attempts to replay the transactional and nontransactional work that makes up a database request. When replay is successful, the outage appears to the end user as if the execution was slightly delayed.
  • 6.
    6ni.com Key Concepts forApplication Continuity • Database Request: Unit of work submitted from the application, typically SQL, PL/SQL, RPC calls • Recoverable Error: Error that arises due to an external system failure, independent of the application • Commit Outcome: Outcome of the last transaction • Mutable Functions: Functions that change their results each time they are executed • Session State Consistency: Describes how the application changes the nontransactional state during a database request
  • 7.
    7ni.com What is TransactionGuard? Transaction Guard is: • A tool that provides a reliable commit outcome for the last transaction after errors • An API available for JDBC Thin, C/C++ (OCI/OCCI), and ODP.NET • Used by Application Continuity for at-most-once execution • Can be used independently of Application Continuity Without Transaction Guard, retry can cause logical corruption
  • 8.
    8ni.com How Transaction GuardWorks *LTXID: Logical Transaction ID
  • 9.
    9ni.com Transaction in Action:WithoutApplication Continuity 1. Work Request 2. DB Calls 3. DB Error / Shutdown 4. Application Errors
  • 10.
    10ni.com What Did theEnd User See? • Application received an “ORA-03113: end-of-file communication channel” • Application error handling can vary • Blank screen; generic error page; cryptic error message; etc • Developing a solution inside the application is difficult and expensive • Database outages can cause: • In-flight work to be lost, leaving users in doubt • Users to restart applications and re-entering data, leading to duplication of requests • Additional failures that result in prolonged outages
  • 11.
    11ni.com Transaction in Action:WithApplication Continuity 1. Work Request 2. DB Calls 3. Error / Shutdown 4. Replay 5. Response
  • 12.
    12ni.com What Did theEnd User See? • Application completed it work without any displayed errors • Application took slightly longer to accomplish the task than normal
  • 13.
    13ni.com Processing Phases ofApplication Continuity Normal Run Time Reconnect Replay • Start the database request • Builds proxy objects • Holds the original calls with validation • Manages queues • Ensure that the request has replay enabled • Handles timeouts • Creates a new connection • Validates the target database • Uses Transaction Guard to enforce last commit • Replays held calls • Continues replay, if user-visible results match base on validations • Continues the request • Throws the original exception if replay is unsuccessful
  • 14.
    14ni.com Requirements for ApplicationContinuity • Oracle Database 12c • Oracle Database 12c for SQL*Plus Connections • Oracle JDBC Driver 12.1.0.2 or later • Oracle Universal Connection Pool (UCP) o oracle.jdbc.replay.OracleDataSourceImpl – PooledConnection interface o Supported by many including: IBM WebSphere, Apache Tomcat and Red Hat JBoss • WebLogic Server 12c • Resource Needs • Memory: The JDBC replay driver requires more memory because the calls are retained until the end of the database request • CPU: The JDBC replay driver uses additional CPU for building proxy objects, managing queues and garbage collection o Overhead may be reduced for database platforms with current SPARC chips
  • 15.
  • 16.
  • 17.
    17ni.com Configuration for Non-WebLogic •Configure the datasource in the properties file or provider • replay datasource=oracle.jdbc.replay.OracleDataSourceImpl • Configure the Datasource Definition • disableWASConnectionPooling = true connectionCachingEnabled=true connectionCacheName=<your_cache_name> removeExistingOracleConnectionPoolIfExists = true URL =<JDBC Connect String>
  • 18.
    18ni.com Configuring Database ServicesforApplication Continuity Example: srvctl add service –d <database_name –s <service_name> -failovertype TRANSACTION -commit_outcome TRUE -failoverretry # -failoverdelay # -retention_timeout # -replay_initation_timeout # Mandatory Settings Optional Settings
  • 19.
    19ni.com UsingApplication Continuity • SupportedOperations • SQL, PL/SQL, and JDBC RPC o SELECT o ALTER SESSION o DML o DDL o SAVEPOINT / ROLLBACK • Transaction Models o Local, Parallel, Remote, Distributed and Embedded PL/SQL • Mutable Functions • Required Transaction Guard • Works with Active Data Guard
  • 20.
    20ni.com Mutable Objects andApplication Continuity • SYSDATE / SYSTIMESTAMP • GRANT KEEP DATE TIME TO <user>; • SEQUENCES • GRANT KEEP SEQUENCES ON <sequence_name> TO <user> • CREATE SEQUENCE <sequence_name> KEEP; • ALTER SEQUENCE <sequence_name> KEEP;
  • 21.
    21ni.com Restrictions for ApplicationContinuity • Unsupported Operations • Default Database Services • JDBC Concrete Classes o Old Java classes: oracle.sql.* o New interfaces: oracle.jdbc.* • XA Transactions • 3rd Party Statement Cache • Replay is not supported for Active Data Guard with read/write database links
  • 22.
    22ni.com Restrictions for ApplicationContinuity • Transaction Types with Risks • UTL_FILE Operations • Email or notifications using DBMS_ALERT, UTL_MAIL, UTL_SMTP • Web Service calls (UTL_HTTP) • Autonomous Transactions • Transactions over database link
  • 23.
    23ni.com Administration • Stopping asession without replay • alter system kill session ‘sid, serial#, @inst’ noreplay; • alter system disconnect session ‘sid, serial#, @inst’ noreplay; • Stopping a service • srvctl stop service –d <database_name> -s <service_name> -noreplay • Stopping an instance • srvctl stop instance –d <database_name> -i <instance> -noreplay
  • 24.
  • 25.