Nuodb Migrator Schema命令

The schema command generates a DDL SQL statement script to create database objects that have been defined in a schema of a source NuoDB or third-party database. The types of command line options that are available to the schema command include:

  • 源数据库选项
    指定源Nuodb或第三方数据库的详细信息,例如数据库连接,登录凭据和事务属性。

  • 目标数据库选项
    指定目标Nuodb数据库的详细信息,例如数据库连接,登录凭据和架构信息。 如果提供了目标数据库选项,则在目标Nuodb数据库中执行DDL SQL脚本,它会创建数据库对象。

  • 输出脚本定义和格式化
    为生成DDL SQL对象创建语句的对象指定过滤器。 您还可以指定不包含在DDL SQL语句创建中的对象。 For example, specify the type of DDL commands generated for each object, such as DROP and/or CREATE statements and define syntax such as qualifying schema name and using quotes.

  • 数据类型映射选项
    覆盖将生成的默认数据类型。

The output from running the schema command includes a data types mapping summary. For each source type, the summary shows the NuoDB type it was mapped to.

句法

nuodb-migrator schema
        --source.driver=source_driver_class_name
        --source.url=jdbc:source_jdbc_url
        --source.schema=my_schema
        --source.username=userid
        --source.password=passwd
        --output.path=path_and_filename_for_ddl_sql_file [option]...

The following is a list of schema command line options (option). Some of these NuoDB Migrator schema command line options are also available to be used with the NuoDB Migrator dump and/or load commands.

与源数据库连接相关的选项

选项

必需的?

schema option valid for dump and/or load command

描述

--source.driver =driver

是的

只转储

JDBC驱动程序类名称

--source.url =.url

是的

只转储

源数据库连接URL标准语法: jdbc:subprotocol:subname

选项ally, include the source database username and password in the url specification. 如下表所示,语法可以根据源数据库而异。 The url examples show the specification of rootuser as the username and rootpw as the password.

MSSQL Server使用JDBC驱动程序

--source.url =. jdbc:sqlserver://192.168.0.6;user=rootuser;password=rootpw;database=tempdb

MSSQL Server使用JTDS驱动程序

--source.url =. jdbc:jtds:sqlserver://192.168.0.6:1433;user=rootuser;password=rootpw;databaseName=tempdb

mysql司机

--source.url =. jdbc:mysql://localhost:3306/test?user=rootuser&password=rootpw

诺博德驾驶员

--source.url =. jdbc:com.nuodb://127.0.0.1/test?schema=TEST&user=rootuser&password=rootpw

Oracle Driver.

--source.url =. jdbc:oracle:thin:rootuser/rootpw@192.168.0.11:1521/XE

PostgreSQL.

--source.url =. jdbc:postgresql://192.168.0.99:5432/test?user=rootuser&password=rootpw

It is allowed to specify the database username and password in both the source.url option and in the source.usernamesource.password options. If you do this and the specifications are not the same then there is a warning message but the schema command continues execution by using one of the specifications. 该指定命令用途取决于您使用的源驱动程序:

规范 source.url 规范 source.usernamesource.password

MSSQL Server使用JTDS驱动程序 MySQL driver Oracle driver PostgreSQL driver

MSSQL Server使用JDBC驱动程序 NuoDB driver

--source.username =. username

是的

只转储

Source database username. Alternatively you can specify the user name in the source.url option.

--source.password =. password

只转储

Source database password. Alternatively you can specify the password in the source.url option.

--source.properties =. properties

只转储

额外的连接属性被编码为URL查询字符串,例如URL查询字符串。“property1=value1&property2=value2…​

--source.catalog =. catalog

只转储

默认数据库目录名称使用

--source.schema =.schema

只转储

要使用的默认数据库架构名称

--source.auto.commit = { true | false }

只转储

If set to true, each individual statement is treated as a transaction and is automatically committed after it is executed. The default is false.

--source.transaction。 isolation=value

只转储

设置迁移执行的事务隔离级别。 A valid value can be either a symbolic name or an integer constant representing transaction isolation levels as defined in the JDBC java.sql.Connection class. 有效值包括:

  • none or 0

  • read.uncommitted or 1

  • read.committed or 2

  • repeatable.read or 4

  • serializable or 8

  • vendor_dependent_level

NuoDB does not support all of the levels, only read.committed or 2, serializable or 8 and two additional levels that are not in the JDBC standard. See 支持的交易隔离级别 想要查询更多的信息。

与目标数据库连接相关的选项。 如果提供的话,DDL命令将在目标数据库中执行。 目标参数还可以定义关于数据映射定义的细节。

选项

必需的?

schema option valid for dump and/or load command

描述

--target.url =.url

只有负载

目标数据库连接URL格式, jdbc:com.nuodb://host:port/database

--target.Username =. username

只有负载

目标数据库用户名

--target.password =. password

只有负载

目标数据库密码

--target.properties =. properties

只有负载

额外的连接属性被编码为URL查询字符串,例如URL查询字符串。“property1=value1&property2=value2…​

--target.Schema =.schema

只有负载

要使用的数据库模式名称。如果没有提供,则对象将在与源数据库模式相同的架构中生成。

与DDL SQL脚本文件输出相关的选项

选项

必需的?

schema option valid for dump and/or load command

描述

--output.path=path/filename

-

Saves DDL SQL script to a file specified by path/filename. 如果省略此参数,则DDL将显示为标准输出。

--table.type=table_type[,table_type…​]

dumpload

Comma separated types of table objects (TABLE, SYSTEM TABLE, GLOBAL TEMPORARY, ALIAS, SYNONYM, etc. to process. By default, only TABLE type is processed. 迁移器工具目前不支持视图,触发器,函数和存储过程。

--meta.data.value={true | false}

dumpload

包括或排除生成的输出中的特定元数据类型。 Valid values are:

  • table

  • primary.key

  • index

  • foreign.key

  • check

  • sequence

  • column.trigger

默认情况下,生成所有对象。 If you have tables with a sequence auto-generated column, you cannot use the --meta.data.sequence=false option when migrating those tables.

--script.type = {删除|创造}

load only

为每个对象生成的DDL语句类型。

Default is both DROPCREATE statements for each object.

--group.scripts.by = {表| meta.data}

load only

Group generated DDL scripts. Group by table is the default. CREATE/ALTER statements for the table and all indexes, foreign keys, etc. will be generated before it moves to the next table CREATE statement.

- identier.quoting = { minimal | always | fully_qualified_class_name}

load only

Identifier quoting policy name, implementing com.nuodb.migrator.jdbc.dialect.IdentifierQuoting. Valid options are:

  • minimal - policy quotes only SQL keywords and not valid identifiers (valid identifier matches [a-zA-Z0-9_]* pattern)

  • always - 策略引用所有标识符。这是默认行为。

  • A fully qualified class name of a custom identifier quoting policy (i.e. com.somepackage.CustomIdentifierQuoting).

- identier.normalizer = { noop | standard | lowercase | uppercase | fully_qualified_class_name }

load only

Identifier transform to use, implementing com.nuodb.migrator.jdbc.dialect.IdentifierNormalizer. Valid options are:

  • noop - 策略返回不变的标识符。这是默认行为。

  • standard - strategy delegates identifier normalization to the dialect, which by defaults does no normalization (and looks similar to noop)

  • lowercase - 将字符转换为小写

  • uppercase - 将字符转换为大写

  • a fully qualified class name of a custom normalizer (i.e. com.somepackage.CustomIdentifierNormalizer)

--naming.strategy = { auto | hash | qualify}

load only

命名策略来定义生成某些对象名称的方法。 这与类型索引,外键,序列,触发器的对象涉及。 Valid options are:

  • auto - generates a qualified name for the specific object types (see qualify option). If the object name is greater than the maximum object name limit of 128 characters, it will generate a shorter name (see hash option). 这是默认值。

  • qualify - 根据对象类型,这为特定对象类型生成限定名称。 例如,索引对象名称被生成为表名,后跟由索引定义的每个列名称。 每个都被下划线分隔。

  • hash - 通过将哈希值附加到索引类型前缀,为对象生成更短的名称。 For example, index object names are generated as IDX_some hash value.

  • A custom strategy may be defined by specifying a fully qualified class name (i.e. --naming.strategy=com.package.MyCustomName). 此策略允许完全控制所有类型对象的对象名称定义:表,列,序列,索引,主键,外键,检查约束和触发器。

与自定义数据类型映射相关的选项

选项

必需的?

schema option valid for dump and/or load command

描述

- type.code =.type_code

load only

此参数标识我们要指定自定义映射的源数据库中的类型。 See type.code.

- type.size =.type_size

load only

定义源数据类型的大小。 此参数将允许您将不同大小的源类型映射到不同的目标类型。 See also type.size, precision, scale.

- type.precision =.type_precision

load only

可以存储的最大十进制数字总数,位于小数点的左侧和右侧。 此参数将允许您将不同精度的源类型映射到不同的目标类型。 See also type.size, precision, scale.

- type.scale =.type_scale

load only

用于数字数据类型的分数位数(小数点后的数字)。 此参数将允许您映射不同比例的源类型,以不同的目标类型。 See also type.size, precision, scale.

- type.name =.type_name

load only

SQL type name , i.e., DECIMAL(p[,s]) or VARCHAR(n), where p is precision, s is scale, and n is a maximum size. See type.name.

--config =path

load only

Specifies a custom type mapping configuration file, where path is a full path and filename for the file. 此文件用于将源数据库数据类型转换为目标数据库数据类型。 If the file conf/nuodb-types.config is to be used, it is not necessary to use this parameter. It is only necessary to use the --use.nuodb.types=true command line parameter.

-use.nuodb.types = {true |错误的 }

load only

Instructs the migrator to transform source database types to the best matching NuoDB types, where CHAR, VARCHARCLOB source types will be rendered as STRING columns. The conf/nuodb-types.config file is the source file for type overrides. If some other file is to be used, the --config =path parameter must be used to define the file. 默认情况下,此选项为false。 See Nuodb Migrator Schema命令示例, 和 use.nuodb.types below.

-USE.EXPLICT.DEFAULTS = {TRUE |错误的 }

load only

仅影响MySQL隐式默认值。 此选项允许MySQL隐式默认值明确地转移到NOODB架构。 The option is false by default. See Nuodb Migrator Schema命令示例.