The Multifunctioning DBA

Apr 29 2010   9:32PM GMT

ddlgen in Sybase

Colin Smith Colin Smith Profile: Colin Smith

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
use master
set nocount on
select name
from sysdatabases
echo $dblist
for db in $dblist
ddlgen -Usa  -SCIRC_DBA -D $db -TDB -F% -O $db.definitions.out


3  Comments on this Post

There was an error processing your information. Please try again later.
Thanks. We'll let you know when a new response is added.
Send me notifications when other members comment.
  • Rambo77
    Simply superb....Helped me generate and save all the DDLs for my 12 databases and also for all its tables.Question : We have an ASE upgrade comming up 15.0.2 to 15.7 ESD#1.Can you please give me steps for this upgrade ( we have WSB running on the DR machine, RSSD also located on the same DR-server and so is the RS). I know preupgrade and binary over-lay methods; but not sure how to go about in a WSB Env. says follow the steps STRICTLY but no CLEAR steps mentioned.
    5 pointsBadges:
  • Colin Smith
    Rambo77, I am happy that thy ddlgen post was able to help you, but I must say that I do not know anything about the upgrade that you are working on. I wish I could be of assistance, but I no longer work with Sybase at all. I am pretty much MS SQL Server with a bit of Oracle. My new shop does not use Sybase at all and it has been almost a year since I have touched anything related to Sybase. So all I can suggest is to read the Sybase documentation and if you need help contact Sybase. Also, do the upgrade in some sort of isolated environment if you can first. That way you can verify all of your steps and make sure that you do not have issues in production.   Good Luck
    945 pointsBadges:
  • Maddymadhu
    Thanks Colin for providing this info. I have a trouble that if I am using ddlgen command to get a script of my database that time my database user need to have a sa_role permission which makes that user as a Super User but I want to generate script of catalog using Secondary User mean which doesn't have sa_role. Is there any other permission or role which makes it possible for that secondary user?
    10 pointsBadges:

Forgot Password

No problem! Submit your e-mail address below. We'll send you an e-mail containing your password.

Your password has been sent to:

Share this item with your network: