Thursday, December 27, 2012

Setting Up Usage Tracking in Oracle BI 11g




    Introduction

    The Oracle BI Server supports the collection of usage tracking data. When usage tracking is enabled, the Oracle BI Server collects usage tracking data for each query, and it writes statistics to a usage tracking log file or inserts them directly into a database table.
    It is strongly recommended that you use direct insertion instead of writing to a log file. The Oracle BI Summary Advisor feature works in conjunction with the usage tracking feature. Summary Advisor works only with direct insertion usage tracking. Oracle BI Summary Advisor is available when you are running Oracle Business Intelligence on the Oracle Exalytics Machine.
    This tutorial shows you how to set up and use usage tracking. Usage tracking is also helpful in determining which user queries are creating performance bottlenecks, based on query frequency and response time. In this tutorial, you use a database table.

    Prerequisites

    Before starting this tutorial, you should:
    • Complete the tutorial Creating a Repository Using the Oracle BI 11g Administration Tool.
    • Have access to or have installed Oracle Database 11.2 or later
    • Have access to or have installed Oracle BI EE 11.1.1.6.0 or later
    • Have access to or have installed the BISAMPLE sample schema that is included with the Sample Application for Oracle Business Intelligence Suite Enterprise Edition Plus. There are two options for accessing the BISAMPLE schema:1. If you already have installed V107 of the Sample Application, verify that you have access to the BISAMPLE schema and begin the tutorial.
      2. If you want to download and install the complete Sample Application, you can access it here on the Oracle Technical Network (OTN). Install the SampleApp V107 install files. Note, however, that only the BISAMPLE schema is required to complete this tutorial.

    • Creating the Usage Tracking Subject Area in the Repo
    In this section, you check for the existence of the S_NA_ACCT Usage Tracking table in the database Repository Creation Utility (RCU) schema. You then create the three layers in the BI Repository for Usage tracking.
     

    Checking for Usage Tracking Table

      In this sub-section, you check for the existence of the S_NA_ACCT Usage Tracking table in the database Repository Creation Utility (RCU) schema. In this example, the data source name is orcl, the schema name isdev_biplatform, and the password is Oracle01. Open SQL*Plus on your desktop. Log in with the user name dev_biplatform and password Oracle01.
      At the SQL prompt, enter the following SQL statement:
      SQL>Select table_name from tabs where table_name like 'S%';
      Check the columns names by entering the following statement:
      SQL>Desc S_NQ_ACCT;
      You can also use SQL Developer to check for the S_NQ_ACCT table.
     

    Creating the Database Object in the Physical Layer

      Open SampleApp.rpd in offline mode in the BI Administration Tool. This is the rpd that comes with the Sample Applications. Enter Admin123 as the repository password.
      Right-click inside the Physical layer white space and select New Database to open the Database properties dialog box.
      Click the General tab and name the database 12-Usage Tracking.

      In the Database drop-down list, select Oracle 11g.

      Click the Connection Pool tab and click Add to open the Connection Pool dialog box.
      Name the connection pool Usage Tacking Connection Pool.
      Enter the data source name, username, and password. In this example, the following are entered:
      Data source name: (DESCRIPTION=(ADDRESS_LIST=(ADDRESS=(PROTOCOL=TCP)(HOST=localhost)(PORT=1521)))(CONNECT_DATA=(SID-orcl)))
      User name: dev_biplatform
      Password: Oracle01
      Click OK.
      Enter Oracle01 to confirm the password, and click OK.Then click OK again to close the Database properties dialog box.
      Right-click the 12-Usage Tracking database object and select New Object>Physical Schema.
      Name the physical schema Usage Tracking Schema and then click OK.
      Right-click the Usage Tracking Connection Pool, select Import Metadata, and import the dev-biplatform.S_NQ_ACCT table into 12-Usage Tracking.
      Click Next in Step 2, Import Metadata - Select Metadata Types dialog box.
      In Step 3, select the S_NQ_ACCT table under dev_biplatform and move it to the Repository View pane. Click Finish.
      The dev_biplatform schema is added under 12-Usage Tracking.
      Right-click S_NQ_ACCT from dev_biplatform and then cut and paste it under Usage Tracking Schema.
      Expand the S_NQ_ACCT table.
      You have now created the Physical Layer for Usage Tracking


     

    Creating the Business Model Layer for Usage Tracking

      Right-click in the Business Model and Mapping layer white space and select New Business Model.
      Name the business model 13-Usage Tracking 2, and then click OKNote: there is a similar business model name 10 - Usage Tracking. This is set up by Sample Applications.
      Right-click 13-Usage Tracking 2 and select New Object>Logical Table.
      Name the table Measures and click OK.
      Repeat and add three more tables - TimeTopic, and User to the 13-Usage Tracking 2 business model.
      Drag the following three physical columns from Usage Tracking Schema>S_N_ACCT to the Measures logical table in the 13- Usage Tracking 2 business model. For each column, right-click the logical column and select Rename, and then rename as follows:
      Physical ColumnRename
      QUERY_TEXTQuery Count
      ROW_COUNTRow Count
      TOTAL_TIME_SECTotal Time Seconds
      Right-click the column Query Count and select Properties.

      Click the Aggregation tab and select Count from the Default aggregation rule drop-down list. Click OK.

      Similarly, set the Aggregation rule for other logical columns in the Measures logical table as follows:
      Logical ColumnAggregation Rule
      Row CountSum
      Total Time SecondsSum
      Drag the following three physical columns from Usage Tracking Schema>S_NA_ACCT to the Time logical table in the 13-Usage Tracking 2 business model. Rename them as follows:
      Physical ColumnRename
      START_DTStart Date
      START_HOURS_MINStart Hour Minute
      END_HOUR_MINEnd Hour Minute
      The Time logical table should look like this:
      Set Start Date as the logical key for the Time logical table. Right-click the Time logical table and select Properties.
      Click the Keys tab and enter Time_key in the Key Name column.

      Select Start Date from the Columns drop-down list. Click OK.

      Drag the following two physical columns from Usage Tracking Schema>S_NQ_ACCT to the Topic logical table in the 13-Usage Tracking 2 business model. Rename them as follows:
      Physical ColumnRename
      QUERY_TEXTLogical SQL
      SUBJECT_ AREA_NAMESubject Area
      Set Logical SQL as the logical key for the Topic logical table.
      Drag the USER_NAME physical column from Usage Tracking Schema>S_NQ_ACCT to the User logical table in the 13-Usage Tracking 2 business mode. Rename it to User Name.
      Set User Name as the logical key for the User logical table.
      Use the Business Model Diagram to create logical joins from Measures to Time. Right-click the 13-Usage Tracking 2 business model and select Business Model Diagram>Whole Diagram.
      Click the New Join icon from the menu and create logical joins from Measure to TimeTopic, and User as shown below.
      You have now created the Usage Tracking business model. You will next move it to the Presentation layer.
     

    Creating the Presentation Layer

      Drag the 13-Usage Tracking 2 business model to the Presentation layer to create the Presentation layer objects. Rename the subject area to Y-Usage Tracking 2.
      Save the repository. A message will ask whether you want to check consistency. Click Yes. You should then receive a message stating - Business model 13-Usage Tracking 2 is consistent. Do you want to mark it as available for queries? Click YES. The Consistency Check Manager window is displayed.
      Click Close in the Consistency Check manger. Close the repository and the BI Administration Tool.
      You have now finished creating the Y-Usage Tracking 2 subject area. Note: In Sample Applications, there is another usage tracking subject area name U - Usage Tracking.
 
    Configuring usage tracking in Enterprise Manager:
    You now configure usage tracking through Oracle Enterprise Manager (EM) by performing the following steps:
    Log into EM. In this example, the user name is weblogic and the password is welcome1.
    Select WebLogic Domain>bifoundation_domain from the left navigation pane.
    Click the WebLogic Domain drop-down list in the right pane.
    Select System MBean Browser from the list.
    Expand Application Defined MBeans>oracle.biee.admin.
    Expand bifoundation_domain.
    Lock the domain to update it. Expand BIDomain and select the BIDomain MBean where group=ServiceNote: Expand Show MBean Information in the right pane.
    Click the Operation tab.
    Click the Lock link. On the Operation:lock page, click the Invoke button.
    Click the Return button.
    Expand BIDomain.BIInstance.ServerConfiguration, and then select the BIDomain.BIInstance.ServerConfiguration MBean.
    Click the Attributes tab. Scroll down and click UsageTrackingCentrallyManaged. Set Value to true in the drop-down list.
    Click the Apply button. When you see the confirmation message for the update, click the Return button.
    Similarly, set the UsageTrackingEnabled attribute to true to enable usage tracking.

    Set the UsageTrackingDirectInsert attribute to true to enable direct insertion.

    Set the UsageTrackingPhysicalTableName attribute to the name of the fully qualified database table for collecting query statistic information, as it appears in the Physical layer of the Oracle BI repository. In this example, it is set as follows:
    "12-Usage Tracking"."Usage Tracking Schema"."S_NQ_ACCT"

    Set the UsageTrackingConnectionPool attribute to the name of the fully qualified connection pool for the query statistics database, as it appears in the Physical layer of the Oracle BI repository. In this example, it is set as follows:
    "12-Usage Tracking"."UsageTracking Connection Pool"


    Note: For usage tracking insertions to succeed, the connection pool must be configured with a user ID that has write access to the back-end database. Also, it is recommended that the connectivity type support international data.
    After applying your changes, release the lock on the domain, as follows:
    • Return to the BIDomain MBean where group=Service under oracle.biee.admin, Domain:bifoundation_domain, BIDomain.
    • Click the Operations tab.
    • Click one of the first commit operations.


    Go to the Oracle Business Intelligence Instance page and click Restart All on the Availability>Processes tab.

 
    You now run analyses to populate the Usage Tracking S_NQ_ACCT table, and then you run queries on the table to get details of these queries.
     

    Creating and Running to Populate Usage Tracking Table

      Log in to Oracle BI as weblogic/welcome1.
      Create and run the following analysis in the A-Sample Sales subject area:
      Note that the number of rows returned for this query is 9.
      Create and run the following analysis in the A-Sample Sales subject area:
      Note that the number of rows returned for this query is 1020.
     

    Creating and Running Analyses to Verify Usage Tracking

      Create and run an analysis to check usage tracking. Create the following analysis in the Y- Usage Tracking 2 subject area.
      Click Results and check the results for the weblogic user. Your results should look similar to the following image:
      Check the query log in the nqquery.log file and verify that the Usage Tracking 2 and S_NQ_ACCT table are accessed in the query.
 
    In this tutorial, you should have learned how to:
    • Set up the three layers in the BI Administration Tool for usage tracking
    • Configure usage tracking by using Enterprise Manager
    • Populate the usage tracking table
    • Run queries against the usage tracking table, to get user query details