Sunday, 30 January 2011

Get logs From IBM DB2 database

Notification messages written after the
timestamp (example '2010-10-10', '00.00.00')
SELECT dbname,
msgseverity
FROM TABLE (PD_GET_LOG_MSGS(TIMESTAMP('2010-10-10', '00.00.00'))) AS testlog
ORDER BY TIMESTAMP;


Notification messages written in last week
SELECT instancename,
dbpartitionnum,
dbname,
msgtype
FROM TABLE(PD_GET_LOG_MSGS(current_timestamp - 7 days)) AS testlog
ORDER BY TIMESTAMP;


Get critical log messages logged last 24 hours
SELECT timestamp,
instancename,
dbname,
appl_id,
msg
FROM SYSIBMADM.PDLOGMSGS_LAST24HOURS WHERE msgseverity = 'C'
ORDER BY TIMESTAMP DESC;


msgseverity WARNINGS is 'W' AND ERRORS is 'E'

No comments: