Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Create table script 1

Status
Not open for further replies.

THoey

IS-IT--Management
Jun 21, 2000
2,142
US
Always being one that believes in not reinventing the wheel, does anyone have script that can be run against an instance and create an SQL script that can be run on another instance an recreate the same table structures? If not, I am sure that I could write one, with some time and trial and error, but just thought I would ask first... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Actually, it would probably be easier to use the export utility and just export the structures (not the data itself). Not only do you get the table structure, but you also get indexes, constraints, and grants.
 
I agree, and I knew someone was going to point that out, but for whatever reason, that is not the way our "DBA", and I use the term loosely, wants it done. I keep getting requests to write scripts that he can run to create the structures, indexes, etc...

I keep telling them that they are paying this guy too much. Besides an ocaissional tablespace sizing, pretty much everything else, I get a request to send him the SQL and he'll make the change...

Thanks anyways... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
If your DBA really needs to work from scripts, you can still use export. Use import with the indexfile option. That will cause the DDL to be written to file.

Come to think of it, why can't the DBA do this himself?
 
DING DING DINNNG!!! Give that man a Cigar. I have casually mentioned that me taking over the duties, would put someone on site (he is in N. Calif., I am here), be cheaper (he is a contractor and lives in N. Calif, I am a full time emp), etc... I really think they are starting to see the light of that, but still am waiting for it to happen... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
OK, well if YOU can run the export utility, just specify the table name and select 'no' when it asks you if you want to export the data. After export runs, you will be able to open the dump file and cut/paste the CREATE TABLE statement as well as CREATE INDEX and any constraint definitions. Slap this all into a text file and send it to your
DBA who doesn't seem to be able to do this for some reason.

Then go have a beer.
 
Thanks Carp. I have written them out for this small database already, but I will print this and keep it handy for next time.

Thanks again... Terry M. Hoey
th3856@txmail.sbc.com
While I don't mind e-mail messages, please post all questions in these forums for the benefit of all members.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top