ddlgen
ddlgen的描述A Java-based tool that generates definitions for server- and database-level
objects in Adaptive Server. ddlgen supports Adaptive Server version 11.9.2 and
later.
语法:
ddlgen
-Ulogin
-Ppassword
-Shost_name : port_number
[-Tobject_type]
[-Nobject_name]
[-Ddatabase_name]
[-Xextended_object_type]
[-Ooutput_file]
[-Eerror_file]
Or
ddlgen -v
ddlgen参数说明-U login
specifies a login name, and is case-sensitive.
-P password
specifies your password.
-Shost_name : port_number
specifies the host name or IP address of Adaptive Server, as well as its port
number. Separate host_name and port_number with a colon, without spaces
before or after it.
Note You must use the -S option because ddlgen does not connect to a default
server, and does not support interface files.
-Tobject_type
specifies the type of object you are creating. If you do not use -T, ddlgen
creates a DDL for the default database of login. Table 6-3 lists object types
for -T.
-Nobject_name
specifies the fully qualified name of the object you are creating, such as
-Ndb_name.owner.table.index.
The -N option:
is required if you specify any object_type other than DB (database) in
the -T parameter.
accepts wildcards with the use of %.
Use -N% to generate a DDL for all items of a specific object type on your
server.
-Ddatabase_name
specifies the name of the database for the object you specify in the -N option.
The default is the user’s default database.
-Xextended_object_type
differentiates user tables (OU) from proxy tables (OD) when you specify a
table as your object type (-TU). If object_type (-T) is U (table) and -X is not
specified, ddlgen generates DDL for both user tables and proxy tables. To
generate a DDL only for:
user tables – use the OU extended object type with the -X option.
proxy tables – use the OD extended object type with the -X option.
-Ooutput_file
specifies an output file for the generated DDL. If you do not specify -O, the
DDL you create appears in a console window.
-Eerror_file
specifies a log file for recording errors. If you do not specify -E, the
generated errors appear in a console window.
-v
displays the version and copyright message of ddlgen and returns to the
operating system.Object type描述C cache
D default
DB database
DBD database device
DPD dump device
EC execution class
EG engine group
GRP group
I index
L login
P stored procedure
R rule
RO role
RS remote server
SGM segment
TR trigger
U table
UDD user-defined datatype
USR user
V view
XP extended stored procedure
ddlgen用法1、存储过程
ddlgen -Usa -P -Sip:port -Duserdb -TP -N% -O proc.ddl
2、数据库
ddlgen -Usa -P -Sip:port -Duserdb -TDB -Nuserdb -O db.ddl
3、表结构
ddlgen -Usa -P -Sip:port -Duserdb -TU -N% -O table.ddl
4、视图
ddlgen -Usa -P -Sip:port -Duserdb -TV -N% -O view.ddl注意1、正常只要导出这些就可以了。当然如果你定义了触发器或需要导出用户信息都可以。
2、导出数据库的情况下,已经包含了导出表结构定义。如果不需要创建数据库,可以只导表结构定义。
3、表结构定义的所有外键是在最后的,因此无需担心表的先后顺序。
4、用户权限必须是数据库的dbo或sa。