Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects Supported Version: Oracle BAM 10.1.3 Objectives • To read DB tables data into ADC objects. • This is not recommended to get real time data into ADC. • This can be used only for periodic controlled refresh of data. Prerequisite: • Installed version of Oracle BAM. • Knowledge of Oracle BAM and Databases (schema, table, etc). • Start all databases and TNSListener. Verify DB Table definitions Start a sql window (to verify your tables in your external database) Example: sqlplus system/manager@iasdb Oracle BAM Plans Start DesignStudio (thick client to write plans). Define a BaseView & MetaView. TechNote_BAM_ReadingExternalTableintoADC.doc Page 1 of 1 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects Click on “create new baseview” icon. Give the database connection parameters for this definition (as below). “Host String” is the service name that is used to connect to Oracle database (in tnsnames.ora) Click on SnapBaseView, give it a name in the text box. Click on “autocreate metaview”, click on tables >>. This will read your database and bring in all the table definitions. Select ONLY the tables that are of interest to you. TechNote_BAM_ReadingExternalTableintoADC.doc Page 2 of 2 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects Click on OK. (this will bring in all the baseviews to your design studio) Click on the tools icon = (at the bottom left of the application). Create a small plan as shown below. (drag & drop a sql query & grid pallet on the plan window). Next click on the parts icon under the application left bottom window. TechNote_BAM_ReadingExternalTableintoADC.doc Page 3 of 3 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects This will show all the metaviews created. (you can right click on the column name and rename these names). Drag and drop the required columns on the sql query box. This will automatically create the SQL statement and also show the column names under the grid. Click on update button to test. (This will read the database tables and display the required values – as shown below). Click on “toolbar” icon below, to change the definition of your plan. Delete the grid icon, and drag and drop an insert box. Set the properties to “autocreate” the object and give the dataobject the required name. Click on update, let the BAM tool, read the database, and create a new dataobject and populate it with the full data. (do not save the plan yet) TechNote_BAM_ReadingExternalTableintoADC.doc Page 4 of 4 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects Verify in the Oracle BAM Architect console that the new dataobject is created with correct fields, and populated with correct data. Close the architect. In the DesignStudio thick client application, delete “insert” box from the plan, and drag & drop an update icon. (replace insert with update). Double click on the update icon, and set it properties as given below. Set the “ADC information”, and choose the required object from the list. TechNote_BAM_ReadingExternalTableintoADC.doc Page 5 of 5 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects Click on the “record selection” tab, and choose : OrdId (or the unique column selector required by your update operation). Click on the ‘update specification” tab, and choose “all” to populate the fields required. (Check the “insert record if not found” box), Click ok and close this dialog box. Note – you can choose the properties of this dialog box as per your requirement. Click on “Tools= Plan Properties – give this plan a name (example: myplan). Save this plan and close this window. Plan execution steps: Running the plan to continuously update the ADC dataobjects from the database tables. Option #1. Set the plan to run continuously. In this mode, the plan executes once, completes the above steps end to end, and stops. The plan monitor is set to restart after completion and to monitor the plan. Thus, rendering the plan to run- complete execution-stop, restartrerun- complete execution-stop, restart –rerun etc., and this cycles goes on endlessly without any delay between the consecutive starts. This may be CPU intensive, DB intensive (if intensive) and undesirable in some cases, not justifying the loads for the required DB synchronization needs. Open Oracle BAM administrator, select Plan Monitor from drop down list, and select – plan settings. Check the plan settings as below for your plan, and save the changes. Next, select “request plan settings check”, and complete the operation by clicking on continue button. This will initiate the plan monitor to execute, and monitor the plan for continuous run. Restart BAM Plan Monitoring Service in Windows Services. TechNote_BAM_ReadingExternalTableintoADC.doc Page 6 of 6 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects Observe that the ADC object is updated with latest data from the external database tables (if there are any changes). Option #2 This is more a controlled execution of the plan at a given frequency rate, monitored by the event engine, and administered as an alert action. The alert mechanism is tuned to monitor for plan completion, and restart this plan for every required frequency period. Hence this works like a scheduled task in the BAM server. Open the ActiveStudio, and create a new alert, select “create a new rule”. In the rule definition window, select “Every interval between two times’. Give the rule a name, set the time interval as required (example 10 minutes). TechNote_BAM_ReadingExternalTableintoADC.doc Page 7 of 7 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects Set the start and end time as required (example: 00:00:10 AM to 11:50:00 PM) Click on next to get the next dialog box. In the next dialog box, select particular day of week (and set the required day of week as needed, see below for example), and set to run a plan (select your plan from the list). Click on OK to save and close the alert rule definition box. This completes the plan execution steps as monitored by event engine, and as scheduled by the parameters given above. Insert a new data row in the database table. Observe that the ADC object is updated with latest data from the external database tables (if there are any changes, and after the plan is run by the event engine at above given frequency constrains). Summary: • To read DB tables data into ADC objects. • This is not recommended to get real time data into ADC. • This can be used only for periodic controlled refresh of data. • There are heavy performance penalties on this architecture depending on the number of rows in the database tables. • Performance, DB Connection Pooling, etc observations should be taken into account. • Contact Oracle BAM team for detailed analysis and steps and best practices. TechNote_BAM_ReadingExternalTableintoADC.doc Page 8 of 8 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved Tech Note: Oracle BAM –Reading external Database Tables contents into BAM Active Data Cache Data Objects Note: The above plans and examples show only updating the ADC objects using the database table contents. It will not check for duplicates or old-deletes etc. You have to include logic in your plans to process all possible conditions. One example is given below using a plan definition. Questions & Clarifications: If you have any comments or need additional information, please communicate through the Oracle BAM forum at: http://forums.oracle.com/forums/forum.jspa?forumID=252 TechNote_BAM_ReadingExternalTableintoADC.doc Page 9 of 9 Oct 16, 06 (version 10.1.3) Document version (4) Oracle confidential, All rights reserved