Exporting DDLs from Your Database

Posted Mon, 12 Dec 2005

It's often useful to be able to recreate an empty copy of your database. Most popular database systems come with utilities to export your database's DDL to a flat file so you can recreate the structure elsewhere. Here's a list of how to do it on various popular database systems:

IBM DB2

db2look -d databasename [-z schemaname] -e -o outputfile

I've only tested this one on DB2 8.1, but I believe the db2look utility also comes with DB2 7.

PostgreSQL

pg_dump -s dbname > outputfile

MySQL

mysqldump --no-data databasename > outputfile

I've never had to do this in SQL Server or Oracle. If anyone knows the commands for those - or any other popular DB - please post comments!

Related Books

SYSTEMS INTEGRATION AND NETWORKING: DDL APPROVED BY IEC AS INTERNATIONAL STANDARD.: An article from: Manufacturing Automation Sams Teach Yourself SQL in 10 Minutes (3rd Edition) (Sams Teach Yourself) The Berkeley DB Book (Books for Professionals by Professionals) Easy HTML-DB Oracle Application Express: Create Dynamic Web Pages with OAE (Easy Oracle Series) IDMS/R DDL reference

Post a Comment




About

My name is Tim Fanelli, I am a software engineer in Northern NY. I spend most of my time working, and when I can, I try to post interesting things here.

Cigar Dossiers