问题描述
在IBM DB2中有没有办法从特定的时间戳中获取已更改(更新/添加/删除)的表的列表?
Is there any way in IBM DB2 to get the list of tables which have been changed(updated/added/deleted) since a specific timestamp?
问题我我正在面对的是,我已经在7月25日从Live db服务器的一个框中恢复了一个备份,并更新了这个恢复的DB,同时启用了功能包。现在的DB服务器已经改变,因为客户访问它,我无法恢复最新的备份,因为box1有一些附加表/数据。
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.
推荐答案
如果您在DB2 for Linux / Unix / Windows上,此查询应该得到什么您需要:
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.
这篇关于获取自20120801185856时间戳以来特定时间戳记以来已更改的db2表的列表的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!