By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,583 Members | 1,084 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,583 IT Pros & Developers. It's quick & easy.

REORG TABLESPACE

P: n/a
Must admit, I am new to DB2:

Seems I can not issue command REORG TABLESPACE:

Commands Entered:
REORG TABLESPACE SBO_DB.TS_SBO_SAFE;

SQL0104N An unexpected token "TABLESPACE" was found following "REORG".

Expected tokens may include: "TABLE". SQLSTATE=42601

What am I doing wrong? According to helpfile it should work...

Mikael

Jul 5 '06 #1
Share this Question
Share on Google+
9 Replies


P: n/a
Mikael wrote:
Must admit, I am new to DB2:

Seems I can not issue command REORG TABLESPACE:

Commands Entered:
REORG TABLESPACE SBO_DB.TS_SBO_SAFE;

SQL0104N An unexpected token "TABLESPACE" was found following "REORG".

Expected tokens may include: "TABLE". SQLSTATE=42601

What am I doing wrong? According to helpfile it should work...

Mikael
Only REORG format I can find in the doc is:

REORG TABLE
REORG INDEXES

Larry Edelstein
Jul 5 '06 #2

P: n/a
Tks for your quick feedback

this link
http://publib.boulder.ibm.com/infoce...bjnbmstr28.htm

shows. Perhaps only under z/OS? We use DB2 V8.2.3 under Windows 2000
server.

Mikael Arhelger
Larry wrote:
Mikael wrote:
Must admit, I am new to DB2:

Seems I can not issue command REORG TABLESPACE:

Commands Entered:
REORG TABLESPACE SBO_DB.TS_SBO_SAFE;

SQL0104N An unexpected token "TABLESPACE" was found following "REORG".

Expected tokens may include: "TABLE". SQLSTATE=42601

What am I doing wrong? According to helpfile it should work...

Mikael
Only REORG format I can find in the doc is:

REORG TABLE
REORG INDEXES

Larry Edelstein
Jul 5 '06 #3

P: n/a
In article <11**********************@m73g2000cwd.googlegroups .com>,
mi************@gmail.com says...
Tks for your quick feedback

this link
http://publib.boulder.ibm.com/infoce...bjnbmstr28.htm

shows. Perhaps only under z/OS? We use DB2 V8.2.3 under Windows 2000
server.
That's right. The DB2 for Windows (and linux/unix) docs can be found at
http://publib.boulder.ibm.com/infoce...help/index.jsp
Jul 5 '06 #4

P: n/a
ok. So, can not REORG TABLESPACE then.

How can I then REORG all my TABLES and INDEX easily without much
hassle. I do not want to be faced with the daunting task to go through
one by one.

This would be needed from time to time obviously.

Any utility (or whatever) out there that does the job? Perhaps
Highlight all the TABLES and INDEX and off you go?

Mikael Arhelger

Gert van der Kooij wrote:
In article <11**********************@m73g2000cwd.googlegroups .com>,
mi************@gmail.com says...
Tks for your quick feedback

this link
http://publib.boulder.ibm.com/infoce...bjnbmstr28.htm

shows. Perhaps only under z/OS? We use DB2 V8.2.3 under Windows 2000
server.

That's right. The DB2 for Windows (and linux/unix) docs can be found at
http://publib.boulder.ibm.com/infoce...help/index.jsp
Jul 5 '06 #5

P: n/a

"Mikael" <mi************@gmail.comschreef in bericht
news:11**********************@75g2000cwc.googlegro ups.com...
ok. So, can not REORG TABLESPACE then.

How can I then REORG all my TABLES and INDEX easily without much
hassle. I do not want to be faced with the daunting task to go through
one by one.

This would be needed from time to time obviously.

Any utility (or whatever) out there that does the job? Perhaps
Highlight all the TABLES and INDEX and off you go?

Mikael Arhelger
Why not write a script that queries the DB2 Catalog Tables to generate REORG
TABLE / REORG INDEX statements for all your tables/indexes?

--
Jeroen
Jul 5 '06 #6

P: n/a
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

Jeroen van den Broek wrote:
"Mikael" <mi************@gmail.comschreef in bericht
news:11**********************@75g2000cwc.googlegro ups.com...
ok. So, can not REORG TABLESPACE then.

How can I then REORG all my TABLES and INDEX easily without much
hassle. I do not want to be faced with the daunting task to go through
one by one.

This would be needed from time to time obviously.

Any utility (or whatever) out there that does the job? Perhaps
Highlight all the TABLES and INDEX and off you go?

Mikael Arhelger

Why not write a script that queries the DB2 Catalog Tables to generate REORG
TABLE / REORG INDEX statements for all your tables/indexes?

--
Jeroen
Jul 5 '06 #7

P: n/a
Mikael wrote:
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

Jeroen van den Broek wrote:
>"Mikael" <mi************@gmail.comschreef in bericht
news:11**********************@75g2000cwc.googlegr oups.com...
ok. So, can not REORG TABLESPACE then.

How can I then REORG all my TABLES and INDEX easily without much
hassle. I do not want to be faced with the daunting task to go through
one by one.

This would be needed from time to time obviously.

Any utility (or whatever) out there that does the job? Perhaps
Highlight all the TABLES and INDEX and off you go?

Mikael Arhelger

Why not write a script that queries the DB2 Catalog Tables to generate
REORG TABLE / REORG INDEX statements for all your tables/indexes?

--
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

--
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
| Gregor Kovac | Gr**********@mikropis.si |
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
| In A World Without Fences Who Needs Gates? |
| Experience Linux. |
-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-~-
Jul 6 '06 #8

P: n/a
Ian
Mikael wrote:
ok. So, can not REORG TABLESPACE then.

How can I then REORG all my TABLES and INDEX easily without much
hassle. I do not want to be faced with the daunting task to go through
one by one.

This would be needed from time to time obviously.

Any utility (or whatever) out there that does the job? Perhaps
Highlight all the TABLES and INDEX and off you go?
Use the autonomic features. Read the docs on automatic maintenance,
specifically for Automatic Reorganization (AUTO_REORG).
Jul 6 '06 #9

P: n/a
Tks everybody! Pointed me in the right direction. Now I know where to
look.

By the way, it (REORG) does not flush out Orphans, correct? Got some
in the System Tables it seem after doing db2ckmig to preapre for
upgrade to V9.

Mikael

Ian wrote:
Mikael wrote:
ok. So, can not REORG TABLESPACE then.

How can I then REORG all my TABLES and INDEX easily without much
hassle. I do not want to be faced with the daunting task to go through
one by one.

This would be needed from time to time obviously.

Any utility (or whatever) out there that does the job? Perhaps
Highlight all the TABLES and INDEX and off you go?

Use the autonomic features. Read the docs on automatic maintenance,
specifically for Automatic Reorganization (AUTO_REORG).
Jul 6 '06 #10

This discussion thread is closed

Replies have been disabled for this discussion.