WorkingScripts

The Stuff that Just Works

WorkingScripts header image 5

Entries from March 19th, 2008

Deleting a lot of rows fast

March 19th, 2008 No Comments

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: COMMIT; –Commits and enable logging

Tags:   ·

DB2 Space Management

March 12th, 2008 No Comments

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 , usage run following SQL

2: select substr(tablespace_name,1,20) Tablespace_name,

3: case t.TBSPACETYPE [...]

Tags:   ·

Non-Shared Temp Tables Cleanup

March 7th, 2008 No Comments

Some of the processes that depend on shared table instances , can experience a dramatic differences in performance, in case all of the instances available are being used, or remaining locked by some orphan or failed process. One way to resolve this problem is to go online and check if tables should be “released”. Here [...]

Tags:   · · ·

DB2 Scripts – Table Management

March 4th, 2008 No Comments

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 where tbspace = ‘?’

Generate Grants for all tables in Table Space

– Genereating GRANTS SELECT ‘grant select on ‘ || tabname || ‘ to [...]

Tags:   · ·