Hello
Below is SQL we use against our Oracle audit database. We are at version 11.1.7. Hope it helps. The formatting (indendation) was lost when I cut and pasted into the IBM's site used to email the listserv. Sorry. It would make things easier to understand. The query returns username, userid, latest_report_name, latest_report_package, latest_report_package_path, latest_report_path, latest_rpt_execution_date, num_report_executions.
Michael Sullivan
North Shore Community College
SELECT logons.cogipf_username username,
logons.cogipf_userid userid,
SUBSTR(rpts.cogipf_reportname,
INSTR(rpts.cogipf_reportname,CHR(39)) + 1, -- start after first quote or at position one if is not a quote
CASE -- go for entire length if is no second quote
WHEN INSTR(rpts.cogipf_reportname,CHR(39),1,1) = 0 -- otherwise go for entire length to second quote minus one minus length to first quote
THEN LENGTH(rpts.cogipf_reportname)
ELSE INSTR(rpts.cogipf_reportname,CHR(39),1,2) - 1 - INSTR(rpts.cogipf_reportname,CHR(39),1,1)
END) latest_report_name,
CASE
WHEN INSTR(rpts.cogipf_package,'package[@name=' || CHR(39)) <> 0
THEN SUBSTR(rpts.cogipf_package,
INSTR(rpts.cogipf_package,'package[@name=' || CHR(39)) + 15,
INSTR(rpts.cogipf_package,CHR(39),INSTR(rpts.cogipf_package,'package[@name=' || CHR(39)) + 15)
- (INSTR(rpts.cogipf_package,'package[@name=' || CHR(39)) + 15))
WHEN INSTR(rpts.cogipf_package,'module[@name=' || CHR(39)) <> 0
THEN SUBSTR(rpts.cogipf_package,
INSTR(rpts.cogipf_package,'module[@name=' || CHR(39)) + 14,
INSTR(rpts.cogipf_package,CHR(39),INSTR(rpts.cogipf_package,'module[@name=' || CHR(39)) + 14)
- (INSTR(rpts.cogipf_package,'module[@name=' || CHR(39)) + 14))
ELSE NULL
END latest_report_package,
rpts.cogipf_package latest_report_package_path,
rpts.cogipf_reportpath latest_report_path,
MAX(TO_CHAR(rpts.cogipf_localtimestamp,'YYYYMMDD HH24MISS')) latest_rpt_execution_date,
COUNT(*) num_report_executions
FROM cogipf_userlogon logons,
cogipf_runreport rpts
WHERE logons.cogipf_logon_operation = 'Logon'
AND logons.cogipf_status = 'Success'
AND logons.cogipf_sessionid = rpts.cogipf_sessionid (+)
AND rpts.cogipf_status (+)= 'Success'
GROUP BY
logons.cogipf_username,
logons.cogipf_userid,
SUBSTR(rpts.cogipf_reportname,
INSTR(rpts.cogipf_reportname,CHR(39)) + 1, -- start after first quote or at position one if is not a quote
CASE -- go for entire length if is no second quote
WHEN INSTR(rpts.cogipf_reportname,CHR(39),1,1) = 0 -- otherwise go for entire length to second quote minus one minus length to first quote
THEN LENGTH(rpts.cogipf_reportname)
ELSE INSTR(rpts.cogipf_reportname,CHR(39),1,2) - 1 - INSTR(rpts.cogipf_reportname,CHR(39),1,1)
END),
CASE
WHEN INSTR(rpts.cogipf_package,'package[@name=' || CHR(39)) <> 0
THEN SUBSTR(rpts.cogipf_package,
INSTR(rpts.cogipf_package,'package[@name=' || CHR(39)) + 15,
INSTR(rpts.cogipf_package,CHR(39),INSTR(rpts.cogipf_package,'package[@name=' || CHR(39)) + 15)
- (INSTR(rpts.cogipf_package,'package[@name=' || CHR(39)) + 15))
WHEN INSTR(rpts.cogipf_package,'module[@name=' || CHR(39)) <> 0
THEN SUBSTR(rpts.cogipf_package,
INSTR(rpts.cogipf_package,'module[@name=' || CHR(39)) + 14,
INSTR(rpts.cogipf_package,CHR(39),INSTR(rpts.cogipf_package,'module[@name=' || CHR(39)) + 14)
- (INSTR(rpts.cogipf_package,'module[@name=' || CHR(39)) + 14))
ELSE NULL
END,
rpts.cogipf_package,
rpts.cogipf_reportpath
------------------------------
Michael Sullivan
------------------------------
Original Message:
Sent: Tue March 08, 2022 12:16 PM
From: Ralf Roeber
Subject: Listing Who and When Reports Were Last Run
Hi Eli,
>if there are ways to use the SDK to accomplish this task, would you kindly send me the solution
I can offer you a step towards solving your problem. Not the solution itself.
The Cognos base object from the searchpath query, e.g. //report contains what you are looking for, depending on the QueryProps you set. In general the information is there, i can confirm that.
I posted on the solution [SDK] Cognos Configuration and Automation.
If you need help to implement, feel free to create an issue for that on github and I would be more then happy to have a look.
I would be interested to implement a generic way of asking for ContentStore objects, if there was more need for such.
Hth.
Ralf
------------------------------
Ralf Roeber
https://linkedin.com/in/ralf-roeber-470425a/
Original Message:
Sent: Wed March 02, 2022 03:31 PM
From: Elihu El
Subject: Listing Who and When Reports Were Last Run
Good Afternoon,
I hope that your day is going well. I would like to generate a list of reports along with various attributes such as Last Run Date, Last Run User, etc. Here is the SQL that I have so far:
select * from CMOBJECTS as CO
inner join CMOBJECTS as CO2 on CO2.PCMID = CO.CMID
inner join CMOBJNAMES as CON on CON.CMID = CO.CMID
inner join CMOBJPROPS7 as CO7 on CO7.CMID = CO.CMID
where
(CO.classid = 10 or CO.classid = 209)
I do not want Auditing turned on. However, if there are ways to use the SDK to accomplish this task, would you kindly send me the solution. Thanks.
If you have any questions, call me at 410-312-8822.
Warm Regards,
Eli
#CognosAnalyticswithWatson