One of my colleagues have introduced me to this utility and we had our DBAs install it on the system, and voila – you can see DB2 in works: it’s running snapshots online, you can see bufferpools usage, your top processes and much much more. Here is a link to a IBM page that has [...]
Entries Tagged as 'DB2'
DB2 Escape characters in queries
February 18th, 2009 No Comments
Recently I had to use escape characters in DB2 queries and after looking through documentation here is a simple way to do this. You can define you escape character using
{escape ‘\’}
right after the statement your are trying to use it, here is a sample statement:
select oprid, oprdefndesc
from psoprdefn
where oprid like ‘%\_%’ {escape ‘\’}
.csharpcode, [...]
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
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 [...]
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 [...]