Solved

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

Posted on 2012-03-29
9
891 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
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
DevOps Toolchain Recommendations

Read this Gartner Research Note and discover how your IT organization can automate and optimize DevOps processes using a toolchain architecture.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Using libpcap/Jpcap to capture and send packets on Solaris version (10/11) Library used: 1.      Libpcap (http://www.tcpdump.org) Version 1.2 2.      Jpcap(http://netresearch.ics.uci.edu/kfujii/Jpcap/doc/index.html) Version 0.6 Prerequisite: 1.      GCC …
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.
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…
Learn how to find files with the shell using the find and locate commands. Use locate to find a needle in a haystack.: With locate, check if the file still exists.: Use find to get the actual location of the file.:

863 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

Need Help in Real-Time?

Connect with top rated Experts

26 Experts available now in Live!

Get 1:1 Help Now