dbschema 实用程序打印复制指定表、视图或数据库所需的 SQL 语句。它还显示 UPDATE STATISTICS 语句创建的分发。
可以将 dbschema 实用程序用于以下用途:
显示 SQL 语句(模式),这是复制数据库或特定表、视图、同义词、序列或过程所必需的。
显示 Information Schema 视图的模式
显示为数据库中的一个或多个表存储的分布信息
显示有关用户定义的数据类型和行类型的信息
警告:
使用 dbschema 实用程序可以增加数据库中的序列对象,而在生成的数字中创建间隔则可能不是那些需要序列化整数的应用程序所期望的。
使用 dbschema 且只指定了数据库名称时,等价于使用带所有选项(除了 -hd 和 -ss 选项)的 dbschema。另外,如果为数据库创建了“信息模式”视图,则将显示此模式。例如:以下两个命令是等价的:
dbschema -d stores_demo
dbschema -s all -p all -t all -f all -d stores_demo
经常使用的导出数据库所有信息的语句。
dbschema -s all -p all -t all -f all -d stores_demo -ss stores.sql
[informix@test ~]$ dbschema
DBSCHEMA Database Schema UtilityINFORMIX-SQL Version 10.00.UC4
Copyright IBM Corporation 1996, 2004 All rights reserved
Software Serial Number AAA#B000000
USAGE:
dbschema [-q] [-t tabname] [-s user] [-p user] [-r rolename] [-f procname]
[-hd tabname] -d dbname [-w passwd] [-seq sequence] [-l [num]]
[-u [ia] udtname [all]] [-it [Type]] [-ss [-si]] [filename]
-q Suppress the db version from header
-t table name or "all" for all tables
-s synonyms created by user name
or "all" for all users
-p permissions granted to user name
or "all" for all users
-r create and grant of the role
or "all" for all roles :Not a valid option for SE
-f SPL routine name
or "all" for all SPL routines
-hd Histograms of the distribution for columns of
of a specified table, a specific table column,
or "all" for all tables.
-d database name
-w database password
-seq generate sequence specific syntax
-u Prints the definitions of user-defined data types
-ui Prints the definitions of user-defined data types,
including type inheritance
-ua Prints the definitions of user-defined data types,
including all functions and casts defined over a type
-u all Directs dbschema to include all the tables
in the display of distributions
-it Type of isolation can be DR, CR, CS or RR
-l set lock mode to wait [number] optional
-ss generate server specific syntax
-si excludes the generation of index storage clauses for
non-fragmented tables
filename is the name
of file that the SQL
script goes in.
[informix@test ~]$