The Multifunctioning DBA

Apr 29 2010   9:32PM GMT

ddlgen in Sybase



Posted by: Colin Smith
Tags:
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.

#!/bin/ksh
dblist=`isql -S servername -Usa << endit | tail +4
password
use master
go
set nocount on
go
select name
from sysdatabases
go
exit
endit
`
echo $dblist
for db in $dblist
do
ddlgen -Usa  -SCIRC_DBA -D $db -TDB -F% -O $db.definitions.out

password
done

2  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.

REGISTER or login:

Forgot Password?
By submitting you agree to receive email from TechTarget and its partners. If you reside outside of the United States, you consent to having your personal data transferred to and processed in the United States. Privacy
  • 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. sybase.com says follow the steps STRICTLY but no CLEAR steps mentioned.
    5 pointsBadges:
    report
  • 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
    885 pointsBadges:
    report

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: