Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

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

Posted on 2012-03-29
9
Medium Priority
?
921 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
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
LVL 25

Accepted Solution

by:
Tomas Helgi Johannsson earned 2000 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

Veeam Task Manager for Hyper-V

Task Manager for Hyper-V provides critical information that allows you to monitor Hyper-V performance by displaying real-time views of CPU and memory at the individual VM-level, so you can quickly identify which VMs are using host resources.

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 …
Java performance on Solaris - Managing CPUs There are various resource controls in operating system which directly/indirectly influence the performance of application. one of the most important resource controls is "CPU".   In a multithreaded…
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.:
In a previous video, we went over how to export a DynamoDB table into Amazon S3.  In this video, we show how to load the export from S3 into a DynamoDB table.
Suggested Courses

705 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