Pages

17 March 2011

BC State management (Activation/Passsivation) best practises

For introductory notes regarding Application Module Pooling and State Management check here.

Supplying another database connection/schema for "state management": 
 Since it is often not desirable the main schema user to have the roles mentioned before (should not have the specific priveledges), Oracle recommends always supplying another database connection/schema for "state management". This means that we should have another database connection/schema to save PS_TXN table and PS_TXN_SEQ sequence. Define this user with jbo.server.internal_connection property in app module. Valid values for the jbo.server.internal_connection property in your configuration are:
  • A fully-qualified JDBC connection URL like:
    jdbc:oracle:thin:username/password@host:port:SID
  • A JDBC datasource name like:
    java:/comp/env/jdbc/YourJavaEEDataSourceName


Cleaning Up Temporary Storage Tables
JDeveloper supplies the bc4jcleanup.sql script in the /BC4J/bin directory to help with periodically cleaning up the application module state management table. Persistent snapshot records can accumulate over time if the server has been shutdown in an abnormal way, such as might occur during development or due to a server failure. Running the script in SQL*Plus will create the BC4J_CLEANUP PL/SQL package. The two relevant procedures in this package are:
  • PROCEDURE Session_State(olderThan DATE)     This procedure cleans-up application module session state storage for sessions older than a given date.
  • PROCEDURE Session_State(olderThan_minutes INTEGER)      This procedures cleans-up application module session state storage for sessions older than a given number of minutes.
You can schedule periodic cleanup of your ADF temporary persistence storage by submitting an invocation of the appropriate procedure in this package as a database job.

You can use an anonymous PL/SQL block like the one shown in Example 40-5 to schedule the execution of bc4j_cleanup.session_state() to run starting tomorrow at 2:00am and each day thereafter to cleanup sessions whose state is over 1 day (1440 minutes) old.
Example:  Scheduling Periodic Cleanup of the State Management Table




Dig more:

No comments:

Post a Comment