| |
|
If this is your first visit, be sure to check out the FAQ by clicking the link above.
You may have to register before you can post: click the register link above to proceed.
To start viewing messages, select the forum that you want to visit from the selection below.
|
 |

04-26-10, 09:08
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 8
|
|
|
alter tables list
|
|
hi ALL
is it possible to get the list of tables that has altered using "ALTER TABLE" command.
|
|

04-26-10, 13:02
|
|
Registered User
|
|
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
|
|
You can select all tables from the DB2 catalog where the create-timestamp differs from the alter timestamp. Have a look at SYSCAT.TABLES and columns CREATE_TIME and ALTER_TIME. On DB2 z/OS, you would use SYSIBM.SYSTABLES and columns CREATEDTS and ALTEREDTS.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
|
|

04-26-10, 13:03
|
|
Registered User
|
|
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
|
|
|
|
Quote:
Originally Posted by arun-dba
hi ALL
is it possible to get the list of tables that has altered using "ALTER TABLE" command.
|
probably db2look -d db_name -e -o outfile
and then look for ALTER in the outfile.sql
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
|
|

04-27-10, 14:57
|
|
Registered User
|
|
Join Date: Nov 2005
Location: IL
Posts: 554
|
|
Markham
Alter table statements are not produced with db2look. Only exception is for creation of a PK.
Once you alter table to add a col or change data type it becomes part of its ddl and future db2look attempts will show this change as part of a regular ddl.
Knut,
That is only for 9.5 and above. Correct?
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
DB2 v9.1.0.2 os 5.3.0.0
|
|

04-27-10, 15:29
|
|
Registered User
|
|
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
|
|
Quote:
Originally Posted by Cougar8000
Markham
Alter table statements are not produced with db2look. Only exception is for creation of a PK.
Once you alter table to add a col or change data type it becomes part of its ddl and future db2look attempts will show this change as part of a regular ddl.
Knut,
That is only for 9.5 and above. Correct?
|
i stand corrected.
though i see
ALTER TABLE "DBA "."tab_name" PCTFREE 10;
statements in db2look output.
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
|
|

04-27-10, 15:36
|
|
Registered User
|
|
Join Date: Nov 2005
Location: IL
Posts: 554
|
|
right, but you wont see any structural changes.
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
DB2 v9.1.0.2 os 5.3.0.0
|
|

04-28-10, 08:27
|
|
Registered User
|
|
Join Date: Dec 2008
Location: Toronto, Canada
Posts: 381
|
|
Quote:
Originally Posted by Cougar8000
right, but you wont see any structural changes.
|
you are absolutely right
__________________
DB2 v9.5 ESE on AIX v6.1/ v9./10 on z/OS
|
|

04-28-10, 10:10
|
|
Registered User
|
|
Join Date: Jan 2009
Posts: 8
|
|
thanks Stolze.
i got is from syscat.tables and column name ALTER_TIME.
|
|

04-28-10, 17:03
|
|
Registered User
|
|
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
|
|
Quote:
Originally Posted by Cougar8000
That is only for 9.5 and above. Correct?
|
No, the timestamps to track the last table alteration are available in DB2 for a long time already. Such information is needed, for example, to rebind packages in case a table has changed.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
|
|

04-29-10, 09:34
|
|
Registered User
|
|
Join Date: Nov 2005
Location: IL
Posts: 554
|
|
I am not seeing it in 9.1 nor in 9.1 manuals. Do I have a stolen version  or it is in another place?
__________________
--
IBM Certified DBA on DB2 for Linux, UNIX, and Windows
DB2 v9.1.0.2 os 5.3.0.0
|
|

04-29-10, 16:46
|
|
∞∞∞∞∞∞
|
|
Join Date: Aug 2008
Location: Toronto, Canada
Posts: 1,816
|
|
Looks like it alter_time was added in v9.5
From v9.1:
$ db2 "describe select * from sysibm.systables" | grep -i time
392 TIMESTAMP 26 CTIME 5 0 SYSIBM .TIMESTAMP 18
393 TIMESTAMP 26 STATS_TIME 10 0 SYSIBM .TIMESTAMP 18
393 TIMESTAMP 26 REFRESH_TIME 12 0 SYSIBM .TIMESTAMP 18
393 TIMESTAMP 26 LAST_REGEN_TIME 15 0 SYSIBM .TIMESTAMP 18
392 TIMESTAMP 26 INVALIDATE_TIME 15 0 SYSIBM .TIMESTAMP 18
From v9.5:
$ db2 "describe select * from sysibm.systables" | grep -i time
392 TIMESTAMP 26 CTIME 5 0 SYSIBM 6 TIMESTAMP 9
393 TIMESTAMP 26 STATS_TIME 10 0 SYSIBM 6 TIMESTAMP 9
393 TIMESTAMP 26 REFRESH_TIME 12 0 SYSIBM 6 TIMESTAMP 9
393 TIMESTAMP 26 LAST_REGEN_TIME 15 0 SYSIBM 6 TIMESTAMP 9
392 TIMESTAMP 26 INVALIDATE_TIME 15 0 SYSIBM 6 TIMESTAMP 9
392 TIMESTAMP 26 ALTER_TIME 10 0 SYSIBM 6 TIMESTAMP 9
|
|

04-30-10, 09:32
|
|
Registered User
|
|
Join Date: Jan 2007
Location: Jena, Germany
Posts: 2,662
|
|
I stand corrected. The ALTER_TIME attribute was indeed added in V9.5 ( ftp://ftp.software.ibm.com/ps/produc.../db2mgg952.pdf). I would have thought that it came with the ALTER VIEW statement in V9.1 already.
__________________
Knut Stolze
IBM DB2 Analytics Accelerator
IBM Germany Research & Development
|
|
| Thread Tools |
Search this Thread |
|
|
|
| Display Modes |
Linear Mode
|
Posting Rules
|
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
HTML code is Off
|
|
|
|
|