Solved

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

Posted on 2012-03-29
9
887 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
Comment Utility
you can duplicate a schema but you can't rename it
0
 
LVL 27

Expert Comment

by:tliotta
Comment Utility
...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 24

Expert Comment

by:Tomas Helgi Johannsson
Comment Utility
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
How to run any project with ease

Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
- Combine task lists, docs, spreadsheets, and chat in one
- View and edit from mobile/offline
- Cut down on emails

 
LVL 24

Accepted Solution

by:
Tomas Helgi Johannsson earned 500 total points
Comment Utility
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
Comment Utility
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
Comment Utility
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 24

Expert Comment

by:Tomas Helgi Johannsson
Comment Utility
If my answer was good you  you should accept my comment  :)

Regards,
      Tomas Helgi
0

Featured Post

How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

Join & Write a Comment

Attention: This article will no longer be maintained. If you have any questions, please feel free to mail me. jgh@FreeBSD.org Please see http://www.freebsd.org/doc/en_US.ISO8859-1/articles/freebsd-update-server/ for the updated article. It is avail…
Good afternoon all, We are running a VM infrastructure on a clustered ESX environment with two DELL R710's.  One of our IT Application Support Engineers contacted me and asked if it was possible to extend the partition of a certain Windows 2003 S…
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.:

763 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

14 Experts available now in Live!

Get 1:1 Help Now