Posted by: Colin Smith
Administration, DDL, DDLGEN, Sybase
I completed an upgrade from Sybase 12.5 to Sybase 15.0 recently and I found that it ended up breaking some scripts that we use to generate ddl for all instance devices and all create databases. The scripts that we were using were writting log ago by people that are no longer working for the company. I decided to change this up to use ddlgen to create all this for us. ddlgen is a very nice little program that is able to generate the ddl and output it into files for use, if needed, in the future. Here is what I did to get all the devices ddl out of an instance.
ddlgen -U username -S servername -TDBD -N% -O outputfilename
That is simple enough to do and man it works great. This will get you the DDL needed to init all of the devices on the instance. Now I need to get the DDL to create all of the databases. For this I wrote a little shell script to get a listing of all the databases and then do the ddl gen for each. Here is that.
dblist=`isql -S servername -Usa << endit | tail +4
set nocount on
for db in $dblist
ddlgen -Usa -SCIRC_DBA -D $db -TDB -F% -O $db.definitions.out