get the list of db2 tables which have been changed since a particular timestamp say since 20120801185856 timestamp

10,988

If you're on DB2 for Linux/Unix/Windows, this query should get what you need:

SELECT TRIM(TABSCHEMA) || '.' || TRIM(TABNAME),
       MAX(CREATE_TIME,ALTER_TIME)
FROM SYSCAT.TABLES
ORDER BY 2 DESC

If you're on the mainframe, this one should do you:

SELECT RTRIM(CREATOR) || '.' || RTRIM(NAME),
       MAX(CREATEDTS,ALTEREDTS)
FROM SYSIBM.SYSTABLES
ORDER BY 2 DESC

However, neither of these will show deleted tables, as they're removed from the system catalog when they are dropped.

Share:
10,988
Hari Om Misra
Author by

Hari Om Misra

Updated on June 04, 2022

Comments

  • Hari Om Misra
    Hari Om Misra almost 2 years

    Is there any way in IBM DB2 to get the list of tables which have been changed(updated/added/deleted) since a specific timestamp?

    The problem i am facing is i have restored one backup on 25 July in one box from live db server and updated this restored DB while enabling features packs. Now the live DB server has changed since customer is accessing it and i cannot restore the latest backup as box1 have some addition tables/data.

    So i wanted to know the list of tables which have been changed since last backup so that i can update those tables manually. Please help.