2012-01-04

How to rename tablespaces in IBM DB2 with SAP

Recently I had many problems with renaming tablespaces. So I decided to share my experience!

Pre: materialize all virtual tables!

I.
You can use the db2 command:
RENAME TABLESPACE {OLD_NAME} TO {NEW_NAME}

and execute it for every tablespace. It is better to make a script!

II.
After that you have to alter tables:
TADB6, TSDB6 and IADB6
with the new tablespace names.

I used the DB2 client for that because I couldn't make it through SAP.

That should do it! (mine was IBM DB2 v9.1 FP5)


The Problems!


1. If you have virtual tables when renaming, you will realize that they can't materialize after you renamed all the tablespaces.
To solve that follow note 1227165, which is: execute in command prompt:
db6util -rtvt {old tbs} {new tbs}
for every tablespace.


2. If you have run SPAM or SAINT before altering the three tables (TADB6, TSDB6 and IADB6), you will see that it will halt at phase IMPORT_PROPER, and will give you an error, because it is trying to connect to the old tablespaces.

To solve that, you have to alter the three tables of course, but is is not enough. Because SPAM/SAINT already created commands using the data from the three tables.
You have to alter table:
TATAF
and replace all old names with the new ones.

Many thanks to these people here:
http://forums.sdn.sap.com/thread.jspa?threadID=619392

No comments:

Post a Comment