Add the name of the report to the SQL queries sent to the database

Product:

Cognos BI 10.2.1 server

Windows 2008 R2 Server

Oracle database

Problem:

You have a report that take out all power of the database server, but you do not know that name of the report.

 Suggested Solution:

Add the name of the report to the SQL queries sent to the Oracle database, then the Database DBA can look into the trace of the queries and see what report give the issue.

On the Cognos BI server open the file CQEConfig.xml

Can be found in folder c:\Program Files\ibm\cognos\c10_64\configuration

Change to have this content;

 

<?xml version=”1.0″ encoding=”UTF-8″?>

<!–

Licensed Materials – Property of IBM

BI and PM: QECL

(C) Copyright IBM Corp. 2005, 2012

US Government Users Restricted Rights – Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.

–>

<configuration company=”Cognos” version=”0.1″ rendition=”cer2″>

<component name=”CQE”>

<section name=”DBConnectionPool”>

<!– Description: Database connection timeout. Default is 900 seconds (15 minutes) –>

<entry name=”Timeout” value=”900″/>

<!– –>

<!– Description: Database connection pool size. –>

<!– Maximum number of connections managed by the report server process. Default=40 –>

<entry name=”PoolSize” value=”40″/>

<!– –>

</section>

<section name=”QueryEngine”>

<!– Description: queryReuse feature –>

<!– value=”0″ means disable the feature –>

<!– default is value=”5″ which means cache up to 5 result sets per session –>

<entry name=”queryReuse” value=”5″/>

<!– –>

<!– Description: References to model query items may have 2-part names. (default(off)=0; choices=0,1) –>

<!– Off:  A parsing error is returned for a reference to a model query item using a 2-part name.  –>

<!– On:  The expression resolver will allow 2-part name references to model query items.    –>

<!– NOTE: Cognos 8.1 MR2 was the last release in which the default setting allowed 2-part names. This release (8.2) –>

<!– has the default set to disallow 2-part names. The next release (8.3) will no longer allow 2-part names. –>

<!– The use of 2-part names will generate the QE-DEF-496 warning message in the log file. –>

<!– entry name=”AllowModelQueryItem2PartNameReference” value=”0″/–>

<!– –>

<!– Generation of comments in native sql and cognos sql.–>

<entry name=”GenerateCommentInNativeSQL” value=”1″/>

<!– ( default(off)=0, on=1) –>

<entry name=”GenerateCommentInCognosSQL” value=”1″/>

<!– ( default(off)=0, on=1) –>

<!– The content of the comments is controlled with two entries, their defaults are specified in the value attribute –>

<entry name=”NativeCommentMacro” value=”#’ user=’ + $account.defaultName + ‘ report=’ + $report + ‘ reportPath=’ + $reportPath + ‘ queryName=’ + $queryName + ‘ start=’ + $startTime#”/>

<entry name=”CognosCommentMacro” value=”#’ user=’ + $account.defaultName + ‘ report=’ + $report + ‘ reportPath=’ + $reportPath + ‘ queryName=’ + $queryName + ‘ start=’ + $startTime#”/>

<!– –>

<!– Description: Include the preferred query subject into the join cache key –>

<!– ( default(off)=0, on=1) –>

<!–entry name=”IncludePreferredQuerySubjectsInJoinCacheKey” value=”1″/–>

<!– –>

<!– Description: Compute measure query items just once (off(default)=0, on=1+ –>

<!– entry name=”ComputeMeasureQueryItemsOnce” value=”0″ –>

<!– –>

</section>

<!– The following section is disabled by default.    –>

<!– The CQE logging is turned on when the existing section name (“_Logging”) is changed to “Logging”. –>

<section name=”_Logging”>

<entry name=”CQEXMLAPI” value=”3″/>

<entry name=”UseIPFLogging” value=”0″/>

<entry name=”QueryEngine” value=”11″/>

<entry name=”LogFileName” value=”..\logs\CQE.log”/>

<entry name=”QR” value=”3″/>

<entry name=”DBC” value=”11″/>

<entry name=”JoinPath” value=”11″/>

</section>

</component>

</configuration>

 

Will give that you have

–         Username

–         Report name

–         Report path

–         Query name

–         Start time

In the Query.

 

More Information:

http://www-01.ibm.com/support/knowledgecenter/#!/SSMR4U_10.1.0/com.ibm.swg.ba.cognos.ug_cra.10.1.1.doc/t_add_comments_native_cognossql.html%23Add_Comments_Native_CognosSQL

https://www.ibm.com/docs/en/cognos-analytics/11.1.0?topic=database-using-application-context-in-dynamic-sql

To use comments in SQL for dynamic query mode (for CA11.1.x) you can configure the xqe.config.xml file, located in install_location/configuration.

You edit the following elements in the <queryPlanning> element.

<generateCommentsInNativeSQL enabled="true"/>
<NativeCommentMacro value="#'user=' + $account.defaultName + ' reportPath='
 + $reportPath +' queryName=' + $queryName + ' REMOTE_ADDR=' + $REMOTE_ADDR 
 + ' SERVER_NAME=' + $SERVER_NAME + ' requestID=' + $requestID#"/>