Solved

Is there a way to change table schema w/o drop/recreate?

Posted on 2012-03-29
9
911 Views
Last Modified: 2012-08-13
Hi all,

Is there a way, tool, routine or such to change a table schema to a new schema? In the mainframe, we have if we want to change OLDNAME to NEWNAME we can code the following CATMAINT job:

CATMAINT UPDATE
SCHEMA SWITCH(OLDNAME, NEWNAME)

Is there any such utility for DB2 LUW?
0
Comment
Question by:Enyinnaya
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
9 Comments
 
LVL 37

Expert Comment

by:momi_sabag
ID: 37783762
you can duplicate a schema but you can't rename it
0
 
LVL 27

Expert Comment

by:tliotta
ID: 37783869
...change a table schema to a new schema?

AFAIK, the CATMAINT UPDATE SCHEMA SWITCH() renames a schema. Are you wanting to rename the schema that contains a table? Or are you wanting to change which schema a table is part of?

Tom
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 37786567
Hi!

There is a command in LUW called db2move see the manual
http://publib.boulder.ibm.com/infocenter/db2luw/v9/index.jsp?topic=%2Fcom.ibm.db2.luw.admin.dm.doc%2Fdoc%2Fr0024482.html

I think this is the only option in LUW that I know of that does this.

Regards,
    Tomas Helgi
0
Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 total points
ID: 37786576
Hi!

Sorry db2move is used across databases. The procedure you are looking for is ADMIN_COPY_SCHEMA which does this within the db.

Regards,
    Tomas Helgi
0
 

Author Comment

by:Enyinnaya
ID: 37788371
Tomas Helgi,

You got it right on the money! That ADMIN_COPY_SCHEMA is what I was looking for. And yes, does it with the same DB.

Thanks, Tom
0
 

Author Comment

by:Enyinnaya
ID: 37789325
I've requested that this question be closed as follows:

Accepted answer: 0 points for Enyinnaya's comment #37788371

for the following reason:

Good answer
0
 
LVL 25

Expert Comment

by:Tomas Helgi Johannsson
ID: 37789326
If my answer was good you  you should accept my comment  :)

Regards,
      Tomas Helgi
0

Featured Post

Optimize your web performance

What's in the eBook?
- Full list of reasons for poor performance
- Ultimate measures to speed things up
- Primary web monitoring types
- KPIs you should be monitoring in order to increase your ROI

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

I previously wrote an article addressing the use of UBCD4WIN and SARDU. All are great, but I have always been an advocate of SARDU. Recently it was suggested that I go back and take a look at Easy2Boot in comparison.
I use more than 1 computer in my office for various reasons. Multiple keyboards and mice take up more than just extra space, they make working a little more complicated. Using one mouse and keyboard for all of my computers makes life easier. This co…
Learn several ways to interact with files and get file information from the bash shell. ls lists the contents of a directory: Using the -a flag displays hidden files: Using the -l flag formats the output in a long list: The file command gives us mor…
Learn how to get help with Linux/Unix bash shell commands. Use help to read help documents for built in bash shell commands.: Use man to interface with the online reference manuals for shell commands.: Use man to search man pages for unknown command…

628 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question