View Full Version: Create A Table For Dbdef

LawsonTalk > Database > Create A Table For Dbdef


Title: Create A Table For Dbdef
Description: any shortcuts?


3monkeys - January 30, 2007 09:27 PM (GMT)
I have a need to create a custom table as a copy of the Employee table. Easy to just go and create it in the database, but it also needs to be defined in dbdef. I'm lazy and didn't feel like keying it from scratch. I don't see any obvious "copy table" commands in dbdef either. Anybody have a slick way to get it defined in dbdef so it'll get created after the blddbdict/dbreorg? I don't care about the data, I can populate it and keep it up to date some other way. Any hints appreciated.

Env: 8.0.3.6
Apps: 8.1.0.5
AIX 5.2, Ora 9i

-GW

Phil Feller - January 31, 2007 02:26 PM (GMT)
You can use the metadumptbl command to dump the table definition. The dump file that is created is plain text, so you can edit it to make the changes that you need and use the metaloadtbl command to load it and create the new dbdef definition. In your case you probably don't need to worry about the table using new elements, but there are metadumpelm and metaloadelm commands that would be used for this.

schroncd - January 31, 2007 03:26 PM (GMT)
Darn Phil.. You take ALL the fun out of it!!

I was in the middle of researching the GEN table structures and writing a script to generate the proper csv files when you come along and post a utility name that already DOES it!! Jeesh!! :bonk:

Guess I'll go back to reading slashdot :cof:

trezaei - January 31, 2007 06:10 PM (GMT)
QUOTE (Phil Feller @ Jan 31 2007, 02:26 PM)
You can use the metadumptbl command to dump the table definition. The dump file that is created is plain text, so you can edit it to make the changes that you need and use the metaloadtbl command to load it and create the new dbdef definition. In your case you probably don't need to worry about the table using new elements, but there are metadumpelm and metaloadelm commands that would be used for this.

yeah the metadump programs are excellent and I am sooo glad they decided to finally make them. FYI I believe it is only available on 8.1 and newer.

I have seen some strange bugs with it when dealing with certain fields but overall it can save you hours.

3monkeys - January 31, 2007 07:18 PM (GMT)
Thanks, Phil. That worked. What a pain to edit though when EMPLOYEE is a table and a field name.

-GW

schroncd - January 31, 2007 07:45 PM (GMT)
Tsk tsk Greg.. I thought I taught you better..

in vi

:%s/:EMPLOYEE,/:NEWTABLE,/g

3monkeys - January 31, 2007 09:31 PM (GMT)
In several cases it was table name, field name. Couldn't do a global change. Didn't do them one at a time, mind you. Just had to be careful what pattern to hit. Sometimes the pattern matched a field, sometimes a table. The .tbl file is pretty large so I just did it in sections.

MannieJ - January 31, 2007 10:08 PM (GMT)
Actually these meta utilities as we may call it, already existed in 8.02x. We have been using these utilities epecially when our data dictionaries are out of sync with oracle.

Phil Feller - February 1, 2007 02:51 PM (GMT)
QUOTE (schroncd @ Jan 31 2007, 07:26 AM)
I was in the middle of researching the GEN table structures and writing a script to generate the proper csv files when you come along and post a utility name that already DOES it!!  Jeesh!!

But David, I left you with the task of writing an sed script that Greg could have used to change only the table name in the dump file. And you dropped the ball!

schroncd - February 1, 2007 06:25 PM (GMT)
Ya know. i ALMOST wrote it, but I said to myself, "Naw.. That's just too obvious." Guess I'll know better next time! :banghead:



Hosted for free by InvisionFree