Skip to Content
0

generate ALL db's DDL in a ASE server

Jan 18, 2017 at 08:24 PM

43

avatar image

Hi List,

I am looking for a solution to generate a script : DDL's for all user databases from a ASE 16.0 ( only db's creation, not other objects), I used: ddlgen -TDB -N% -o db's.sql but this will get all system db's from a server also , and objects def, is there a more elaborate option with ddlgen ?

Thank you

10 |10000 characters needed characters left characters exceeded
* Please Login or Register to Answer, Follow or Comment.

4 Answers

Mark A Parsons Jan 18, 2017 at 08:36 PM
0

Unfortunately there is (currently) no way to automagically determine which databases are 'system' dbs and which are 'non-system' dbs (eg, there is no this-is-a-system-database flag in sysdatabases).

Your best bet is to generate your own list of db names and then run ddlgen against said list of databases.

Share
10 |10000 characters needed characters left characters exceeded
Isabella Ghiurea Jan 18, 2017 at 09:00 PM
0

Mark , thank you for comment.

How do I exclude the db's objects DDL with DDLGEN ?

Share
10 |10000 characters needed characters left characters exceeded
Mark A Parsons Jan 18, 2017 at 09:18 PM
0

Try filtering out all object types, eg:

ddlgen -U<login> -P<password> -S<server_name> -N<dbname> -F%

You could then filter the output through egrep/sed/awk (take your pick) to discard stuff like use <dbname>, sp_dboption, sp_changedbowner, etc.

Altenatively you could write your own SQL script to generate the create/alter database commands from a join of sysdatabases/sysusages/sysdevices.

Share
10 |10000 characters needed characters left characters exceeded
Mark A Parsons Jan 19, 2017 at 03:17 PM
0

FWIW, here's a thread from mid-2016 discussing ideas on how to distinguish 'system' dbs from user dbs: https://archive.sap.com/discussions/thread/3912153

Share
10 |10000 characters needed characters left characters exceeded