Showing posts with label Usage Tracking. Show all posts
Showing posts with label Usage Tracking. Show all posts

Comparing OBIEE Usage Tracking with NQSQUERY.LOG

The other day I posted about the query log file generated by the Oracle BI Server, and how you could use it to add diagnostics to your query environment. Scott Powell added a comment to the posting suggesting that I take a look at the Usage Tracking feature within OBIEE, as this logs query statistics to a database table and allows you to run reports against them. I’d made a mental note of usage tracking but not used it in anger, and as I heard at Open World that the usage tracking feature had been improved in 10.1.3.4, I thought I’d take a look and see how it now worked.
Usage Tracking isn’t something that’s installed by default with OBIEE, you have to run a script to create a tracking table called S_NQ_ACCT in your database and then register the table in the repository and the NQSCONFIG.INI file. You can log statistics to a file instead, but direct insertion into a table is the recommended approach as this allows better analysis and you can also batch inserts up to reduce the load on the server. Something that I think is new in 10.1.3.4 is a subdirectory under the $ORACLEBI/server/sample directory called “usagetracking”, this contains a number of extra table creation scripts, a repository RPD file that you can import and some web catalog files to provide instant reports over your usage tracking data, something that I think first shipped with the BI Applications and now ships with OBIEE from this release onwards.
Usage1-1
I don’t know if it was just me, but it actually took me quite a lot of time to get Usage Tracking up and running though. FIrst off, there are some extra tables to create, including a view (S_NQ_LOGIN_GROUP) that is required for the various reports but only seems to ship with an SQL Server script – in fact the various repository files and scripts look like they were originally developed for SQL Server, which is the database I often see some of the original nQuire product managers demoing OBIEE with, I guess historically this is the database many of the demos were developed for and that’s reflected itself in the Usage Tracking samples that ship with 10.1.3.4. Once you’ve got the tables developed you need to add a couple of entries to the NQSCONFIG.INI file to turn on usage tracking, tell the BI Server to write the log entries to the database and to specify which database tables to insert to.
Usage1A-2
The key entries are:
[ USAGE_TRACKING ]

ENABLE = YES;

DIRECT_INSERT = YES;

PHYSICAL_TABLE_NAME = <name of physical S_NQ_ACCT table, as located in the physical model>

CONNECTION_POOL = <name of connection pool for log writes, should be separate to other connection pools>

BUFFER_SIZE = 10 MB;

BUFFER_TIME_LIMIT_SECONDS = 5;
The repository also took a while to import properly; it makes use of old-style time series functionality and I had to recreate all the derived measures (change since last year, percentage change since last year and so on) using the new “Time Dimension”-based time series functionality that comes with 10.1.3.4. In the end though I managed to get it all up and running, with a new physical model, business model and subject area within my repository so that I could now start recording and analyzing usage tracking information
Usage2-3
Once you get the repository up and running, and the web catalog imported, you can take a look at the pre-defined reports. Here’s one that lists out the top 10 longest running queries.
Usage3-2
You can also of course create your own reports, and add them to a Usage Tracking dashboard, which you can use to monitor the health of your system, highlight problem reports, see if response time is deteriorating over time and so on.
So how does this compare to the log file analysis that I blogged about the other day? Well, putting my Oracle database hat on, analyzing queries via the log file is more like performing an SQL trace, whereas the usage tracking feature is more like using Statspack, or an automated session logging tool such as AWR or ADDM. The NQSQUERY.LOG file gives you more information than usage tracking, including the actual physical SQL or MDX sent to the underlying databas, details of how federated queries are broken down into individual database calls, plus you get the logical execution plan for a query together with individual row counts at the various stages of the query. Like SQL tracing though, you need to have turned logging (or tracing) on before you can analyze a query, and as Oracle’s recommendation is only to turn logging on for diagnostic purposes, it’s likely that it won’t be on when a user calls you up and tells you that the system is slow. Usage Tracking, in contrast, like Statspack or AWR/ASH is likely to be on at all times, and whilst it won’t tell you the details of how the query executed, you can use to it generate general trend-type reports in order to spot when a problem is developing based on deteriorating performance. The Query log appeals to me as I like to look at the internals, but for most people the extra information available beyond logging level 3 (the logical execution plan and the intermediate row counts) won’t be relevant and they’re mostly interested in whether query performance has spiked recently.
So, from a diagnostics and problem highlighting point of view, my recommendation would be to have Usage Tracking turned on and logging query performance as a background task, potentially using an iBot to send an alert if key queries start to come back with below-average response times. Then, if you’re looking to investigate a particular query, or perhaps if you’re interested in how the BI Server handles a particularly complex federated or other query, the query log is a useful equivalent of the Oracle database SQL trace file and gives you the ability to see how the BI Server goes about satisfying a user query

OBIEE usage tracking setup and cloning reports with CAF

Usage tracking repository and catalog setup

Finally I did usage tracking setup in OBIEE. There is a good doc/example in Oracle by example site
http://www.oracle.com/technology/obe/obe_bi/bi_ee_1013/usage_tracking/usage_tracking.htm#t1 in John Minkjan's bloghttp://obiee101.blogspot.com/2008/08/obiee-setting-up-usage-tracking.html and Rittman Meadhttp://www.rittmanmead.com/2008/10/11/comparing-obiee-usage-tracking-with-nqsquerylog/. Also there are many sources of this information on other sites/bloges.

I will use my SH user to create usage tracking tables into it.

Use SAACCT.Oracle.sql to create table S_NQ_ACCT. Script can be found in ..OracleBI\server\SchemaScripts folder. After that jump into D:\OracleBI\server\Sample\usagetracking\SQL_Server_Time. There are some scripts that we need to start.

Decription of S_NQ_ACCT columns (description of usage tracking data) is available in Oracle Business Intelligence documentation Oracle Business Intelligence Server
Administration Guide in the table 42 on the page 406.

Run scripts:

Oracle_create_nQ_Calendar.sql (create S_ETL_DAY)
Oracle_create_nQ_Clock.sql (create S_ETL_TIME_DAY)
Oracle_nQ_Calendar.sql (insert into S_ETL_DAY)
Oracle_nQ_Clock.sql (insert into S_ETL_TIME_DAY)

We make these tables public:

GRANT SELECT ON S_ETL_DAY TO PUBLIC;
GRANT SELECT ON S_ETL_TIME_DAY TO PUBLIC;

Now we need to merge usagetracking.rpd into our current rpd online.

I copy/paste my current online rpd and save it as ofline. This repository I'll open at first and also I make a copy of it, and this copy is only for OBIEE to allow me to merge (this is required although they are the same).


We get the message that repositories are identical.

Now, we add usagetracking.rpd as modified repository.

We merge information from usagetracking.rpd to our tecaj.rpd.


After merging ignore delete failed message.

A new repository has been created.


Save new merged repository and owerwrite original tecaj.rpd.


We need to put some changes to OBI Usage Tracking database folder, connection pools in the physical layer and also in NQSConfig.ini in ..\OracleBI\server\Config.

I set my SH user to connection pools Usage Tracking Writer Connection Pool and Connection pool. The first is for writing and the second just for reading.


Don't forget to create vie NQ_LOGIN_GROUP:

create view NQ_LOGIN_GROUP as
select distinct USER_NAME as LOGIN, USER_NAME as RESP
from S_NQ_ACCT;

grant select on nq_login_group to public;

Changes in NQSConfig.ini:


Before merging usage tracking catalog (reports) into our current catalog online, make sure that you copy/paste your new merged repository into ..OracleBI\server\Repository folder and owerwrite the old one.

For merging usage tracking reports I'll use Content Accelerator Framework (CAF) clone option. I'll not explain procedure for installing Content Accelerator Framework (CAF), you can find it on the
http://www.oracle.com/technology/products/bi/pdf/oraclebiee-cafv1-usage-instructions.pdf.

In ..OracleBI\server\Sample\usagetracking there is a UsageTracking.zip. If you unzip it you'll get usage tracking catalog.


Open usage tracking catalog ofline and merge it to our current online web catalog. You'll need to open two instances of catalog manager application.

Copy/paste this path to catalog:


Copy usage tracking reports and dashboards from shared folder:


Paste it to a web catalog online shared folder:


You'll se usage tracking in online web catalog shared folder. We did a usage tracking reports and dashboards migration in online web catalog.


Cloning reports with Content Accelerator Framework (CAF) V1

Now, open Content Accelerator Framework (CAF) V1 and try to clone these usage tracking reports just for test.

We use copy of online repository:


Clone all usage tracking reports:


The same repository file we are using for source and the target repository because we just want to copy/clone reports:


We choose usage tracking subject area and make required object mappings:


You can change the name of the target report, add yome prefix, etc. Cloned reports are in the cloned folder:

Usage Tracking Settings In OBIEE NQSConfig.INI File


IN NQSConfig.INI sample working settings
[ USAGE_TRACKING ]
ENABLE = YES;
//==============================================================================
// Parameters used for writing data to a flat file (i.e. DIRECT_INSERT = NO).
//
STORAGE_DIRECTORY = ;
CHECKPOINT_INTERVAL_MINUTES = 5;
FILE_ROLLOVER_INTERVAL_MINUTES = 30;
CODE_PAGE = “ANSI”; // ANSI, UTF8, 1252, etc.
//
//==============================================================================
DIRECT_INSERT = YES;
//==============================================================================
// Parameters used for inserting data into a table (i.e. DIRECT_INSERT = YES).
PHYSICAL_TABLE_NAME = “OBI Usage Tracking”.”Catalog”.”dbo”.”S_NQ_ACCT” ;
CONNECTION_POOL = “OBI Usage Tracking”.”Usage Tracking Writer Connection Pool” ;
BUFFER_SIZE = 10 MB ;
BUFFER_TIME_LIMIT_SECONDS = 5 ;
NUM_INSERT_THREADS = 5 ;
MAX_INSERTS_PER_TRANSACTION = 1 ;
//==============================================================================
IN the physical layer the folder structure is as follows: