Recently I did an upgrade from Sybase 12.5 to Sybase 15.0 and this upgrade changed some system tables that broke the scripts that we had in place to generate DDL for all the devices and database creates. I have been working on fixing this issue and I have resolved the issue by modifying our scripts to use DDLGen that comes with Sybase. I chose this solution because DDLGen is a Sybase tool that has been around for a while and I do not think that it will be going away anytime soon. DDLGen is a very cool utility that allows you to get DDL for all objects in the server. Here is what I did since I only wanted to get DDL for the devices to be added and the Create Statements for all databases on the server. I am not getting DDL for all DB objects like tables, triggers, constraints, and things of that nature.
This is how I generate a list of all the Devices that need to be part of the Server.
ddlgen -Usa -S $server -P $password -TDBD -N% -O $dis_rec_dir/$server.devices.sql
This will gather all the DDL for all devices and place them in the dis_rec_dir folder in a file called servername.devices.sql. In the case of a disaster, now I can just run this script and all the devices, as long as the raw files are available, will be added to the server.
Here is what I am doing to get all the Database Create DDL.
ddlgen -Usa -P $password -S $server -D $db -TDB -F% -O $dis_rec_dir/create.$db.sql
This will gather the DDL for all databases on the server and put them into the dis_rec_dir in a file called create.databasename.sql. Now I can run this script to create the database on the server on all the correct devices and with data and log on the correct devices.
The script is written so that it will loop thru and generate the DDL for all databases on the server.