Cognos Analytics

Cognos Analytics

Connect, learn, and share with thousands of IBM Cognos Analytics users! 

 View Only
  • 1.  SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 5 days ago

    Re: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Is the data I am looking for even in the CM database? If so, what table is it in and what SQL would I use to extract the data?



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------


  • 2.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 4 days ago

    Hello Brenda,

    You can generate the SQL script and obtain thus required DDL which shows the CM  table creation,

    Using the Content Manager Generate DDL submenu of the Data Access sub-node.

    I have a full description of this on page 124 in my book, "Installation, Upgrade and Configuration of

    IBM Cognos Analytics " see https://amzn.eu/d/8W004cU



    ------------------------------
    Aaalan S Bluck
    Director
    ASB Software Development Limited
    Ringwood, Hampshire, England
    0044 7710612479
    ------------------------------



  • 3.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 4 days ago

    I can script out the CM Database. I am looking specifically for "last time Report Ran and Report Execution Time". You book will tell me how to extract this information from the CM Database?



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------



  • 4.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 4 days ago
    Hi Brenda,
    On page 125 in the book, I display the Linux path I found, using the resulting createDb.sql DDL output  in :
    (/opt/ibm/cognos/analytics114/configuration/schemas/content/db2 ).

    This procedure I outlined should have been used by your current version of Cognos on your system to create the CM database.
    (I used Cognos version 11.1.4, in November 2019, so the actual table structures have altered now, depending on which Cognos version you currently use, but note this DDL is dated from 2008, so maybe not much will have changed!).


    The DDL which was created, was used by me to actually create a Cognos DB2 database using the Linux commands :
    su  - db2inst1
    db2 -tvf /opt/ibm/cognos/analytics114/configuration/schemas/content/db2/createDb.sql 
    This SQL, listed as below,  just creates the main users and tablespaces, so is just the starting point.
    If you have IBM Data Studio 4.1.2 (or similar version), you can load the DB2 Database 

    (NOTE: After an upgrade of DB2 you may have to upgrade the cm database using:
    [db2inst1@ECMUKDEMO6 ~]$ db2 upgrade database cm
    DB20000I  The UPGRADE DATABASE command completed successfully.
    [db2inst1@ECMUKDEMO6 ~]$ )

    The IBM Data Studio 4.1.2 can be used to connect to the Cognos  cm  database :
    image.png
    In the above, the server name I use is ecmukdemo6 and the port is set as 50000 , so your database admin should be able to tell you what to use instead of this.
    To set up an Audit database (if you haven't already got one) , the following youtube video should help:


    You may also find the link as follows useful:
    Which does indicate that there have been a few changes:
    As of Cognos Analytics 11.1.7, the Audit Database has grown to 21 table"
    and

    "The key tables most administrators will be interested in are the 6 tables which log the user activity and reporting activity in the system.

    • COGIPF_USERLOGON : Stores user logon (including log off) information
    • COGIPF_RUNREPORT : Stores information about report executions
    • COGIPF_VIEWREPORT : Stores information about report view requests
    • COGIPF_EDITQUERY : Stores information about query runs
    • COGIPF_RUNJOB : Stores information about job requests
    • COGIPF_ACTION : Records user actions in Cognos (this table may grow much more rapidly than the others) "
    As I mentioned above, the DDL I mentioned as the SQL as follows:
    --
    -- US Government Users Restricted Rights - Use, duplication or disclosure
    -- restricted by GSA ADP Schedule Contract with IBM Corp.

    -- Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
    -- Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).

    -- Use this template to create the IBM Cognos content database. Replace these variables:
    -- cm : Database name
    -- db2inst1 : User ID, this account is used by the product to connect to the content store
    -- This script must be run as a user that has sufficient privileges to access and create the database.
    -- The database user account needs to exist for the product to function.

    CREATE DATABASE cm AUTOMATIC STORAGE YES ALIAS cm USING CODESET UTF-8 TERRITORY US COLLATE USING SYSTEM PAGESIZE 8192;
    CHANGE DATABASE cm COMMENT WITH 'IBM Cognos Content Store';
    CONNECT TO cm;
    UPDATE DATABASE CONFIGURATION USING APPLHEAPSZ 1024 DEFERRED;
    UPDATE DATABASE CONFIGURATION USING LOCKTIMEOUT 240 DEFERRED;
    CONNECT RESET;

    CONNECT TO cm;
    CREATE BUFFERPOOL cm_08KBP IMMEDIATE SIZE 1000 PAGESIZE 8K;
    CREATE BUFFERPOOL cm_32KBP IMMEDIATE SIZE 1000 PAGESIZE 32K;
    CONNECT RESET;

    CONNECT TO cm;
    CREATE SYSTEM TEMPORARY TABLESPACE TSN_SYS_cm IN DATABASE PARTITION GROUP IBMTEMPGROUP PAGESIZE 32K BUFFERPOOL cm_32KBP;
    CREATE USER TEMPORARY TABLESPACE TSN_USR_cm IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8K BUFFERPOOL IBMDEFAULTBP;
    CREATE REGULAR TABLESPACE TSN_REG_cm IN DATABASE PARTITION GROUP IBMDEFAULTGROUP PAGESIZE 8K BUFFERPOOL cm_08KBP;
    DROP TABLESPACE USERSPACE1;
    CONNECT RESET;

    CONNECT TO cm;
    CREATE SCHEMA db2COGNOS AUTHORIZATION db2inst1;
    COMMENT ON SCHEMA db2COGNOS IS 'IBM Cognos Content Store';
    GRANT CREATETAB,BINDADD,CONNECT,IMPLICIT_SCHEMA ON DATABASE  TO USER db2inst1;
    GRANT CREATEIN,DROPIN,ALTERIN ON SCHEMA DB2COGNOS TO USER db2inst1;
    GRANT USE OF TABLESPACE TSN_USR_cm TO USER db2inst1;
    GRANT USE OF TABLESPACE TSN_REG_cm TO USER db2inst1;
    CONNECT RESET;

    Hope this helps,

    Alan

    Alan S Bluck,
    (IBM Champion (2025),
    IBM Champion (2024),
    IBM Champion (2023),
    IBM Champion (2022)
    IBM Silver level PartnerWorld Business Partner,
    RedHat Accredited Business Partner,
    Director, ASB Software Development Limited)







  • 5.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 3 days ago

    @Alan S Buck - You did not answer my question. I am looking specifically for the SQL to extract from the CM Database (Not the Audit/Log database) "last time Report Ran and Report Execution Time". I don't see how anything you have posted would help me with that. I am looking for specific table names, column names, SQL queries. 



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------



  • 6.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 3 days ago

    Hi,

    I don't think IBM recommends direct query. But they do provide sample package to work with. You can find this in your install directory under the deployment folder.

     

    Diego Ferrara
    Technical Service Team Leader | Almac Clinical Technologies

    Partnering to Advance Human Health

    T: +1 215 660 8520 Ext:21238
    M: 2674162223
    E: Diego.Ferrara@almacgroup.com
    1690 Sunneytown Pike | Lansdale | PA 19446 | United States of America

    www.almacgroup.com

     

    IXRS 3






  • 7.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 3 days ago
    Well, my first post referenced the IBM Data Studio 4.1.2, which allows you to browse all the tables of the CM database, so if this database was designed to be accessed by end-users, I think it would have meaningful field names. I had a look myself today and the fields  are clearly not designed to be easily accessed by end users for useful output!

    As I tried to indicate in my second post (including  with two references), generally the Audit database is where the report logging is held and IBM's SQL script to build these tables is held on the RedHat Linux systems in  the initial install path (even after an upgrade) on my system, at:
     /opt/ibm/cognos/analytics114/configuration/schemas/logging/db2/LS_dbInit_db2.sql

    I suspect, having also seen your post of Wednesday February 12, 2025 04:15 PM, that the CM database, which you have obviously used before, is not easily  accessible for the fields you are asking about?

    As the following extracted SQL example shows from LS_dbInit_db2.sql, the Audit logging Database does have meaningful field names for the tables:

    create table  COGIPF_RUNREPORT ( 
             COGIPF_HOST_IPADDR             varchar (128),
             COGIPF_HOST_PORT               integer,
             COGIPF_PROC_ID                 integer,
             COGIPF_LOCALTIMESTAMP          timestamp,
             COGIPF_TIMEZONE_OFFSET         integer,
             COGIPF_SESSIONID               varchar (255),
             COGIPF_REQUESTID               varchar (255) not null,
             COGIPF_STEPID                  varchar (255),
             COGIPF_SUBREQUESTID            varchar (255),
             COGIPF_THREADID                varchar (255),
             COGIPF_COMPONENTID             varchar (64),
             COGIPF_BUILDNUMBER             integer,
             COGIPF_LOG_LEVEL               integer,
             COGIPF_TARGET_TYPE             varchar (255),
             COGIPF_REPORTPATH              varchar (1024),
             COGIPF_STATUS                  varchar (255),
             COGIPF_ERRORDETAILS            varchar (2000),
             COGIPF_RUNTIME                 integer,
             COGIPF_REPORTNAME              varchar (512),
             COGIPF_PACKAGE                 varchar (1024),
             COGIPF_MODEL                   varchar (512)
    );

    Alan S Bluck,

    (IBM Champion (2025),
    IBM Champion (2024),
    IBM Champion (2023),
    IBM Champion (2022)
    IBM Silver level PartnerWorld Business Partner,
    RedHat Accredited Business Partner,
    Director, ASB Software Development Limited)







  • 8.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 3 days ago

    i don't have the audit/log database, just the cm database. 



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------



  • 9.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 3 days ago

    Hi,

    It is possible you didn't split out the Audit and Notification tables into their own DB. By default this is all in one DB. But It does make things easier to maintain when you split out the different DB connections. You can see this in the configuration of Cognos.

    Assuming you have one DB for Cognos You should still have the same tables.

     

    Table: cogipf_runreport

    Table for who rant it: COGIPF_USERLOGON

     

    SELECT

    CASE

                                    WHEN "CR"."cogipf_reportname" IS NULL

                                                    THEN 'Unsaved report'

                                    WHEN "CR"."cogipf_reportname" = ''

                                                    THEN 'Unsaved report'

                                    WHEN SUBSTRING("CR"."cogipf_reportname", 1, 10) = 'ReportView'

                                                    THEN SUBSTRING("CR"."cogipf_reportname", 19, LEN("CR"."cogipf_reportname") - 20)

                                    WHEN SUBSTRING("CR"."cogipf_reportname", 1, 6) = 'report'

                                                    THEN SUBSTRING("CR"."cogipf_reportname", 15, LEN("CR"."cogipf_reportname") - 16)

                                    WHEN SUBSTRING("CR"."cogipf_reportname", 1, 5) = 'query'

                                                    THEN SUBSTRING("CR"."cogipf_reportname", 14, LEN("CR"."cogipf_reportname") - 15)

                                    ELSE 'Unsaved report'

                                    END COLLATE database_default AS ReportName

                    ,CR.COGIPF_LOCALTIMESTAMP as RunDateTime

                    ,FORMAT(CR.COGIPF_LOCALTIMESTAMP, 'MM/dd/yyyy') AS RunDate

                    ,CR.COGIPF_STATUS

                    ,CR.COGIPF_RUNTIME

                    , CR.COGIPF_RUNTIME/1000 as 'RunTime(Seconds)'

                    ,(CR.COGIPF_RUNTIME/1000 )/60 as 'RunTime(minutes)'

                    ,CR.COGIPF_ERRORDETAILS

                    ,CR.COGIPF_REPORTPATH

                    ,cu.COGIPF_CAMID

                    ,cu.COGIPF_CAMID as UserID

                    ,cu.cogipf_username

    FROM <YOURDB>.dbo.cogipf_runreport AS "CR" WITH (NOLOCK)

    INNER JOIN <YOURDB>.dbo.COGIPF_USERLOGON AS CU WITH (NOLOCK)

                    ON cr.cogipf_sessionid = cu."cogipf_sessionid"

    WHERE CR.COGIPF_LOCALTIMESTAMP > getdate() - 1

    order by CR.COGIPF_LOCALTIMESTAMP desc

     

    Diego Ferrara
    Technical Service Team Leader | Almac Clinical Technologies

    Partnering to Advance Human Health

    T: +1 215 660 8520 Ext:21238
    M: 2674162223
    E: Diego.Ferrara@almacgroup.com
    1690 Sunneytown Pike | Lansdale | PA 19446 | United States of America

    www.almacgroup.com

     

    IXRS 3






  • 10.  RE: SQL to read Content Manager database (not Audit/Log) for last time Report Ran and Report Execution Time

    Posted 3 days ago

    None of our 300+ CM databases contain COGIPF% table names. The tables are in our audit/log database. I don't know what you are referring to "It is possible you didn't split out the Audit and Notification tables into their own DB. By default this is all in one DB. " could you point me to an IBM reference?



    ------------------------------
    brenda grossnickle
    BI Programmer Analyst
    FIS
    ------------------------------