DB2 Archive

Deleting a lot of rows fast

Need to delete millions of rows from a table fast? Here is how you can do this: 1: ALTER TABLE table_name ACTIVATE NOT LOGGED INITIALLY; --disable logging 2: DELETE FROM table_name WHERE ....; 3:

DB2 Space Management

Here are some very useful utility SQLs that will allow you to understand your space usage, system and other useful stuff: DB2 Space Usage & Status 1: -- to find tablespace status, type ,

DB2 Scripts – Table Management

Here are a few more nice DB2 scripts that would save you time: Get all tables in Table Space -- Get all tables in particular tablespaceselect SUBSTR(TABNAME,1,25) "TABNAME", SUBSTR(TABSCHEMA,1,15) "SCHEMA", NPAGES, CARD from syscat.tables