Showing posts with label cache. Show all posts
Showing posts with label cache. Show all posts

Monday, 21 September 2015

OBIEE 10G/11G - Event Pooling table (Event Table) to purge the cache after ETL process

OBIEE 10G/11G - Event Pooling table (Event Table) to purge the cache after ETL process

About

The use of an Oracle BI Server event polling table (event table) is a way to notify the Oracle BI Server that one or more physical tables have been updated and then that the query cache entries are stale.
Each row that is added to an event table describes a single update event, such as an update occurring to a Product table.
The Oracle BI Server cache system reads rows from, or polls, the event table, extracts the physical table information from the rows, and purges stale cache entries that reference those physical tables.
The event table is a physical table that resides on a database accessible to the Oracle BI Server. Regardless of where it resides—in its own database, or in a database with other tables—it requires a fixed schema.
It is normally exposed only in the Physical layer of the Administration Tool, where it is identified in the Physical Table dialog box as being an Oracle BI Server event table.
It does require the event table to be populated each time a database table is updated. Also, because there is a polling interval in which the cache is not completely up to date, there is always the potential for stale data in the cache.
A typical method of updating the event table is to include SQL INSERT statements in the extraction and load scripts or programs that populate the databases. The INSERT statements add one row to the event table each time a physical table is modified.
After this process is in place and the event table is configured in the Oracle BI repository, cache invalidation occurs automatically. As long as the scripts that update the event table are accurately recording changes to the tables, stale cache entries are purged automatically at the specified polling intervals.

Articles Related

Polling Table Structure

You can set up a physical event polling table on each physical database to monitor changes in the database. The event table should be updated every time a table in the database changes.
The event table needs to have the structure shown below. The column names for the event table are suggested; you can use any names you want. However, the order of the columns has to be the same in the physical layer of the repository (then by alphabetic ascendant order)
Column Name by alphabetic ascendant orderData TypeNullDescriptionAdvise
CatalogNameCHAR or VARCHARYesThe name of the catalog where the physical table that was updated resides.Populate the CatalogName column only if the event table does not reside in the same database as the physical tables that were updated. Otherwise, set it to the null value.
DatabaseNameCHAR or VARCHARYesThe name of the database where the physical table that was updated resides.Populate the DatabaseName column only if the event table does not reside in the same database as the physical tables that were updated. Otherwise, set it to the null value.
OtherCHAR or VARCHARYesReserved for future enhancements.This column must be set to a null value.
SchemaNameCHAR or VARCHARYesThe name of the schema where the physical table that was updated resides.Populate the SchemaName column only if the event table does not reside in the same database as the physical tables being updated. Otherwise, set it to the null value.
TableNameCHAR or VARCHARNoThe name of the physical table that was updated.The name has to match the name defined for the table in the Physical layer of the Administration Tool.
UpdateTimeDATETIMENoThe time when the update to the event table occurs. This needs to be a key (unique) value that increases for each row added to the event table.To make sure a unique and increasing value, specify the current timestamp as a default value for the column. For example, specify DEFAULT CURRENT_TIMESTAMP for Oracle 8i.
UpdateTypeINTEGERNoSpecify a value of 1 in the update script to indicate a standard update.Other values are reserved for future use.

Step by Step for the Oracle database

Create the user

CREATE user OBIEE_REPO IDENTIFIED BY OBIEE_REPO;
GRANT connect,resource TO OBIEE_REPO;

Create the table

In 10g: Obi_Home\bi\server\Schema\SAEPT.Oracle.sql
--------------------------------------
--  Create the Event Polling Table. --
--------------------------------------
CREATE TABLE S_NQ_EPT (
  UPDATE_TYPE    DECIMAL(10,0)  DEFAULT 1       NOT NULL,
  UPDATE_TS      DATE           DEFAULT SYSDATE NOT NULL,
  DATABASE_NAME  VARCHAR2(120)                      NULL,
  CATALOG_NAME   VARCHAR2(120)                      NULL,
  SCHEMA_NAME    VARCHAR2(120)                      NULL,
  TABLE_NAME     VARCHAR2(120)                  NOT NULL,
  OTHER_RESERVED VARCHAR2(120)  DEFAULT NULL        NULL 
) ;
In 11g, the table is present in the BIPLATFORM metadata repository.

Import the table with ODBC (not with OCI)

Import the table with ODBC and change the call interface connection pool to OCI.
If you don't have an Oracle ODBC connection, you can simply suppress the table after importation with OCI and copy paste on the schema OBIEE_REPO the following UDML statmement:
DECLARE TABLE "ORCL".."OBIEE_REPO"."S_NQ_EPT" AS "S_NQ_EPT" NO INTERSECTION PRIVILEGES ( READ);
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."UPDATE_TYPE" AS "UPDATE_TYPE" TYPE "DOUBLE" 
        PRECISION 10 SCALE 0  NOT NULLABLE PRIVILEGES ( READ);
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."UPDATE_TS" AS "UPDATE_TS" TYPE "TIMESTAMP" 
        PRECISION 19 SCALE 0  NOT NULLABLE PRIVILEGES ( READ);
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."DATABASE_NAME" AS "DATABASE_NAME" TYPE "VARCHAR" 
        PRECISION 120 SCALE 0  NULLABLE PRIVILEGES ( READ);
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."CATALOG_NAME" AS "CATALOG_NAME" TYPE "VARCHAR" 
        PRECISION 120 SCALE 0  NULLABLE PRIVILEGES ( READ);
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."SCHEMA_NAME" AS "SCHEMA_NAME" TYPE "VARCHAR" 
        PRECISION 120 SCALE 0  NULLABLE PRIVILEGES ( READ);
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."TABLE_NAME" AS "TABLE_NAME" TYPE "VARCHAR" 
        PRECISION 120 SCALE 0  NOT NULLABLE PRIVILEGES ( READ);
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."OTHER_RESERVED" AS "OTHER_RESERVED" TYPE "VARCHAR" 
        PRECISION 120 SCALE 0  NULLABLE PRIVILEGES ( READ);
When you import the table with OCI, the UDML metadata are not the same. They have different syntax for the definition of a column. You can remark in the two below statement that the OCI metadata has an extra EXTERNAL clause that you don't find in the ODBC metadata.
Declaration of the column CATALOGNAME after import with OCI:
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."CATALOGNAME" AS "CATALOGNAME" EXTERNAL "obiee_repo" 
TYPE "VARCHAR" PRECISION 40 SCALE 0  NULLABLE  PRIVILEGES ( READ);
Declaration of the column CATALOGNAME after import with ODBC:
DECLARE COLUMN "ORCL".."OBIEE_REPO"."S_NQ_EPT"."CATALOGNAME" AS "CATALOGNAME" 
TYPE "VARCHAR" PRECISION 40 SCALE 0  NULLABLE PRIVILEGES ( READ);

Define the table as an event table

You can restart the Oracle BI Server service to be sure that the table is now seen as a good event table. If you have any error in the NQServer.log during the start, correct them.

Test

  • Create a report with a product attribute to seed the cache.
  • Insert a row to give to OBIEE the instruction to delete the cache from all SQL query cache which contain the product table.
INSERT
INTO
  S_NQ_EPT
  (
    update_type,
    update_ts,
    database_name,
    catalog_name,
    schema_name,
    table_name,
    other_reserved
  )
  VALUES
  (
    1,
    sysdate,
    'orcl SH',
    NULL,
    'SH',
    'PRODUCTS',
    NULL
  )
  • Wait the polling interval frequency and verify that the cache entry is deleted and that you can find the below trace in the NQQuery.log file.
+++Administrator:fffe0000:fffe001c:----2010/06/16 00:45:33

-------------------- Sending query to database named ORCL (id: <<13628>>):

select T4660.UPDATE_TYPE as c1,
     T4660.UPDATE_TS as c2,
     T4660.DATABASE_NAME as c3,
     T4660.CATALOG_NAME as c4,
     T4660.SCHEMA_NAME as c5,
     T4660.TABLE_NAME as c6
from 
     S_NQ_EPT T4660
where  ( T4660.OTHER_RESERVED in ('') or T4660.OTHER_RESERVED is null ) 
minus
select T4660.UPDATE_TYPE as c1,
     T4660.UPDATE_TS as c2,
     T4660.DATABASE_NAME as c3,
     T4660.CATALOG_NAME as c4,
     T4660.SCHEMA_NAME as c5,
     T4660.TABLE_NAME as c6
from 
     S_NQ_EPT T4660
where  ( T4660.OTHER_RESERVED = 'oracle10g' ) 


+++Administrator:fffe0000:fffe001c:----2010/06/16 00:45:33

-------------------- Sending query to database named ORCL (id: <<13671>>):

insert into 
     S_NQ_EPT("UPDATE_TYPE", "UPDATE_TS", "DATABASE_NAME", "CATALOG_NAME", "SCHEMA_NAME", "TABLE_NAME", "OTHER_RESERVED") 
values (1, TIMESTAMP '2010-06-16 00:44:53', 'orcl SH', '', 'SH', 'PRODUCTS', 'oracle10g')


+++Administrator:fffe0000:fffe0003:----2010/06/16 00:45:33

-------------------- Cache Purge of query:
SET VARIABLE QUERY_SRC_CD='Report',SAW_SRC_PATH='/users/administrator/cache/answers_with_product';
SELECT Calendar."Calendar Year" saw_0, Products."Prod Category" saw_1, "Sales Facts"."Amount Sold" 
saw_2 FROM SH ORDER BY saw_0, saw_1


+++Administrator:fffe0000:fffe001c:----2010/06/16 00:45:33

-------------------- Sending query to database named ORCL (id: <<13672>>):

select T4660.UPDATE_TIME as c1
from 
      S_NQ_EPT T4660
where  ( T4660.OTHER_RESERVED = 'oracle10g' ) 
group by T4660.UPDATE_TS
having count(T4660.UPDATE_TS) = 1


+++Administrator:fffe0000:fffe001c:----2010/06/16 00:45:33

-------------------- Sending query to database named ORCL (id: <<13716>>):

delete from 
      S_NQ_EPT where  S_NQ_EPT.UPDATE_TS = TIMESTAMP '2010-06-16 00:44:53'

Support

The cache polling event table has an incorrect schema

In the NQServer.log file
[56001] The cache polling event table S_NQ_EPT has an incorrect schema.
You must import the event table via ODBC 3.5. When you use OCI, the UDML of the table has a difference. You can then change the call interface to OCI.

The physical table in a cache polled row does not exist

In the NQServer.log file
[55001] The physical table ORCL::SH:PRODUCTS in a cache polled row does not exist.
Verify the location of your table.
For instance, in my case, the good location was “orcl SH::SH:PRODUCTS” as you can see in the picture below.

The cache polling SELECT query failed for table

When you get the following trace in NQQuery.log, it's because:
  • your event table was deleted
  • or that the name in the physical layer doesn't match any more the table in the database.
2010-06-15 07:52:28  [55003] The cache polling SELECT query failed for table S_NQ_EPT.
2010-06-15 07:52:28  [nQSError: 17001] Oracle Error code: 942, message: ORA-00942: table or view does not exist
at OCI call OCIStmtExecute. 
                     [nQSError: 17010] SQL statement preparation failed.
2010-06-15 07:52:28  [55005] The cache polling delete statement failed for table S_NQ_EPT.

faulting module NQSCache.dll

Oracle BI Server can literally crash when you use the example script that is given in the documentation (with an OTHER column). You can find this information in the even viewer of Windows.
Description: Faulting application NQSServer.exe, version 10.1.3.4, faulting module NQSCache.dll, 
version 10.1.3.4, fault address 0x00016b43.  
Solution: change the structure of the table by using the script in the schema directory (such as above in the document)

Different ways to Manage Cache in OBIEE ( part 2)

You can also purge cache direct from Dashboard by following the given steps.
Goto  Settings—>Administration —> Issue sql
call sapurgeallcache() and click issues sql..below is the screen shot

PRESENTATION CACHEBy default, the cache files for the presentation server reside in the \tmp directory within the respective subdirectories sawcharts, sawrptcache and sawvc; while the xml cache files lying in the \tmp folder itself.  

Chart Cache - \OracleBIData\tmp\sawcharts\
Report Cache - \OracleBIData\tmp\sawrptcache\
State Pool Cache - \OracleBIData\tmp\sawvc\
XML Cache - \OracleBIData\tmp\
See image below for an example of how to modify the instance config to explicitly change the default presentation cache directory locations.


Additionally, and only specific to the XML Cache directory location change, you must also make a change to the nqconfig file as follows:

WORK_DIRECTORY_PATHS = "C:\DataSources\Cache\tmp";

ENABLE PRESENTATION CACHE
In instanceconfig.xml file ( \OracleBIData\web\config\instanceconfig.xml )

<ServerInstance>
<Cache>
<Query>
<MaxEntries>100</MaxEntries>
<MaxExpireMinutes>60</MaxExpireMinutes>
<MinExpireMinutes>10</MinExpireMinutes>
<MinUserExpireMinutes>10</MinUserExpireMinutes>
</Query>
</Cache>
<ServerInstance>



DISABLE PRESENTATION CACHE FOR ENTIRE APPLICATION
In instanceconfig.xml file ( \OracleBIData\web\config\instanceconfig.xml )
<ServerInstance>
<ForceRefresh>TRUE</ForceRefresh>
</ServerInstance>

BYPASS PRESENTATION CACHE
Sometimes you want to bypass the presentation / cache for development purposes. Or more often when you get weird write back behaviour. Add this to the instanceconfig file:

<CacheMaxExpireMinutes>-1</CacheMaxExpireMinutes>
<CacheMinExpireMinutes>-1</CacheMinExpireMinutes>
<CacheMinUserExpireMinutes>-1</CacheMinUserExpireMinutes>
CLEAR PRESENTATION CACHE
Via Oracle BI Web Application
Settings-->Administration-->Reload Files and Metadata-->Finished

or

Via Server Service
Shut down Presentation Services to remove the files for the Presentation Cache

**If you delete cache files when Presentation Services are still running or SAW does not shut down cleanly, then various cache files might be left on disk.



BI SERVER CACHE
By default, the BI Server Cache is stored in the \OracleBIData\cache\ directory and stored as NQS*.tbl files.

BI SERVER CACHE FILE NAME FORMAT 
image

NQS(Prefix)_VMVGGOBI(Originating Server Name)_733547(Days passed since 1-1-0000)40458(Seconds passed since last midnight)_00000006(Incremental number since last BI server start).TBL



ENABLE BI SERVER CACHE
To enable the query cache for the entire application, you must set the ENABLE cache parameter value to YES in the file nqsconfig.  ( \OracleBI\server\Config\NQSConfig.INI )
ENABLE = YES;


DISABLE BI SERVER CACHE FOR ENTIRE APPLICATION
To disable the query cache for the entire application, you must set the ENABLE cache parameter value to NO in the file nqsconfig.  ( \OracleBI\server\Config\NQSConfig.INI )
ENABLE = NO;


BYPASS BI SERVER CACHE FOR SINGLE REPORT
In Answers, goto Advanced Reporting tab when building report, set Prefix value to following:
SET VARIABLE DISABLE_CACHE_HIT=1, DISABLE_CACHE_SEED=1, LOGLEVEL=7;


CLEAR BI SERVER CACHE
To clear the BI Server Cache files, run the following command file:  \OracleBI\server\cache_purge_reseed\call.bat 

This calls the purge.txt file, which simply contains the following command:
call SAPurgeAllCache();

This will clear the BI Server Cache (.TBL) files in the Cache directory:
\OracleBIData\cache\

or

An alternate way of doing this is via the OBI Admin Tool, using the Cache management feature.


 

BI SERVER CACHE PERSISTENCE
...When a dynamic repository variable is updated, cache is automatically purged. This is designed behavior. Cache will be invalidated (i.e. purged) whenever the initialization block that populates dynamic repository variable is refreshed. The reason that refreshing a variable purges cache is that if a variable was used in a calculation, and the variable changed, then cache would have invalid data. By purging cache when a variable changes, this problem is eliminated.

Since this is the designed functionality, Change Request 12-EOHPZ3 titled ‘Repository variable refresh purges cache’ exists on our database to address a product enhancement request. The workaround is to go through the dynamic repository variables and verify that the variables are being refreshed at the correct interval. If a variable needs to be refreshed daily, there may be a need to set up a cache seeding .bat file that runs after the dynamic variable has been updated. If the cache seeding .bat file runs prior to the refresh of the dynamic variable refresh, then the cache will be lost.

BI SERVER CACHE ENABLED BUT NOT CACHING
OBIEE cache is enabled, but why is the query not cached?...

Non-cacheable SQL function:  If a request contains certain SQL functions, OBIEE will not cache the query. The functions are CURRENT_TIMESTAMP, CURRENT_DATE, CURRENT_TIME, RAND, POPULATE. OBIEE will also not cache queries that contain parameter markers.

Non-cacheable Table:  Physical tables in the OBIEE repository can be marked ‘non-cacheable’. If a query makes a reference to a table that has been marked as non-cacheable, then the results are not cached even if all other tables are marked as cacheable.


Query got a cache hit: In general, if the query gets a cache hit on a previously cached query, then the results of the current query are not added to the cache. Note: The only exception is the query hits that are aggregate “roll-up” hits, will be added to the cache if the nqsconfig.ini parameter POPULATE_AGGREGATE_ROLLUP_HITS has been set to Yes.

Caching is not configured: Caching is not enabled in NQSConfig.ini file.


Result set too big: The query result set may have too many rows, or may consume too many bytes. The row-count limitation is controlled by the MAX_ROWS_PER_CACHE_ENTRY nqsconfig.ini parameter. The default is 100,000 rows. The query result set max-bytes is controlled by the MAX_CACHE_ENTRY_SIZE nqsconfig.ini parameter. The default value is 1 MB. Note: the 1MB default is fairly small. Data typically becomes “bigger” when it enters OBIEE. This is primarily due to Unicode expansion of strings (a 2x or 4x multiplier). In addition to Unicode expansion, rows also get wider due to : (1) column alignment (typically double-word alignment), (2) nullable column representation, and (3) pad bytes.


Bad cache configuration: This should be rare, but if the MAX_CACHE_ENTRY_SIZE parameter is bigger than the DATA_STORAGE_PATHS specified capacity, then nothing can possibly be added to the cache.

Query execution is cancelled: If the query is cancelled from the presentation server or if a timeout has occurred, cache is not created.

OBIEE Server is clustered: Only the queries that fall under “Cache Seeding” family are propagated throughout the cluster. Other queries are stored locally. If a query is generated using OBIEE Server node 1, the cache is created on OBIEE Server node 1 and is not propagated to OBIEE Server node 2

Seeding / Filling the cache

  • Now why should you want to do that? OBIEE is not a database, so why would this be an advantage?
  • If you have a "slow” connection to your source database, maybe because it's on the other side of the world.
  • If you have "slow" aggregation views.
  • If you can "predict" what 90% percent of your queries look like .

From your user statistics you can pick up the top 10 of your queries, Check if you can make them "dynamic" by changing fixed date into dynamic dates.
Put the following in a .txt file in your maintenance directory.

// Load cache by Query
// John Minkjan CIBER Nederland
// FileName: LoadCache.txt
// executed by cmd string:
// nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s c:\obiee\mscripts\LoadCache.txt
// Query 1
SELECT TBLFUELCONSUMPTION.LICENSEPLATE, TBLFUELCONSUMPTION.MEASUREDATE, TBLFUELCONSUMPTION.FUELCONSUMPTION FROM Trucks WHERE TBLFUELCONSUMPTION.MEASUREDATE >= TIMESTAMPADD(SQL_TSI_YEAR, -2,NOW());

// Query 2
SELECT TBLFUELCONSUMPTION.LICENSEPLATE, TBLFUELCONSUMPTION.MEASUREDATE, TBLFUELCONSUMPTION.FUELCONSUMPTION FROM
Trucks WHERE TBLFUELCONSUMPTION.MEASUREDATE <= TIMESTAMPADD(SQL_TSI_YEAR, -3,NOW());

// The Queries are separated with a ;

Different ways to Manage Cache in OBIEE ( Part 1 )

Different ways to Manage Cache in OBIEE!!

Emptying/Purging the cacheOne of the most powerful features of OBIEE is the way it uses it's cache. Good cache management can really boost your performance. From the system management point of view there are a couple of tips and tricks to influence the cache performance.
For a customer I made a couple of handy scripts for handling the cache.

1. Purging the whole cache.

If you have a completed database reload or want to do some performance testing with your repository you might want to purge the whole cache.
Put the following in a .txt file in your maintenance directory
// Purge complete cache
// John Minkjan Ciber Nederland
// executed by cmd string:
// nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s

c:\obiee\mscripts\purgecompletecache.txt Call SAPurgeAllCache()

You can execute this from the commandline: nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s c:\obiee\mscripts\purgecompletecache.txt

2. Purging the cache by table

If you have a major update of your dimensional tables you might want to clear the cache for just one table.
Put the following in a .txt file in your maintenance directory:

// Purge complete cache
// John Minkjan Ciber Nederland
// FileName: PurgeTableCache.txt
// executed by cmd string:
// nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s
c:\obiee\mscripts\PurgeTableCache.txt

Call SAPurgeCacheByTable( 'JJMORCL_SH', NULL, 'SH', 'TBLTRUCKS' );

You can execute this from the commandline: nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s c:\obiee\mscripts\PurgeTableCache.txt

WOW: the database, schema, (catalog), and tablename are the names in OBIEE not in the database.

3. Purging the cache by query

Sometimes you only want to purge only "old" data from your cache.
Put the following in a .txt. file in your maintenance directory:

// Purge cache by Query
// John Minkjan Ciber Nederland
// FileName: PurgeQueryCache.txt
// executed by cmd string:
// nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s
c:\obiee\mscripts\PurgeQueryCache.txt

Call SAPurgeCacheByQuery('SELECT TBLFUELCONSUMPTION.LICENSEPLATE,
TBLFUELCONSUMPTION.MEASUREDATE, TBLFUELCONSUMPTION.FUELCONSUMPTION FROM Trucks
WHERE TBLFUELCONSUMPTION.MEASUREDATE <= TIMESTAMPADD(SQL_TSI_YEAR, -1,NOW())'); // The "query" line must be one contiues line! You can execute this from the commandline: nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s c:\obiee\mscripts\PurgeQueryCache.txt





WOW: the "query" is the OBIEE one not the database one!

4 Purging the cache by database

Put the following in a .txt. file in your maintenance directory:
// Purge cache by Database
// John Minkjan Ciber Nederland
// FileName: PurgeDataBaseCache.txt
// executed by cmd string:
// nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s
c:\obiee\mscripts\PurgeDataBaseCache.txt

Call SAPurgeCacheByDatabase( 'JJMORCL_SH' );

// The "dbName" is the OBIEE name!

You can execute this from the commandline: nqcmd -d AnalyticsWeb -u Administrator -p Administrator -s c:\obiee\mscripts\PurgeDataBaseCache.txt

Till Next Time

Purge Cache Automation in OBIEE 11g

Why do we Purge Cache Automatically?

The cache option in OBIEE 11g can help us to improve query performance greatly. But sometimes when we refresh the data mapping or reload the transaction data, the result over report will be out of date and not refreshed immediately due to cache. The best way is that we clear the cache after we loaded data or modified the RPD. I did some material research and came up with a solution to clear cache automatically – using scheduled tool on ETL server to invoke scripts after ETL load. I’d like to share the steps as following.

Step 1: Clear Cache on Oracle BI

OBIEE 11G has Oracle BI Server utilities nqcmd and NQClient to run test queries against the repository. We can use nqcmd command to clear OracleBIServer cache. The nqcmd utility is available both on Windows and UNIX systems. The syntax of nqcmd command is:
nqcmd -dmy_dsn -umy_username [-pmy_password] -ssql_input_file -omy_result_file
1)       Create a file called purgecache.txt and place it at[FMW_HOME]/instances/instance1/bifoundation/OracleBIApplication/coreapplication/setup
In the file, enter the code “call SAPurgeAllCache();” (without the quotes), which is a special BI Server command for clearing the entire cache.
2)       Create a shell script called purgecache.sh, place it in a directory where you store your custom scripts which includes the following commands. Note that there are some paths (in bi-init.sh) need to be set before you             run nqcmd which are in step 2. The purgecache.sh contains following commands.
  source /[FMW_HOME]/instances/instance1/bifoundation/OracleBIApplication/coreappli cation/setup/bi-init.sh
  [FMW_HOME]/Oracle_BI1/bifoundation/server/bin/nqcmd -d AnalyticsWeb -u administrator -p password -s                                                                                                         [FMW_HOME]/instances/instance1/bifoundation/OracleBIApplication/coreapplication/setup/purgecache.txt

Step 2: Clear Cache in Oracle Presentation Server

OBIEE 11G has a catalog manager command called “ClearQueryCache” to clear out the Presentation Server cache.
The syntax of ClearQueryCache command is:
runcat.cmd/runcat.sh -cmd clearQueryCache  -online <OBIPS URL> -credentials <credentials properties file>
1)       Create a catalog manager credential properties file. Open a text file and type the following entries.
login = <weblogic_admin_Username>
pwd = <weblogic_Admin_Userpassword>
And save in a directory with the file name as catmancredentials.properties.
2)       Open command prompt and navigate to <MW_HOME>instances\instance1\bifoundation\OracleBIPresentationServicesComponent\coreapplication_obips1\catalogmanager\
3)       Run the following command to clear OBIPS query cache:
runcat.sh -cmd clearQueryCache -online http://host:port/analytics/saw.dll?-credentials catmancredentials.properties

Step 3: Enable Passwordless Login Option between DAC and OBI Servers

1)        Login into server x.x.x.x as user oracle and generate a pair of public keys using following command.
            ssh-keygen -t rsa
2)       Use SSH from server x.x.x.1 (DAC server) to connect server x.x.x.2 (OBI server), use oracle as user and create .ssh directory under it, use following command.
            ssh oracle@x.x.x.1 mkdir -p .ssh
3)       Use SSH from server x.x.x.2 and upload new generated public key (id_rsa.pub) on server x.x.x.1 under oracle‘s .ssh directory as a file name authorized_keys.
cat .ssh/id_rsa.pub | ssh oracle@x.x.x.x.2 ‘cat >> .ssh/authorized_keys’
4)       Due to different SSH versions on servers, we need to set permissions on .ssh directory and authorized_keys file.
           ssh oracle@x..x.x.1 “chmod 700 .ssh; chmod 640 .ssh/authorized_keys”

Step 4: Invoke the PurgeCache script from DAC Server

1)       Create the NEW ITEM in the TASK TAB in the DESIGN, input TASK NAME, COMMAND FOR INCREMENTAL LOAD, COMMAND FOR FULL LOAD, TASK PHASE, EXECUTION TYPE and EXECUTING PRIORITY.
EXAMPLE FOR CLEAR OBIEE CACHE:
NAME: Clear OBIEE Cache
COMMAND FOR INCREMENTAL LOAD:  sh  XXX.sh
COMMAND FOR FULL LOAD: sh  XXX.sh
TASK PHASE: post ETL process
EXECUTION TYPE: External Program
EXECUTING PRIORITY: 5
2)       Add the NEW TASK in the following tasks in the EXECUTION PLAN.
Following tasks means the tasks which will be executed after the execution plan is done.
3)       Create EXECUTION PLAN

OBIEE 11g OBI Server and Presentation Cache Management

OBIEE 11g OBI Server and Presentation Cache Management


Oracle BI Server Cache Management

  • BI server could be leveraged by multiple users and reports depending on whether they are accessing similar or subset of the cached data, though from a different reports.
  • To purge OBI Server cache the best-practice is to set it as automated process after completing ETL, because if we set the auto-purge at specified time, but for some reason ETL fails, the BI Server cache gets purged and all user queries will have to get executed all over, which will impact the BI Server performance.
  1. To complete this task, please follow these steps:
  2. Create a text file called: PurgeAllCache.txt and save it in C:\ (easier to remember)
  3. Open and type the following: Call SAPurgeAllCache()
  4. Save and Close.
  5. Create another text file called: PurgeCache.txt (we will later convert this file into batch file .bat) and save it in C:\
  6. Go to: \Oracle_BI\bifoundation\server\bin\nqcmd.exe and make sure you see the file DO NOT run it.
  7. Copy and paste the nqcmd.exe file directory somewhere temporary
    1. This is a ODBC client that runs commands
  8. Now, go to: Start > All Programs > Administrative Tools > Data Sources (ODBC)
  9. Click on System DSN tab and locate Oracle BI Server 11g_XXXXX > click on Configure…
  10.  
  11. Copy and paste the Name: with nqcmd.exe file path for now. The ODBC name in this case is:coreapplication_OH905911364
  12.  
  13. Cancel to close Oracle BI Server and ODBC windows.
  14. Open PurgeCache.txt and type the following:
    1. Echo off
    2. \Oracle_BI\bifoundation\server\bin\nqcmd.exe -d coreapplication_905911364 -u weblogic -p password -s C:\PurgeAllCache.txt
      1. Make sure this command is ALL IN ONE LINE
    3. Echo 
  • Explnation:
    • \Oracle_BI\bifoundation\server\bin\nqcmd.exe [nqcmd.exe file path]
    • -d coreapplication_905911364 [my DSN ODBC name]
    • -u weblogic [-u BI Admin Username]
    • -p password [-p BI Admin Password]
    • -s C:\PurgeAllCache.txt [-s SQL Input File to execute]
  1. Save and Close. 
  2. Change PurgeCache.txt into PurgeCache.bat this will convert the file into executable file. 
  3. Now run couple of analysis in OBIEE. 
  4. Open the RPD in an Online mode:
  5. Go to: Manage > Cache - and you'll see recent saved cache.
  6. Now run PurgeCache.bat and recheck the RPD Cache, you will see that it is cleaned :).
  

Oracle BI Presentation Cache Management

  • When users run analyses, Presentation Services can cache the results of those analyses. Presentation Services determines if subsequent analyses can use cached results. If the cache can be shared, then subsequent analyses are not stored.
  • The files for the Presentation Services cache have names such as nQS_xxxx_x_xxxxxx.TMP.
  • The files are created by the ODBC driver but generally do correspond to ODBC requests that the Presentation Services cache keeps open. The files are stored in the following directory: 
    •  ORACLE_INSTANCE\tmp\OracleBIPresentationServices\coreapplication_obipsn\obis_temp
  • The files for the cache are removed whenever Presentation Services shuts down cleanly. If Presentation Services shuts down unexpectedly, then various cache files might be left on disk. You can delete the files when Presentation Services is not running.
  • The Presentation Services cache is not the same cache that is accessed by the Oracle BI Server. You can change the defaults for the Presentation Services cache by modifying the instanceconfig.xml file to include the cache entries.
    • i.e. if the requirement is to set the cache to expire every 15 minutes; open to edit the instanceconfig.xml for OBI Presentation Services and add the following : 
    • Your code should look like this:
       
    • Save and Close the file.

Alternative Cache Management Techniques

  • Open  BI Administration Tool > Open the RPD
  • Go to: Physical table properties
  • Check: Checkeable and choose as appropriate
    • Cache never expires - self-explanatory
    • Cache persistence time - specify how often the table should purge the cache
      • Note: this implies only to this table and is not the best-techniques when you are working with 100s of tables.