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!
add to del.icio.us



