tks. but as I said, I am quite new to DB2 and it seems not so easy for
me. Any sample codes out there or somebdy can show me?
Mikael
> > ok. So, can not REORG TABLESPACE then.
> >
[quoted text clipped - 11 lines]
> Why not write a script that queries the DB2 Catalog Tables to generate REORG
> TABLE / REORG INDEX statements for all your tables/indexes?
> tks. but as I said, I am quite new to DB2 and it seems not so easy for
> me. Any sample codes out there or somebdy can show me?
[quoted text clipped - 19 lines]
>> --
>> Jeroen
SELECT TABNAME FROM SYSCAT.TABLES WHERE TABSCHEMA = 'YOUR_SCHEMA'
SELECT INDNAME FROM SYSCAT.INDEXES WHERE INDSCHEMA = 'YOUR_SCHEMA'
Now you get table and index names in schema YOUR_SCHEMA.
Then you can write a sript that does the reorg:
SELECT 'REORG TABLE '|| RTRIM(LTRIM(TABSCHEMA)) || '.' ||
RTRIM(LTRIM(TABNAME)) FROM SYSCAT.TABLES WHERE TABSCHEMA = 'EMGSYS'
SELECT 'REORG INDEXES ALL FOR TABLE '|| RTRIM(LTRIM(TABSCHEMA)) || '.' ||
RTRIM(LTRIM(TABNAME)) FROM SYSCAT.TABLES WHERE TABSCHEMA = 'EMGSYS'
Now just copy the result (each column into one file) and run it:
DB2 CONNECT TO DB_NAME USER USER USING PASSWORD
DB2 -F your_table_file.sql
DB2 -F your_indexes_file.sql
Best regards,
Kovi

Signature
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| Gregor Kovac | Gregor.Kovac@mikropis.si |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-